Пример #1
0
 public static void NoArgsStatic()
 {
     if (s_testInt == 400000)
     {
         return;
     }
     s_testInt++;
     TailTests.NoArgsStatic();
 }
Пример #2
0
 public static int StructFacSumDeepStatic(int x, Point p)
 {
     if (x == 0)
     {
         return(p.x + p.y);
     }
     p.x++;
     p.y++;
     return(TailTests.StructFacSumDeepStatic(x - 1, p));
 }
Пример #3
0
 public static int StructFacSumDeepStackStatic(int x, int y, double a, double b, Point p, int z)
 {
     if (x == 0)
     {
         return(p.x + p.y);
     }
     p.x++;
     p.y++;
     return(TailTests.StructFacSumDeepStackStatic(x - 1, y, a, b, p, 1));
 }
Пример #4
0
    public static int Main()
    {

        TailTests t = new TailTests();
        int foo = 0;
        Point p = new Point();
        double d = 0.0;

        try
        {
            foo = t.ManyArgs(100,0,1,2,3,4,5,6,7,8,9,0);
            t.Test(foo == 100, "ManyArgs");

            foo = 0;
            foo = TailTests.ManyArgsStatic(100,0,1,2,3,4,5,6,7,8,9,0);
            t.Test(foo == 100, "ManyArgsStatic");

            foo = 0;
            foo = t.Sum(0,10000000);
            t.Test(foo == 10000000, "SumBlowStack");

            foo = 0;
            foo = TailTests.SumStatic(0,10000000);
            t.Test(foo == 10000000, "SumStaticBlowStack");

            p.x = 1;
            p.y = 2;
            foo = t.StructFacSum(4,p); 
            t.Test(foo == 40 && p.x == 1 && p.y == 2,"StructShallowReg");

            d = t.DoubleFacRec(5,1);
            t.Test(d == 120.0,"DoubleFacRec");

            foo = t.fUneven(1,2,3);
            t.Test(foo == 16, "Uneven");

            p.x = 1;
            p.y = 2;
            foo = t.StructFacSumDeep(100000,p); 
            t.Test(foo == 200003 && p.x == 1 && p.y == 2,"StructRegDeep");

            p.x = 1;
            p.y = 2;
            foo = 0;
            foo = TailTests.StructFacSumDeepStatic(100000,p); 
            t.Test(foo == 200003 && p.x == 1 && p.y == 2,"StructRegDeepStatic");

            p.x = 1;
            p.y = 2;
            foo = 0;
            foo = t.StructFacSumDeepStack(100000,0,0.0,0.9,p,1); 
            t.Test(foo == 200003 && p.x == 1 && p.y == 2,"StructStackDeep");

            p.x = 1;
            p.y = 2;
            foo = 0;
            foo = TailTests.StructFacSumDeepStackStatic(100000,0,0.0,0.9,p,1); 
            t.Test(foo == 200003 && p.x == 1 && p.y == 2,"StructStackDeepStatic");

            p.x = p.y = 0;
            p = t.StructReturnVal(100000,0);
            t.Test(p.x == 100000 && p.y == 200000,"StructReturnDeep");

            p.x = p.y = 0;
            p = TailTests.StructReturnValStatic(100000,0);
            t.Test(p.x == 100000 && p.y == 200000,"StructReturnDeepStatic");

            s_testInt = 0;
            t.NoArgs();
            t.Test(s_testInt == 400000, "NoArgs");

            s_testInt = 0;
            TailTests.NoArgsStatic();
            t.Test(s_testInt == 400000, "NoArgsStatic");

            p.x = 1;
            p.y = 2;
            s_testInt = 100000;
            t.SameStacksString("foo",p);
            t.Test(s_testInt == 0, "SameStacks");
        } 
        catch (Exception e)
        {
            Console.WriteLine("Caught Unexpected Exception");
            Console.WriteLine(e.ToString());
            return 1;
        }

        return t.m_failed;
    }
Пример #5
0
    public static int Main()
    {
        TailTests t   = new TailTests();
        int       foo = 0;
        Point     p   = new Point();
        double    d   = 0.0;

        try
        {
            foo = t.ManyArgs(100, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
            t.Test(foo == 100, "ManyArgs");

            foo = 0;
            foo = TailTests.ManyArgsStatic(100, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
            t.Test(foo == 100, "ManyArgsStatic");

            foo = 0;
            foo = t.Sum(0, 10000000);
            t.Test(foo == 10000000, "SumBlowStack");

            foo = 0;
            foo = TailTests.SumStatic(0, 10000000);
            t.Test(foo == 10000000, "SumStaticBlowStack");

            p.x = 1;
            p.y = 2;
            foo = t.StructFacSum(4, p);
            t.Test(foo == 40 && p.x == 1 && p.y == 2, "StructShallowReg");

            d = t.DoubleFacRec(5, 1);
            t.Test(d == 120.0, "DoubleFacRec");

            foo = t.fUneven(1, 2, 3);
            t.Test(foo == 16, "Uneven");

            p.x = 1;
            p.y = 2;
            foo = t.StructFacSumDeep(100000, p);
            t.Test(foo == 200003 && p.x == 1 && p.y == 2, "StructRegDeep");

            p.x = 1;
            p.y = 2;
            foo = 0;
            foo = TailTests.StructFacSumDeepStatic(100000, p);
            t.Test(foo == 200003 && p.x == 1 && p.y == 2, "StructRegDeepStatic");

            p.x = 1;
            p.y = 2;
            foo = 0;
            foo = t.StructFacSumDeepStack(100000, 0, 0.0, 0.9, p, 1);
            t.Test(foo == 200003 && p.x == 1 && p.y == 2, "StructStackDeep");

            p.x = 1;
            p.y = 2;
            foo = 0;
            foo = TailTests.StructFacSumDeepStackStatic(100000, 0, 0.0, 0.9, p, 1);
            t.Test(foo == 200003 && p.x == 1 && p.y == 2, "StructStackDeepStatic");

            p.x = p.y = 0;
            p   = t.StructReturnVal(100000, 0);
            t.Test(p.x == 100000 && p.y == 200000, "StructReturnDeep");

            p.x = p.y = 0;
            p   = TailTests.StructReturnValStatic(100000, 0);
            t.Test(p.x == 100000 && p.y == 200000, "StructReturnDeepStatic");

            s_testInt = 0;
            t.NoArgs();
            t.Test(s_testInt == 400000, "NoArgs");

            s_testInt = 0;
            TailTests.NoArgsStatic();
            t.Test(s_testInt == 400000, "NoArgsStatic");

            p.x       = 1;
            p.y       = 2;
            s_testInt = 100000;
            t.SameStacksString("foo", p);
            t.Test(s_testInt == 0, "SameStacks");
        }
        catch (Exception e)
        {
            Console.WriteLine("Caught Unexpected Exception");
            Console.WriteLine(e.ToString());
            return(1);
        }

        return(t.m_failed);
    }