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();
        }
示例#2
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
        }
        public static void testSwitchAlias()
        {
            double d; string s; int n; bool b; char c;
            var    obj       = new VarWrap(2.2);
            var    reference = new VarWrap(obj);

            var obj2 = new VarWrap(2);
            var ref2 = new VarWrap(obj2);

            switch (n)
            {
            case 1:
                d = reference.get().get();
                reference.get().set(3);
                n = reference.get().get();
                n = obj.get();

            case 2:
                d = reference.get().get();
                reference.get().set('3');
                c = reference.get().get();
                c = obj.get();

                n = ref2.get().get();
                ref2.get().set('3');
                c = ref2.get().get();
                c = obj2.get();
            }
            d = reference.get().get();
            d = obj.get();

            n = ref2.get().get();
            n = obj2.get();
        }
示例#4
0
        public static void wrongTestSwitchAlias()
        {
            double d; string s; int n; bool b; char c;
            var    obj       = new VarWrap('2');
            var    reference = new VarWrap(obj);

            var obj2 = new VarWrap(2);
            var ref2 = new VarWrap(obj2);

            switch (n)
            {
            case 1:
                reference.get().set(3);
                c = reference.get().get(); // * Error
                c = obj.get();             // * Error

            case 2:
                reference.get().set(3.3);
                c = reference.get().get(); // * Error
                c = obj.get();             // * Error

                c = ref2.get().get();      // * Error
                ref2.get().set(3.3);
                n = ref2.get().get();      // * Error
                n = obj2.get();            // * Error
            }
            n = reference.get().get();     // * Error
            n = obj.get();                 // * Error

            c = ref2.get().get();          // * Error
            c = obj2.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 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();
        }
        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
        }
        public static void wrongTestIfConstraint()
        {
            var obj = new VarWrap(2.2);

            wrongTestIfConstraint(obj);
            string s = obj.get(); // * Error
            int    n = obj.get(); // * Error
        }
示例#9
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();
        }
示例#10
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
        }
示例#11
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 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 static void testIfConstraint()
        {
            var obj = new VarWrap(2.2);

            testIfConstraint(obj);
            string s = obj.get() + "3";
        }
示例#15
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";
        }
        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();
        }
示例#18
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
        }
示例#19
0
        public static void testInterProcLocalAlias()
        {
            var obj1, obj2;

            obj1 = obj2 = new VarWrap();
            modify(obj1, "value");
            // * Correct!
            string s = obj2.get();
            // * Wrong!
            //int n = obj2.get(); // * Error
        }
        public static void wrongTestIfAlias()
        {
            double d; string s; int n; bool b; char c;
            var    obj       = new VarWrap('2');
            var    reference = new VarWrap(obj);

            if (true)
            {
                c = reference.get().get();
                reference.get().set(3);
                c = reference.get().get(); // * Error
                c = obj.get();             // * Error
            }
            else
            {
                c = reference.get().get();
                reference.get().set(3.3);
                c = reference.get().get(); // * Error
                c = obj.get();             // * Error
            }
            n = reference.get().get();     // * Error
            n = obj.get();                 // * Error
        }
        public static void testIfAlias()
        {
            double d; string s; int n; bool b; char c;
            var    obj       = new VarWrap(2.2);
            var    reference = new VarWrap(obj);

            if (true)
            {
                d = reference.get().get();
                reference.get().set(3);
                n = reference.get().get();
                n = obj.get();
            }
            else
            {
                d = reference.get().get();
                reference.get().set('3');
                c = reference.get().get();
                c = obj.get();
            }
            n = reference.get().get();
            n = obj.get();
        }