예제 #1
0
    public static void RemoveAtMain()
    {
        Test test = new Test();

        Driver <RefX1 <int>, ValX1 <string>, int, string> IntDriver = new Driver <RefX1 <int>, ValX1 <string>, int, string>(test);

        RefX1 <int>[] intArr1 = new RefX1 <int> [100];
        for (int i = 0; i < 100; i++)
        {
            intArr1[i] = new RefX1 <int>(i + 100);
        }

        int[] intArr2 = new int[15];
        for (int i = 0; i < 10; i++)
        {
            intArr2[i] = i + 200;
        }
        for (int i = 10; i < 15; i++)
        {
            intArr2[i] = i + 195;
        }

        Driver <ValX1 <string>, RefX1 <int>, string, int> StringDriver = new Driver <ValX1 <string>, RefX1 <int>, string, int>(test);

        ValX1 <string>[] stringArr1 = new ValX1 <string> [100];
        for (int i = 0; i < 100; i++)
        {
            stringArr1[i] = new ValX1 <string>("SomeTestString" + ((i + 100).ToString()));
        }

        ValX1 <string>[] stringArr2 = new ValX1 <string> [15];
        for (int i = 0; i < 10; i++)
        {
            stringArr2[i] = new ValX1 <string>("SomeTestString" + (i + 200).ToString());
        }

        //Ref<val>,Val<Ref>
        IntDriver.BasicRemoveAt(intArr1, stringArr1);
        IntDriver.RemoveAtNegative(intArr1, stringArr1, stringArr2);
        IntDriver.RemoveAtNegative(new RefX1 <int> [0], new ValX1 <string> [0], stringArr2);
        IntDriver.AddRemoveKeyRemoveAt(intArr1, stringArr1, 0);
        IntDriver.AddRemoveKeyRemoveAt(intArr1, stringArr1, 50);
        IntDriver.AddRemoveKeyRemoveAt(intArr1, stringArr1, 99);

        //Val<Ref>,Ref<Val>
        StringDriver.BasicRemoveAt(stringArr1, intArr1);
        StringDriver.AddRemoveKeyRemoveAt(stringArr1, intArr1, 0);
        StringDriver.AddRemoveKeyRemoveAt(stringArr1, intArr1, 50);
        StringDriver.AddRemoveKeyRemoveAt(stringArr1, intArr1, 99);

        intArr1 = new RefX1 <int> [105];
        for (int i = 0; i < 105; i++)
        {
            intArr1[i] = new RefX1 <int>(i);
        }

        RefX1 <int>[] intArr3 = new RefX1 <int> [15];
        for (int i = 0; i < 10; i++)
        {
            intArr3[i] = new RefX1 <int>(i + 100);
        }
        for (int i = 10; i < 15; i++)
        {
            intArr3[i] = new RefX1 <int>(101);
        }

        stringArr1 = new ValX1 <string> [105];
        for (int i = 0; i < 100; i++)
        {
            stringArr1[i] = new ValX1 <string>("SomeTestString" + i.ToString());
        }
        for (int i = 100; i < 105; i++)
        {
            stringArr1[i] = new ValX1 <string>("SomeTestString11");
        }

        stringArr2 = new ValX1 <string> [15];
        for (int i = 0; i < 15; i++)
        {
            stringArr2[i] = new ValX1 <string>("SomeTestString" + (i + 100).ToString());
        }

        IntDriver.BasicRemoveAt(intArr1, stringArr1);
        StringDriver.BasicRemoveAt(stringArr2, intArr3);

        stringArr1 = new ValX1 <string> [100];
        for (int i = 0; i < 100; i++)
        {
            stringArr1[i] = new ValX1 <string>("SomeTestString" + ((i + 100).ToString()));
        }

        StringDriver.RemoveAtNegative(stringArr1, intArr1, intArr3);

        Assert.True(test.result);
    }