TailTests.ManyArgs C# (CSharp) Метод

ManyArgs() публичный Метод

public ManyArgs ( int x, int c0, int c1, int c2, int c3, int c4, int c5, int c6, int c7, int c8, int c9, int sum ) : int
x int
c0 int
c1 int
c2 int
c3 int
c4 int
c5 int
c6 int
c7 int
c8 int
c9 int
sum int
Результат int
    public int ManyArgs(int x, 
                        int c0,
                        int c1,
                        int c2,
                        int c3,
                        int c4,
                        int c5,
                        int c6,
                        int c7,
                        int c8, 
                        int c9,
                        int sum)
    {
        if(x == 0)
        {
            return sum;
        }
        return ManyArgs(x-1,c1,c2,c3,c4,c5,c6,c7,c8,c9,c0,sum+1);
    }

Usage Example

Пример #1
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;
    }
All Usage Examples Of TailTests::ManyArgs