Exemple #1
0
        public void FillViaNextCleanly()
        {
            var rng    = new StepRng(0);
            var buffer = new UInt64[8];

            Filler.FillBytesViaNext(rng, MemoryMarshal.Cast <UInt64, Byte>(buffer));
            for (UInt32 i = 0; i < buffer.Length; i++)
            {
                Assert.Equal(i, buffer[i]);
            }
        }
Exemple #2
0
        public void FillViaNext4BytesLeft()
        {
            var rng    = new StepRng(0);
            var buffer = new UInt32[17];

            Filler.FillBytesViaNext(rng, MemoryMarshal.Cast <UInt32, Byte>(buffer));
            for (UInt32 i = 0; i < buffer.Length / 2; i += 2)
            {
                Assert.Equal(i / 2, buffer[i]);
                Assert.Equal(0u, buffer[i + 1]);
            }
            Assert.Equal(8u, buffer[16]);
        }
Exemple #3
0
        public void FillViaNext2BytesLeft()
        {
            var rng    = new StepRng(0);
            var buffer = new UInt16[33];

            Filler.FillBytesViaNext(rng, MemoryMarshal.Cast <UInt16, Byte>(buffer));
            for (UInt32 i = 0; i < buffer.Length / 4; i += 4)
            {
                Assert.Equal(i / 4, buffer[i]);
                Assert.Equal(0u, buffer[i + 1]);
                Assert.Equal(0u, buffer[i + 2]);
                Assert.Equal(0u, buffer[i + 3]);
            }
            Assert.Equal(8u, buffer[32]);
        }