Exemplo n.º 1
0
        public void RandomBitsShouldHaveLeadingZeroBits(int leadingZeroBits, int numberOfBits)
        {
            var count = 100; // arbitrary

            for (var i = 0; i < count; i++)
            {
                _subject = new EntropyProviderLeadingZeroes(new Random800_90(), leadingZeroBits);
                var result = _subject.GetEntropy(numberOfBits);

                Assert.AreEqual(BigInteger.Zero, result.GetMostSignificantBits(leadingZeroBits).ToPositiveBigInteger());
            }
        }
Exemplo n.º 2
0
 public void ShouldThrowWhenAttemptingToPullLessBitsThanLeadingZeroBits(int leadingZeroBits, int numberOfBits)
 {
     _subject = new EntropyProviderLeadingZeroes(new Random800_90(), leadingZeroBits);
     Assert.Throws <ArgumentOutOfRangeException>(() => _subject.GetEntropy(numberOfBits));
 }