コード例 #1
0
    void testSuffleOnAdd()
    {
        Debug.Log("Doing " + System.Reflection.MethodBase.GetCurrentMethod().Name);
        RoundRobinBag <int> bag = new RoundRobinBag <int>(RoundRobinBagOptions.SUFFLE_ON_ADD);

        bag.add(1);
        bag.add(2);
        bag.add(3);

        Debug.Log("Should have Reset");
        for (int i = 1; i <= 3; i++)
        {
            int next = bag.next();
            Debug.Log("First Pass " + next + " == " + i + " : " + (i == next));
        }

        bag.add(4);

        Debug.Log("Should have Reset");

        for (int i = 1; i <= 4; i++)
        {
            int next = bag.next();
            Debug.Log("Second Pass " + next + " ?? " + i);
        }
    }
コード例 #2
0
 void testSimpleRoundRobin()
 {
     RoundRobinBag<int> bag = new RoundRobinBag<int>();
     bag.add(1);
     bag.add(2);
     bag.add(3);
     bag.add(4);
     int[] anwers = {1,2,3,4,1,2,3,4};
     testBag(bag,anwers);
 }
コード例 #3
0
    void testSimpleRoundRobin()
    {
        RoundRobinBag <int> bag = new RoundRobinBag <int>();

        bag.add(1);
        bag.add(2);
        bag.add(3);
        bag.add(4);
        int[] anwers = { 1, 2, 3, 4, 1, 2, 3, 4 };
        testBag(bag, anwers);
    }
コード例 #4
0
    void testSuffleOnEnd()
    {
        Debug.Log("Doing " + System.Reflection.MethodBase.GetCurrentMethod().Name);
        RoundRobinBag<int> bag = new RoundRobinBag<int>(RoundRobinBagOptions.SUFFLE_ON_END);
        bag.add(1);
        bag.add(2);
        bag.add(3);
        bag.add(4);

        for (int i = 1; i <= 4; i++) {
            int next = bag.next();
            Debug.Log("First Pass " + i + " == " + next + " : " + (i == next));
        }

        Debug.Log("Should have Reset");
        for (int i = 1; i <= 4; i++) {
            int next = bag.next();
            Debug.Log("Second Pass " + i + " ?? " + next);
        }
    }