d2224bc6ff1f — Michael Johnson 2 months ago
Add some extra test cases and specificity to satisfy Stryker
M src/RandN/Extensions/Select.cs +1 -1
@@ 57,4 57,4 @@ public static partial class Distribution
             }
         }
     }
-}
  No newline at end of file
+}

          
M src/Tests/Compat/RandomNumberGeneratorShimTests.cs +11 -5
@@ 48,13 48,19 @@ public sealed class RandomNumberGenerato
 #endif
 
         var maxRng = new StepRng(UInt64.MaxValue) { Increment = 0 };
+        var halfRng = new StepRng(0x8080808080808080) { Increment = 0 };
         var maxShim = RandomNumberGeneratorShim.Create(maxRng);
+        var halfShim = RandomNumberGeneratorShim.Create(halfRng);
 
         buffer = new Byte[1024];
+        halfShim.GetBytes(buffer, 0, 200);
         maxShim.GetBytes(buffer, 200, 500);
-        Assert.All(buffer.Take(200), b => Assert.Equal(0, b));
+        halfShim.GetBytes(buffer, 700, 0);
+        halfShim.GetBytes(buffer, 1023, 1);
+        Assert.All(buffer.Take(200), b => Assert.Equal(0x80, b));
         Assert.All(buffer.Skip(200).Take(500), b => Assert.Equal(Byte.MaxValue, b));
-        Assert.All(buffer.Skip(700), b => Assert.Equal(0, b));
+        Assert.All(buffer.Skip(700).Take(323), b => Assert.Equal(0, b));
+        Assert.All(buffer.Skip(1023), b => Assert.Equal(0x80, b));
     }
 
     [Fact]

          
@@ 64,8 70,8 @@ public sealed class RandomNumberGenerato
         var shim = RandomNumberGeneratorShim.Create(rng);
         var bytes = new Byte[32];
         Assert.Throws<ArgumentNullException>(() => shim.GetBytes(null!, 0, 10));
-        Assert.Throws<ArgumentOutOfRangeException>(() => shim.GetBytes(bytes, -10, 10));
-        Assert.Throws<ArgumentOutOfRangeException>(() => shim.GetBytes(bytes, 10, -10));
+        Assert.Throws<ArgumentOutOfRangeException>("offset", () => shim.GetBytes(bytes, -10, 10));
+        Assert.Throws<ArgumentOutOfRangeException>("count", () => shim.GetBytes(bytes, 10, -10));
         Assert.Throws<ArgumentException>(() => shim.GetBytes(bytes, 32, 1));
     }
 

          
@@ 100,4 106,4 @@ public sealed class RandomNumberGenerato
 
         public UInt64 NextUInt64() => 0;
     }
-}
  No newline at end of file
+}

          
M src/Tests/Distributions/UniformTimeSpanTests.cs +3 -3
@@ 13,7 13,7 @@ public sealed class UniformTimeSpanTests
     {
         var low = TimeSpan.FromTicks(lowInt);
         var high = TimeSpan.FromTicks(highInt);
-        Assert.Throws<ArgumentOutOfRangeException>(() => Uniform.NewInclusive(high, low));
+        Assert.Throws<ArgumentOutOfRangeException>("high", () => Uniform.NewInclusive(high, low));
     }
 
     [Theory]

          
@@ 28,7 28,7 @@ public sealed class UniformTimeSpanTests
     {
         var low = TimeSpan.FromTicks(lowInt);
         var high = TimeSpan.FromTicks(highInt);
-        Assert.Throws<ArgumentOutOfRangeException>(() => Uniform.New(high, low));
+        Assert.Throws<ArgumentOutOfRangeException>("high", () => Uniform.New(high, low));
     }
 
     [Theory]

          
@@ 127,4 127,4 @@ public sealed class UniformTimeSpanTests
         Assert.True(dist.TrySample(rng, out TimeSpan result)); // RNG wraps around to 0
         Assert.Equal(TimeSpan.Zero, result);
     }
-}
  No newline at end of file
+}