@@ -7,20 +7,20 @@ The generators work as follows:
7
7
8
8
- Each generator is a struct that lives somewhere in the ` gen ` module. Usually
9
9
it is generic over a float type.
10
- - These generators must implement ` Iterator ` , which should return a context
11
- type that can be used to construct a test string (but usually not the string
10
+ - These generators must implement ` Iterator ` , which should return a context type
11
+ that can be used to construct a test string (but usually not the string
12
12
itself).
13
13
- They must also implement the ` Generator ` trait, which provides a method to
14
14
write test context to a string as a test case, as well as some extra metadata.
15
-
16
- The split between context generation and string construction is so that
17
- we can reuse string allocations.
15
+
16
+ The split between context generation and string construction is so that we can
17
+ reuse string allocations.
18
18
- Each generator gets registered once for each float type. All of these
19
19
generators then get iterated, and each test case checked against the float
20
20
type's parse implementation.
21
21
22
- Some tests produce decimal strings, others generate bit patterns that need
23
- to convert to the float type before printing to a string. For these, float to
22
+ Some tests produce decimal strings, others generate bit patterns that need to
23
+ convert to the float type before printing to a string. For these, float to
24
24
decimal (` flt2dec ` ) conversions get tested, if unintentionally.
25
25
26
26
For each test case, the following is done:
@@ -30,13 +30,16 @@ For each test case, the following is done:
30
30
- The test string is parsed separately to a ` BigRational ` , which acts as a
31
31
representation with infinite precision.
32
32
- The rational value then gets checked that it is within the float's
33
- representable values (absolute value greater than the smallest number to
34
- round to zero, but less less than the first value to round to infinity). If
35
- these limits are exceeded, check that the parsed float reflects that.
36
- - For real nonzero numbers, the parsed float is converted into a
37
- rational using ` significand * 2^exponent ` . It is then checked against the
38
- actual rational value, and verified to be within half a bit's precision
39
- of the parsed value.
33
+ representable values (absolute value greater than the smallest number to round
34
+ to zero, but less less than the first value to round to infinity). If these
35
+ limits are exceeded, check that the parsed float reflects that.
36
+ - For real nonzero numbers, the parsed float is converted into a rational using
37
+ ` significand * 2^exponent ` . It is then checked against the actual rational
38
+ value, and verified to be within half a bit's precision of the parsed value.
40
39
41
40
This is all highly parallelized with ` rayon ` ; test generators can run in
42
41
parallel, and their tests get chunked and run in parallel.
42
+
43
+ There is a simple command line that allows filtering which tests are run,
44
+ setting the number of iterations for fuzzing tests, limiting failures, setting
45
+ timeouts, etc. See ` main.rs ` or run with ` --help ` for options.
0 commit comments