Esempio n. 1
0
        public void FinalIsTest4()
        {
            IPM pm = new PM("left.solution().right");

            Assert.AreEqual(pm.Is(0, LevelType.Property, "left"), true);
            Assert.AreEqual(pm.Is(1, LevelType.Method, "solution"), true);
            Assert.AreEqual(pm.FinalIs(2, LevelType.Property, "right"), true);
        }
Esempio n. 2
0
        public void FinalEmptyIsTest3()
        {
            IPM pm = new PM("left.solution.right");

            Assert.AreEqual(pm.Is(0, LevelType.Property, "right"), false);
            Assert.AreEqual(pm.FinalEmptyIs(1, LevelType.Property, "right"), false);
            Assert.AreEqual(pm.Is(2, LevelType.Property, "right"), true);
        }
Esempio n. 3
0
        public void FinalIsTest5()
        {
            IPM pm = new PM("left.solution(\" (a, b) \").right");

            Assert.True(pm.Is(0, LevelType.Property, "left"));
            Assert.True(pm.Is(1, LevelType.Method, "solution"));
            Assert.True(pm.FinalIs(2, LevelType.Property, "right"));
        }
Esempio n. 4
0
        public void FinalIsTest3()
        {
            IPM pm = new PM("left.solution.right");

            Assert.False(pm.Is(0, LevelType.Property, "right"));
            Assert.False(pm.FinalIs(1, LevelType.Property, "right"));
            Assert.True(pm.Is(2, LevelType.Property, "right"));
        }
Esempio n. 5
0
        public void IsTest1()
        {
            IPM pm = new PM("solution=left.right");

            Assert.AreEqual(pm.Is(100, LevelType.Property, "solution"), false);
            Assert.AreEqual(pm.Is(-1, LevelType.Property, "solution"), false);
            Assert.AreEqual(pm.Is(0, LevelType.Property, "solution"), true);
            Assert.AreEqual(pm.Is(1, LevelType.RightOperandStd, "left.right"), true);
        }
Esempio n. 6
0
        public void IsTest1()
        {
            IPM pm = new PM("solution=left.right");

            Assert.False(pm.Is(100, LevelType.Property, "solution"));
            Assert.False(pm.Is(-1, LevelType.Property, "solution"));
            Assert.True(pm.Is(0, LevelType.Property, "solution"));
            Assert.True(pm.Is(1, LevelType.RightOperandStd, "left.right"));
        }
Esempio n. 7
0
        public void IsTest3()
        {
            IPM pm = new PM("solution.m1(')', '(', \"(\").m2(123, \" -> )\").right");

            Assert.AreEqual(pm.Is(0, LevelType.Property, "solution"), true);
            Assert.AreEqual(pm.Is(1, LevelType.Method, "m1"), true);
            Assert.AreEqual(pm.Is(2, LevelType.Method, "m2"), true);
            Assert.AreEqual(pm.Is(3, LevelType.Property, "right"), true);
            Assert.AreEqual(pm.Is(4, LevelType.RightOperandEmpty), true);
        }
Esempio n. 8
0
        public void IsTest2()
        {
            IPM pm = new PM("solution.m1().m2().right");

            Assert.True(pm.Is(0, LevelType.Property, "solution"));
            Assert.True(pm.Is(1, LevelType.Method, "m1"));
            Assert.True(pm.Is(2, LevelType.Method, "m2"));
            Assert.True(pm.Is(3, LevelType.Property, "right"));
            Assert.True(pm.Is(4, LevelType.RightOperandEmpty));
        }
Esempio n. 9
0
        public void FinalEmptyIsTest4()
        {
            IPM pm = new PM("left.solution(\"test m()\")");

            Assert.AreEqual(pm.Is(0, LevelType.Property, "left"), true);
            Assert.AreEqual(pm.FinalEmptyIs(1, LevelType.Method, "solution"), true);
        }
Esempio n. 10
0
        public void DetectArgumentTest2()
        {
            IPM pm = new PM(" solution (1.5, -1.5, 1.5f, -1.5f, 1.5d, -1.5d) ");

            Assert.True(pm.Is(LevelType.Method, "solution"));
            Assert.Equal(6, pm.Levels[0].Args.Length);

            var args = pm.Levels[0].Args;

            Assert.Equal(ArgumentType.Double, args[0].type);
            Assert.Equal(1.5d, args[0].data);

            Assert.Equal(ArgumentType.Double, args[1].type);
            Assert.Equal(args[1].data, -1.5d);

            Assert.Equal(ArgumentType.Float, args[2].type);
            Assert.Equal(1.5f, args[2].data);

            Assert.Equal(ArgumentType.Float, args[3].type);
            Assert.Equal(-1.5f, args[3].data);

            Assert.Equal(ArgumentType.Double, args[4].type);
            Assert.Equal(1.5d, args[4].data);

            Assert.Equal(ArgumentType.Double, args[5].type);
            Assert.Equal(-1.5d, args[5].data);
        }
