From: Wez Furlong Date: Fri, 22 Jul 2016 00:51:38 +0000 (-0700) Subject: folly: fixup folly::Random FixedSeed test expectations on macOS X-Git-Tag: 2016.07.26~17 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=138f44b311c1de18d18eddea8ad7f25b93e975e4;p=folly.git folly: fixup folly::Random FixedSeed test expectations on macOS Summary: uniform_int_distribution is implemented differently on this system and always returns the generated number from our constant random number generator. Reviewed By: yfeldblum Differential Revision: D3585418 fbshipit-source-id: 754076599ba77b49c17f03bb0c92264a3bed4ab0 --- diff --git a/folly/test/RandomTest.cpp b/folly/test/RandomTest.cpp index cc576ae4..d7c4f4a5 100644 --- a/folly/test/RandomTest.cpp +++ b/folly/test/RandomTest.cpp @@ -65,12 +65,14 @@ TEST(Random, FixedSeed) { // clang-format on ConstantRNG gen; + + // Pick a constant random number... + auto value = Random::rand32(10, gen); + // Loop to make sure it really is constant. for (int i = 0; i < 1024; ++i) { auto result = Random::rand32(10, gen); - // TODO: This is a little bit brittle; standard library changes could break - // it, if it starts implementing distribution types differently. - EXPECT_EQ(0, result); + EXPECT_EQ(value, result); } }