public void ToUInt32Array_BigInteger_ComputesCorrectly()
        {
            var testValue = new BigInteger(new byte[] {
                0x5A, 0x53, 0x08, 0x8E,
                0x00, 0x00, 0x00, 0x00,
                0x46, 0xaa, 0xef, 0x01,
                0x5f, 0xdb, 0xca, 0x0d
            });

            var expected = new[] { 2382910298U, 0U, 32483910U, 231398239U };

            Assert.Equal(expected, testValue.ToUInt32Array(128));
        }
        public void ToUInt32Array_BigInteger_InvalidBitSize_Throws()
        {
            var invalidBitSizes = new[] { -1, 16, 31, 48, 65 };
            var testValue = new BigInteger(0);

            foreach (var invalidBitSize in invalidBitSizes)
            {
                Assert.Equal("bitSize",
                    Assert.Throws<ArgumentOutOfRangeException>(
                        () => testValue.ToUInt32Array(invalidBitSize))
                    .ParamName);
            }
        }
        public void ToUInt32Array_BigInteger_ValidBitSize_DoesNotThrow()
        {
            var invalidBitSizes = new[] { -1, 16, 31, 48, 65 };
            var testValue = new BigInteger(0);

            foreach (var uint32Count in Enumerable.Range(0, 32).Select(i => i * 32))
            {
                UInt32[] resultArray = null;

                resultArray = testValue.ToUInt32Array(uint32Count * 32);

                Assert.Equal(uint32Count, resultArray.Length);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="FNVPrimeOffset"/> class.
 /// </summary>
 /// <param name="bitSize">Number of bits the prime and offset use each.</param>
 /// <param name="prime">Prime integer to be represented.</param>
 /// <param name="offset">Offset integer to be represented.</param>
 public FNVPrimeOffset(int bitSize, BigInteger prime, BigInteger offset)
 {
     Prime = prime.ToUInt32Array(bitSize);
     Offset = offset.ToUInt32Array(bitSize);
 }