Esempio n. 11
0
        public void pinToTest1()
        {
            IPM pm = new PM("left.solution.right");

            Assert.AreEqual(4, pm.Levels.Count);

            pm.pinTo(1);
            Assert.AreEqual(3, pm.Levels.Count);

            Assert.AreEqual(pm.Is(0, LevelType.Property, "solution"), true);
            Assert.AreEqual(pm.Is(1, LevelType.Property, "right"), true);
            Assert.AreEqual(pm.Is(2, LevelType.RightOperandEmpty, null), true);

            pm.pinTo(2);
            Assert.AreEqual(pm.Is(0, LevelType.RightOperandEmpty, null), true);
        }
Esempio n. 12
0
        public void FinalEmptyIsTest5()
        {
            IPM pm = new PM("left.solution(\"m(1)\", \"m()\", ')', \")\", \"(\")");

            Assert.True(pm.Is(0, LevelType.Property, "left"));
            Assert.True(pm.FinalEmptyIs(1, LevelType.Method, "solution"));
        }
Esempio n. 13
0
        public void detectArgumentTest2()
        {
            IPM pm = new PM(" solution (1.5, -1.5, 1.5f, -1.5f, 1.5d, -1.5d) ");

            Assert.AreEqual(pm.Is(LevelType.Method, "solution"), true);
            Assert.AreEqual(pm.Levels[0].Args.Length, 6);

            Argument[] args = pm.Levels[0].Args;
            Assert.AreEqual(args[0].type, ArgumentType.Double);
            Assert.AreEqual(args[0].data, 1.5d);

            Assert.AreEqual(args[1].type, ArgumentType.Double);
            Assert.AreEqual(args[1].data, -1.5d);

            Assert.AreEqual(args[2].type, ArgumentType.Float);
            Assert.AreEqual(args[2].data, 1.5f);

            Assert.AreEqual(args[3].type, ArgumentType.Float);
            Assert.AreEqual(args[3].data, -1.5f);

            Assert.AreEqual(args[4].type, ArgumentType.Double);
            Assert.AreEqual(args[4].data, 1.5d);

            Assert.AreEqual(args[5].type, ArgumentType.Double);
            Assert.AreEqual(args[5].data, -1.5d);
        }
Esempio n. 14
0
        public void DetectArgumentTest3()
        {
            IPM pm = new PM(" m77(\"guid\", 12, {\"p1\", {4, \"test\", 8, 'y'}, true}, {false, 'p2'}) ");

            Assert.True(pm.Is(LevelType.Method, "m77"));

            var args = pm.Levels[0].Args;

            Assert.Equal(4, args.Length);

            Assert.Equal(ArgumentType.StringDouble, args[0].type);
            Assert.Equal("guid", args[0].data);

            Assert.Equal(ArgumentType.Integer, args[1].type);
            Assert.Equal(12, args[1].data);

            Assert.Equal(ArgumentType.Object, args[2].type);
            {
                RArgs args2 = (RArgs)args[2].data;
                Assert.Equal(3, args2.Length);

                Assert.Equal(ArgumentType.StringDouble, args2[0].type);
                Assert.Equal("p1", args2[0].data);

                Assert.Equal(ArgumentType.Object, args2[1].type);
                {
                    RArgs args21 = (RArgs)args2[1].data;
                    Assert.Equal(4, args21.Length);

                    Assert.Equal(ArgumentType.Integer, args21[0].type);
                    Assert.Equal(4, args21[0].data);

                    Assert.Equal(ArgumentType.StringDouble, args21[1].type);
                    Assert.Equal("test", args21[1].data);

                    Assert.Equal(ArgumentType.Integer, args21[2].type);
                    Assert.Equal(8, args21[2].data);

                    Assert.Equal(ArgumentType.Char, args21[3].type);
                    Assert.Equal('y', args21[3].data);
                }

                Assert.Equal(ArgumentType.Boolean, args2[2].type);
                Assert.Equal(true, args2[2].data);
            }

            Assert.Equal(ArgumentType.Object, args[3].type);
            {
                RArgs args3 = (RArgs)args[3].data;
                Assert.Equal(2, args3.Length);

                Assert.Equal(ArgumentType.Boolean, args3[0].type);
                Assert.Equal(false, args3[0].data);

                Assert.Equal(ArgumentType.StringSingle, args3[1].type);
                Assert.Equal("p2", args3[1].data);
            }
        }
