Example #1
0
        public void Test()
        {
            StructType s2 = new StructType(5);
            s2.Increment();
            AssertEqual(new StackFrame(), 6, s2.Value);

            StructType.StaticValue = 5;
            StructType.StaticIncrement();
            AssertEqual(new StackFrame(), 6, StructType.StaticValue);

            d = new D(DMethod);
            d+=new D(DMethod);
            d-=new D(DMethod);
            d = ReturnDMethod(d);
            s2 = d(d(new StructType[]{s2}))[0];
            AssertEqual(new StackFrame(), 6, StructType.StaticValue);

            uint i = this;
            AssertEqual(new StackFrame(), 1u, i);

            i = this + 2u;
            AssertEqual(new StackFrame(), 3u, i);

            try{ throw new MyException();}
            catch{}

            int[] results = DoubleValues(new int[]{1, 2, 3});
            AssertEqual(new StackFrame(), 4, results[1]);

            results = Sums(new int[,]{{1,2}, {3,4}});
            AssertEqual(new StackFrame(), 7, results[1]);

            int[,] otherResults = DoubleValues(new int[,]{{1,2}, {3,4}});
            AssertEqual(new StackFrame(), 4, otherResults[0, 1]);

            AssertEqual(new StackFrame(), Values.One, Echo (Values.One));

            int first = 3, second = 4;
            Swap(ref first, ref second);
            AssertEqual(new StackFrame(), 3, second);

            BaseType bt = new ChildType();
            AssertEqual(new StackFrame(), 4, bt.Compute(1));

            AssertEqual(new StackFrame(), 4, LockingMethod());

            try{
                LockingThrowingMethod();
                AssertTrue(new StackFrame(), false);
            }
            catch{}
        }