Actually run the random generator tests

This commit is contained in:
Martin Hořeňovský 2019-08-09 11:21:05 +02:00
parent ebe6a07c23
commit e2d863b090
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -180,16 +180,18 @@ TEST_CASE("Generators -- adapters", "[generators][generic]") {
// Note that because of the non-reproducibility of distributions, // Note that because of the non-reproducibility of distributions,
// anything involving the random generators cannot be part of approvals // anything involving the random generators cannot be part of approvals
TEST_CASE("Random generator", "[generators][.][approvals]") { TEST_CASE("Random generator", "[generators][approvals]") {
SECTION("Infer int from integral arguments") { SECTION("Infer int from integral arguments") {
auto val = GENERATE(take(4, random(0, 1))); auto val = GENERATE(take(4, random(0, 1)));
STATIC_REQUIRE(std::is_same<decltype(val), int>::value); STATIC_REQUIRE(std::is_same<decltype(val), int>::value);
static_cast<void>(val); // Silence VS 2015 unused variable warning REQUIRE(0 <= val);
REQUIRE(val <= 1);
} }
SECTION("Infer double from double arguments") { SECTION("Infer double from double arguments") {
auto val = GENERATE(take(4, random(0., 1.))); auto val = GENERATE(take(4, random(0., 1.)));
STATIC_REQUIRE(std::is_same<decltype(val), double>::value); STATIC_REQUIRE(std::is_same<decltype(val), double>::value);
static_cast<void>(val); // Silence VS 2015 unused variable warning REQUIRE(0. <= val);
REQUIRE(val < 1);
} }
} }