Esempio n. 15
0
        public void detectArgumentTest3()
        {
            IPM pm = new PM(" m77(\"guid\", 12, {\"p1\", {4, \"test\", 8, 'y'}, true}, {false, 'p2'}) ");

            Assert.AreEqual(pm.Is(LevelType.Method, "m77"), true);

            Argument[] args = pm.Levels[0].Args;
            Assert.AreEqual(args.Length, 4);

            Assert.AreEqual(args[0].type, ArgumentType.StringDouble);
            Assert.AreEqual(args[0].data, "guid");

            Assert.AreEqual(args[1].type, ArgumentType.Integer);
            Assert.AreEqual(args[1].data, 12);

            Assert.AreEqual(args[2].type, ArgumentType.Object);
            {
                Argument[] args2 = (Argument[])args[2].data;
                Assert.AreEqual(args2.Length, 3);

                Assert.AreEqual(args2[0].type, ArgumentType.StringDouble);
                Assert.AreEqual(args2[0].data, "p1");

                Assert.AreEqual(args2[1].type, ArgumentType.Object);
                {
                    Argument[] args21 = (Argument[])args2[1].data;
                    Assert.AreEqual(args21.Length, 4);

                    Assert.AreEqual(args21[0].type, ArgumentType.Integer);
                    Assert.AreEqual(args21[0].data, 4);

                    Assert.AreEqual(args21[1].type, ArgumentType.StringDouble);
                    Assert.AreEqual(args21[1].data, "test");

                    Assert.AreEqual(args21[2].type, ArgumentType.Integer);
                    Assert.AreEqual(args21[2].data, 8);

                    Assert.AreEqual(args21[3].type, ArgumentType.Char);
                    Assert.AreEqual(args21[3].data, 'y');
                }

                Assert.AreEqual(args2[2].type, ArgumentType.Boolean);
                Assert.AreEqual(args2[2].data, true);
            }

            Assert.AreEqual(args[3].type, ArgumentType.Object);
            {
                Argument[] args3 = (Argument[])args[3].data;
                Assert.AreEqual(args3.Length, 2);

                Assert.AreEqual(args3[0].type, ArgumentType.Boolean);
                Assert.AreEqual(args3[0].data, false);

                Assert.AreEqual(args3[1].type, ArgumentType.StringSingle);
                Assert.AreEqual(args3[1].data, "p2");
            }
        }
Esempio n. 16
0
        public void ItTest2()
        {
            IPM pm = new PM("solution.m1().Prop1.right");

            Assert.AreEqual(true, pm.It(LevelType.Property, "solution"));
            Assert.AreEqual(true, pm.Is(LevelType.Method, "m1"));
            Assert.AreEqual(false, pm.It(LevelType.Property, "Prop1"));
            Assert.AreEqual(true, pm.It(1, LevelType.Property, "Prop1"));
            Assert.AreEqual(true, pm.It(LevelType.Property, "right"));
        }
Esempio n. 17
0
        public void ItTest1()
        {
            IPM pm = new PM("solution.m1().right");

            Assert.AreEqual(true, pm.It(LevelType.Property, "solution"));
            Assert.AreEqual(true, pm.It(LevelType.Method, "m1"));
            Assert.AreEqual(false, pm.It(LevelType.Property, "notRealProperty"));
            Assert.AreEqual(true, pm.It(LevelType.Property, "right"));
            Assert.AreEqual(true, pm.It(LevelType.RightOperandEmpty));

            Assert.AreEqual(0, pm.Levels.Count);
            Assert.AreEqual(false, pm.It(LevelType.RightOperandEmpty));
            Assert.AreEqual(false, pm.Is(0, LevelType.RightOperandEmpty));
        }
Esempio n. 18
0
        public void ItTest1()
        {
            IPM pm = new PM("solution.m1().right");

            Assert.True(pm.It(LevelType.Property, "solution"));
            Assert.True(pm.It(LevelType.Method, "m1"));
            Assert.False(pm.It(LevelType.Property, "notRealProperty"));
            Assert.True(pm.It(LevelType.Property, "right"));
            Assert.True(pm.It(LevelType.RightOperandEmpty));

            Assert.Empty(pm.Levels);
            Assert.False(pm.It(LevelType.RightOperandEmpty));
            Assert.False(pm.Is(0, LevelType.RightOperandEmpty));
        }
Esempio n. 19
0
        public void detectArgumentTest4()
        {
            IPM pm = new PM("solution(\"str \\\" data1 \\\" \", \"str \\' data2 \\' \", 'str \\' data3 \\' ', 'str \\\" data4 \\\" ')");

            Assert.AreEqual(pm.Is(LevelType.Method, "solution"), true);
            Assert.AreEqual(pm.Levels[0].Args.Length, 4);

            Argument[] args = pm.Levels[0].Args;
            Assert.AreEqual(args[0].type, ArgumentType.StringDouble);
            Assert.AreEqual(args[0].data, "str \" data1 \" ");

            Assert.AreEqual(args[1].type, ArgumentType.StringDouble);
            Assert.AreEqual(args[1].data, "str \\' data2 \\' ");

            Assert.AreEqual(args[2].type, ArgumentType.StringSingle);
            Assert.AreEqual(args[2].data, "str ' data3 ' ");

            Assert.AreEqual(args[3].type, ArgumentType.StringSingle);
            Assert.AreEqual(args[3].data, "str \\\" data4 \\\" ");
        }
