Exemplo n.º 1
0
        public void RandomBasicTest()
        {
            RandomBasic r = new RandomBasic(0);

            RandomIntConsistencyTest(r);
            RandomDoubleConsistencyTest(r);
        }
Exemplo n.º 2
0
        public void RollTest()
        {
            IRandomProvider rp = new RandomBasic(0);
            RandomLibrary   rl = new RandomLibrary();

            TestScaffold.TestLines(
                lines: new List <string>()
            {
                "f:import('basic:random','l:rand');0.0",
                "l:rand.f:roll(2, 6)",
                "l:rand.f:roll(10, 10)"
            },
                expected: new List <object>()
            {
                0.0,
                rl.Roll(2, 6, rp),
                rl.Roll(10, 10, rp)
            }
                );
        }
Exemplo n.º 3
0
        public void RandomIntTest()
        {
            IRandomProvider rp = new RandomBasic(0);

            TestScaffold.TestLines(
                lines: new List <string>()
            {
                "f:import('basic:random','l:rand');0.0",
                "l:rand.f:randomint(1, 4)",
                "l:rand.f:randomint(-2, 8)",
                "l:rand.f:randomint(-2, c:i(8))"
            },
                expected: new List <object>()
            {
                0.0,
                rp.RandomInt(1, 4),
                rp.RandomInt(-2, 8),
                rp.RandomInt(-2, 8)
            }
                );
        }
Exemplo n.º 4
0
        public void AnonRandomTest()
        {
            IRandomProvider rp = new RandomBasic(0);

            TestScaffold.TestLines(
                lines: new List <string>()
            {
                "f:import('basic:random','anon');0.0",
                "f:random(1.0, 2.0)",
                "f:random(-12.5, 125.0)",
                "f:random(-12.5, c:i(125))"
            },
                expected: new List <object>()
            {
                0.0,
                rp.RandomDouble(1.0, 2.0),
                rp.RandomDouble(-12.5, 125.0),
                rp.RandomDouble(-12.5, 125.0)
            }
                );
        }