Add code coverage to CI.

Also add more cases to unit tests.  Coverage is 98%,
the remaining 2% is either things that are Quite Unlikely
and so difficult to test, or a weird `wrapping_mul()` that
shows up as never executed even though it is.
2 files changed, 27 insertions(+), 1 deletions(-)

M .build.yml
M src/lib.rs
M .build.yml +9 -1
@@ 1,6 1,8 @@ 
-image: debian/buster
+image: debian/bullseye
 packages:
  - cargo
+secrets:
+ - 384fc780-f42a-4945-854e-cbd952d6802b
 sources:
  - hg+https://hg.sr.ht/~icefox/oorandom
 tasks:

          
@@ 10,3 12,9 @@ tasks:
  - test: |
     cd oorandom
     cargo test
+ - coverage: |
+    cargo install cargo-tarpaulin
+    cd oorandom
+    PATH=$PATH:$HOME/.cargo/bin cargo tarpaulin -o Html
+    scp -o StrictHostKeyChecking=no tarpaulin-report.html icefox@roc.alopex.li:htdocs/temp/tarpaulin-oorandom.html
+

          
M src/lib.rs +18 -0
@@ 275,6 275,7 @@ mod tests {
             let mut r2 = PCG32::seed(seed, Rand32::DEFAULT_INC);
             for _ in 0..1000 {
                 assert_eq!(r1.rand_u32(), r2.next_u32());
+                assert_eq!(r1.rand_i32(), r2.next_u32() as i32);
             }
         }
 

          
@@ 285,6 286,7 @@ mod tests {
             let mut r2 = PCG32::seed(seed, inc);
             for _ in 0..1000 {
                 assert_eq!(r1.rand_u32(), r2.next_u32());
+                assert_eq!(r1.rand_i32(), r2.next_u32() as i32);
             }
         }
     }

          
@@ 299,6 301,7 @@ mod tests {
             let mut r2 = PCG64::seed(seed, Rand64::DEFAULT_INC);
             for _ in 0..1000 {
                 assert_eq!(r1.rand_u64(), r2.next_u64());
+                assert_eq!(r1.rand_i64(), r2.next_u64() as i64);
             }
         }
 

          
@@ 309,6 312,7 @@ mod tests {
             let mut r2 = PCG64::seed(seed, inc);
             for _ in 0..1000 {
                 assert_eq!(r1.rand_u64(), r2.next_u64());
+                assert_eq!(r1.rand_i64(), r2.next_u64() as i64);
             }
         }
     }

          
@@ 336,6 340,13 @@ mod tests {
                 assert!(f1 < 1.0);
             }
 
+            // At least make sure our float's from rand_float() are in the valid range.
+            for _ in 0..1000 {
+                let f1 = r1.rand_float();
+                assert!(f1 >= 0.0);
+                assert!(f1 < 1.0);
+            }
+
             /*
             TODO: Randomize changed its int-to-float conversion functions and now they don't
             match ours.

          
@@ 375,6 386,13 @@ mod tests {
                 assert!(f1 < 1.0);
             }
 
+            // At least make sure our float's from rand_float() are in the valid range.
+            for _ in 0..1000 {
+                let f1 = r1.rand_float();
+                assert!(f1 >= 0.0);
+                assert!(f1 < 1.0);
+            }
+
             /*
             TODO: Randomize changed its int-to-float conversion functions and now they don't
             match ours.