Esempio n. 20
0
        public void DetectArgumentTest4()
        {
            IPM pm = new PM("solution(\"str \\\" data1 \\\" \", \"str \\' data2 \\' \", 'str \\' data3 \\' ', 'str \\\" data4 \\\" ')");

            Assert.True(pm.Is(LevelType.Method, "solution"));
            Assert.Equal(4, pm.Levels[0].Args.Length);

            var args = pm.Levels[0].Args;

            Assert.Equal(ArgumentType.StringDouble, args[0].type);
            Assert.Equal("str \" data1 \" ", args[0].data);

            Assert.Equal(ArgumentType.StringDouble, args[1].type);
            Assert.Equal("str \\' data2 \\' ", args[1].data);

            Assert.Equal(ArgumentType.StringSingle, args[2].type);
            Assert.Equal("str ' data3 ' ", args[2].data);

            Assert.Equal(ArgumentType.StringSingle, args[3].type);
            Assert.Equal("str \\\" data4 \\\" ", args[3].data);
        }
Esempio n. 21
0
        public void DetectArgumentTest1()
        {
            IPM pm = new PM("solution(\"str data\", 'str data2', 12, -12, 1.5, -1.5, STDOUT, TestEnum.SpecialType, mixed * data, true)");

            Assert.True(pm.Is(LevelType.Method, "solution"));
            Assert.Equal(10, pm.Levels[0].Args.Length);

            var args = pm.Levels[0].Args;

            Assert.Equal(ArgumentType.StringDouble, args[0].type);
            Assert.Equal("str data", args[0].data);

            Assert.Equal(ArgumentType.StringSingle, args[1].type);
            Assert.Equal("str data2", args[1].data);

            Assert.Equal(ArgumentType.Integer, args[2].type);
            Assert.Equal(12, args[2].data);

            Assert.Equal(ArgumentType.Integer, args[3].type);
            Assert.Equal(-12, args[3].data);

            Assert.Equal(ArgumentType.Double, args[4].type);
            Assert.Equal(1.5, args[4].data);

            Assert.Equal(ArgumentType.Double, args[5].type);
            Assert.Equal(-1.5, args[5].data);

            Assert.Equal(ArgumentType.EnumOrConst, args[6].type);
            Assert.Equal("STDOUT", args[6].data);

            Assert.Equal(ArgumentType.EnumOrConst, args[7].type);
            Assert.Equal("TestEnum.SpecialType", args[7].data);

            Assert.Equal(ArgumentType.Mixed, args[8].type);
            Assert.Equal("mixed * data", args[8].data);

            Assert.Equal(ArgumentType.Boolean, args[9].type);
            Assert.Equal(true, args[9].data);
        }
Esempio n. 22
0
        public void detectArgumentTest1()
        {
            IPM pm = new PM("solution(\"str data\", 'str data2', 12, -12, 1.5, -1.5, STDOUT, TestEnum.SpecialType, mixed * data, true)");

            Assert.AreEqual(pm.Is(LevelType.Method, "solution"), true);
            Assert.AreEqual(pm.Levels[0].Args.Length, 10);

            Argument[] args = pm.Levels[0].Args;
            Assert.AreEqual(args[0].type, ArgumentType.StringDouble);
            Assert.AreEqual(args[0].data, "str data");

            Assert.AreEqual(args[1].type, ArgumentType.StringSingle);
            Assert.AreEqual(args[1].data, "str data2");

            Assert.AreEqual(args[2].type, ArgumentType.Integer);
            Assert.AreEqual(args[2].data, 12);

            Assert.AreEqual(args[3].type, ArgumentType.Integer);
            Assert.AreEqual(args[3].data, -12);

            Assert.AreEqual(args[4].type, ArgumentType.Double);
            Assert.AreEqual(args[4].data, 1.5);

            Assert.AreEqual(args[5].type, ArgumentType.Double);
            Assert.AreEqual(args[5].data, -1.5);

            Assert.AreEqual(args[6].type, ArgumentType.EnumOrConst);
            Assert.AreEqual(args[6].data, "STDOUT");

            Assert.AreEqual(args[7].type, ArgumentType.EnumOrConst);
            Assert.AreEqual(args[7].data, "TestEnum.SpecialType");

            Assert.AreEqual(args[8].type, ArgumentType.Mixed);
            Assert.AreEqual(args[8].data, "mixed * data");

            Assert.AreEqual(args[9].type, ArgumentType.Boolean);
            Assert.AreEqual(args[9].data, true);
        }