mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Decrease chance of false positive in random generator testing
This commit is contained in:
		@@ -341,8 +341,9 @@ TEST_CASE("Multiple random generators in one test case output different values",
 | 
			
		||||
            same += random1.get() == random2.get();
 | 
			
		||||
            random1.next(); random2.next();
 | 
			
		||||
        }
 | 
			
		||||
        // 0.5% seems like a sane bound for random identical elements within 1000 runs
 | 
			
		||||
        REQUIRE(same < 5);
 | 
			
		||||
        // Because the previous low bound failed CI couple of times,
 | 
			
		||||
        // we use a very high threshold of 20% before failure is reported.
 | 
			
		||||
        REQUIRE(same < 200);
 | 
			
		||||
    }
 | 
			
		||||
    SECTION("Float") {
 | 
			
		||||
        auto random1 = Catch::Generators::random(0., 1000.);
 | 
			
		||||
@@ -352,7 +353,8 @@ TEST_CASE("Multiple random generators in one test case output different values",
 | 
			
		||||
            same += random1.get() == random2.get();
 | 
			
		||||
            random1.next(); random2.next();
 | 
			
		||||
        }
 | 
			
		||||
        // 0.5% seems like a sane bound for random identical elements within 1000 runs
 | 
			
		||||
        REQUIRE(same < 5);
 | 
			
		||||
        // Because the previous low bound failed CI couple of times,
 | 
			
		||||
        // we use a very high threshold of 20% before failure is reported.
 | 
			
		||||
        REQUIRE(same < 200);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user