mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:47:34 +00:00
LibTest: Add more numeric generators
Rename unsigned_int generator to number_u32. Add generators: - number_u64 - number_f64 - percentage
This commit is contained in:
parent
dd53f64d2f
commit
d52ffcd830
15 changed files with 312 additions and 133 deletions
|
@ -42,7 +42,7 @@ void randomized_compare_bool_output_over(u32 range, auto& old_function, auto& ne
|
|||
for (u32 n = 0; n < 100; ++n) {
|
||||
bool result1 = false;
|
||||
bool result2 = false;
|
||||
GEN(i, Gen::unsigned_int(range - 1));
|
||||
GEN(i, Gen::number_u64(range - 1));
|
||||
EXPECT_EQ(result1 = (old_function(i) > 0), result2 = (new_function(i) > 0));
|
||||
if (result1 != result2)
|
||||
FAIL(String::formatted("New result {} does not match old result {} for input {}.", result1, result2, i));
|
||||
|
@ -55,7 +55,7 @@ void randomized_compare_value_output_over(u32 range, auto& old_function, auto& n
|
|||
for (u32 n = 0; n < 100; ++n) {
|
||||
i64 result1 = false;
|
||||
i64 result2 = false;
|
||||
GEN(i, Gen::unsigned_int(range - 1));
|
||||
GEN(i, Gen::number_u64(range - 1));
|
||||
EXPECT_EQ(result1 = old_function(i), result2 = new_function(i));
|
||||
if (result1 != result2)
|
||||
FAIL(String::formatted("New result {} does not match old result {} for input {}.", result1, result2, i));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue