示例#1
0
        public static void objTestIfWhile()
        {
            int n; char c; double d; string s; bool b;
            var r = new VarWrap('a');

            if (true)
            {
                c = r.get();
                while (true)
                {
                    n = r.get();
                    r.set(20);
                    n = r.get();
                }
                n = r.get();
            }
            else
            {
                c = r.get();
                while (true)
                {
                    d = r.get();
                    r.set(2.2);
                    d = r.get();
                }
                d = r.get();
            }
            d = r.get();
        }
        public static void wrongTestIfElse()
        {
            double d; string s; int n; bool b; char c;
            var    r1 = new VarWrap(2.2);
            var    r2 = new VarWrap(2.2),
                   r4 = new VarWrap(2.2),
                   r5 = new VarWrap(2.2);

            if (true)
            {
                n = r1.get(); // * Error
                r1.set("hi");
                d = r1.get(); // * Error

                n = r2.get(); // * Error
                r2.set("hi");
                d = r2.get(); // * Error
            }
            else
            {
                s = r1.get(); // * Error
                r1.set(0);
                c = r1.get(); // * Error

                s = r4.get(); // * Error
                r4.set(0);
                c = r4.get(); // * Error
            }
            d = r2.get();     // * Error
            s = r2.get();     // * Error
            n = r4.get();     // * Error
        }
示例#3
0
        public static void wrongObjTestIfWhile()
        {
            int n; char c; double d; string s; bool b;
            var r = new VarWrap('a');

            if (true)
            {
                while (true)
                {
                    c = r.get(); // * Error
                    r.set(20);
                }
                c = r.get(); // * Error
            }
            else
            {
                while (true)
                {
                    c = r.get(); // * Error
                    r.set(2.2);
                }
                c = r.get(); // * Error
            }
            c = r.get();     // * Error
        }
示例#4
0
        public static void objTestWhileIf()
        {
            int n; char c; double d; string s; bool b;
            var r;

            r = new VarWrap('a');
            while (true)
            {
                d = r.get();
                if (true)
                {
                    d = r.get();
                    r.set(3);
                    n = r.get();
                }
                else
                {
                    d = r.get();
                    r.set(3.3);
                    d = r.get();
                }
                d = r.get();
                r.set(3.3);
                d = r.get();
            }
            d = r.get();
        }
        public static void testIfElse()
        {
            double d; string s; int n; bool b;
            var    r1 = new VarWrap(2.2);
            var    r2 = new VarWrap(2.2),
                   r4 = new VarWrap(2.2),
                   r5 = new VarWrap(2.2);

            if (true)
            {
                d = r1.get();
                r1.set("hi");
                s = r1.get();

                d = r2.get();
                r2.set("hi");
                s = r2.get();
            }
            else
            {
                d = r1.get();
                r1.set(0);
                n = r1.get();

                d = r4.get();
                r4.set(0);
                n = r4.get();
            }
            s = r1.get() + "3";
            d = r4.get();
            d = r5.get();
        }
示例#6
0
        public static void wrongObjTestWhileIf()
        {
            int n; char c; double d; string s; bool b;
            var r;

            r = new VarWrap('a');
            while (true)
            {
                c = r.get(); // * Error
                if (true)
                {
                    c = r.get(); // * Error
                    r.set(3);
                    c = r.get(); // * Error
                }
                else
                {
                    c = r.get(); // * Error
                    r.set(3.3);
                    c = r.get(); // * Error
                }
                c = r.get();     // * Error
                r.set(3.3);
                c = r.get();     // * Error
            }
            n = r.get();         // * Error
        }
        public void wrongTestThisIfElse()
        {
            double d; string s; int n; bool b; char c;

            attribute1 = new VarWrap('0');
            attribute2 = new VarWrap('0');
            attribute3 = new VarWrap('0');
            attribute4 = new VarWrap('0');

            if (true)
            {
                s = attribute1.get(); // * Error
                attribute1.set("hi");
                c = attribute1.get(); // * Error

                s = attribute2.get(); // * Error
                attribute2.set("hi");
                c = attribute2.get(); // * Error
            }
            else
            {
                s = attribute1.get(); // * Error
                attribute1.set(0);
                c = attribute1.get(); // * Error

                s = attribute3.get(); // * Error
                attribute3.set(0);
                c = attribute3.get(); // * Error
            }
            c = attribute1.get();     // * Error
            s = attribute2.get();     // * Error
            c = attribute3.get();     // * Error
        }
        public void testThisIfElse()
        {
            double d; string s; int n; bool b;

            attribute1 = new VarWrap(2.2);
            attribute2 = new VarWrap(2.2);
            attribute3 = new VarWrap(2.2);
            attribute4 = new VarWrap(2.2);

            if (true)
            {
                d = attribute1.get();
                attribute1.set("hi");
                s = attribute1.get();

                d = attribute2.get();
                attribute2.set("hi");
                s = attribute2.get();
            }
            else
            {
                d = attribute1.get();
                attribute1.set(0);
                n = attribute1.get();

                d = attribute3.get();
                attribute3.set(0);
                n = attribute3.get();
            }
            s = attribute1.get() + "3";
            d = attribute3.get();
            d = attribute4.get();
        }
示例#9
0
        public static void wrongTestSwitchObj()
        {
            int n; char c; double d; string s; bool b;
            var r1, r2, r3;

            r1 = new VarWrap("hi");
            r2 = new VarWrap("hi");
            r3 = new VarWrap("hi");
            switch (n)
            {
            case 0:
                n = r1.get();     // * Error
                r1.set(3);
                s = r1.get();     // * Error
                break;

            case 1:
                c = r1.get();     // * Error
                r1.set('3');
                s = r1.get();     // * Error
                break;

            case 2:
                d = r1.get();     // * Error
                r1.set(33.3);
                s = r1.get();     // * Error

                d = r2.get();     // * Error
                r2.set(33.3);
                s = r2.get();     // * Error
                break;

            default:
                b = r1.get();     // * Error
                r1.set(true);
                s = r1.get();     // * Error

                d = r3.get();     // * Error
                r3.set(33.3);
                s = r3.get();     // * Error
                break;
            }
            d = r1.get(); // * Error
            d = r2.get(); // * Error
            d = r3.get(); // * Error
        }
        public static void testSwitchObj()
        {
            int n; char c; double d; string s; bool b;
            var r1, r2, r3;

            r1 = new VarWrap("hi");
            r2 = new VarWrap("hi");
            r3 = new VarWrap("hi");
            switch (n)
            {
            case 0:
                s = r1.get();
                r1.set(3);
                n = r1.get();
                break;

            case 1:
                s = r1.get();
                r1.set('3');
                c = r1.get();
                break;

            case 2:
                s = r1.get();
                r1.set(33.3);
                d = r1.get();

                s = r2.get();
                r2.set(33.3);
                d = r2.get();
                break;

            default:
                s = r1.get();
                r1.set(true);
                b = r1.get();

                s = r3.get();
                r3.set(33.3);
                d = r3.get();
                break;
            }
            r1.get() + "bye";
            r2.get() + "bye";
        }
示例#11
0
        public static void testInterProcGlobalAlias()
        {
            var boolObj = new VarWrap();
            var test    = new Test();

            test.setField(boolObj);
            boolObj.set(true);
            // * Correct!
            bool b = test.getField().get();
            // * Wrong!
            //string s = test.getField().get(); // * Error
        }
        public static void wrongTestIf()
        {
            double d; string s; int n; bool b; char c;
            var    r1 = new VarWrap(2);
            var    r2 = new VarWrap(2);

            if (true)
            {
                c = r1.get(); // * Error
                r1.set(3.3);
                n = r1.get(); // * Error
            }
            c = r2.get();     // * Error
            n = r1.get();     // * Error
        }
        public static void testIf()
        {
            double d; string s; int n; bool b;
            var    r1 = new VarWrap(2);
            var    r2 = new VarWrap(2);

            if (true)
            {
                n = r1.get();
                r1.set(3.3);
                d = r1.get();
            }
            n = r2.get();
            d = r1.get();
        }
        public void testSwitchThis()
        {
            int n; char c; double d; string s; bool b;

            attribute1 = new VarWrap("hi");
            attribute2 = new VarWrap(3);
            attribute3 = new VarWrap(3);
            switch (n)
            {
            case 0:
                s = attribute1.get();
                attribute1.set(3);
                n = attribute1.get();
                break;

            case 1:
                s = attribute1.get();
                attribute1.set('3');
                c = attribute1.get();
                break;

            case 2:
                s = attribute1.get();
                attribute1.set(33.3);
                d = attribute1.get();

                d = attribute2.get();
                attribute2.set(33.3);
                d = attribute2.get();
                break;

            case 3:
                s = attribute1.get();
                attribute1.set(true);
                b = attribute1.get();

                d = attribute3.get();
                attribute3.set(33.3);
                d = attribute3.get();
                break;
            }
            attribute1.get() + "bye";
            d = attribute2.get();
            d = attribute3.get();
        }
示例#15
0
        public void wrongTestSwitchThis()
        {
            int n; char c; double d; string s; bool b;

            attribute1 = new VarWrap("hi");
            attribute2 = new VarWrap(3);
            attribute3 = new VarWrap(3);
            switch (n)
            {
            case 0:
                attribute1.set(3);
                s = attribute1.get();     // * Error
                break;

            case 1:
                n = attribute1.get();     // * Error
                attribute1.set('3');
                s = attribute1.get();     // * Error
                break;

            case 2:
                c = attribute1.get();     // * Error
                attribute1.set(33.3);
                s = attribute1.get();     // * Error

                attribute2.set(33.3);
                n = attribute2.get();      // * Error
                break;

            case 3:
                d = attribute1.get();     // * Error
                attribute1.set(3);
                s = attribute1.get();     // * Error

                attribute3.set(33.3);
                n = attribute3.get();     // * Error

                break;
            }
            s = attribute1.get(); // * Error
            n = attribute2.get(); // * Error
            n = attribute3.get(); // * Error
        }