Esempio n. 1
0
        public void Should_generate_long_for_int()
        {
            var rng = new WyRng(42);

            for (int i = 0; i < 9; ++i)
            {
                rng.Next();
            }

            // We should have generated 9 longs in the loop, so we know what to expect for the next long we generate
            var result = rng.NextLong();

            $"{result:x}".ShouldBe(Expected[9]);
        }
Esempio n. 2
0
        public void Should_match_original_values()
        {
            var rng = new WyRng(42);

            var r1 = rng.NextLong();
            var r2 = rng.Next();
            var r3 = rng.NextLong();

            var buffer = new byte[12];

            rng.NextBytes(buffer);
            var r4 = BitConverter.ToString(buffer).Replace("-", "").ToLower();

            var r5 = rng.NextLong();

            r1.ShouldBe(12558987674375533620);
            r2.ShouldBe(805624350);
            r3.ShouldBe(17418380496519466978);
            r4.ShouldBe("a23954acf293409ddcb3958c");
            r5.ShouldBe(6581057395178234814ul);
        }