当前位置: 首页>>代码示例>>C#>>正文


C# Expression.setExpressionString方法代码示例

本文整理汇总了C#中Expression.setExpressionString方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.setExpressionString方法的具体用法?C# Expression.setExpressionString怎么用?C# Expression.setExpressionString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Expression的用法示例。


在下文中一共展示了Expression.setExpressionString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: testScenario

 protected override void testScenario()
 {
     Expression e = new Expression("");
     for (int i = 0; i <= base.iterNum; i++) {
         e.setExpressionString("sin(2+(3*4)^2)/10");
         e.checkSyntax();
     }
 }
开发者ID:RoganMatrivski,项目名称:Math-Problem-Generator,代码行数:8,代码来源:PerformanceTests.cs

示例2: Start

        /**
         * Runs API regression tests.
         *
         * @return Number of tests with error result.
         */
        public static int Start()
        {
            long start = mXparser.currentTimeMillis();
            bool syn1, syn2, syn3, syn4, syn5, syn6, syn7, syn8, b1, b2, b3;
            String s1, s2;
            int i1, i2, n1, n2, n3, n4, n5, n6;
            Argument A1, A2, A3, A4, A5;
            Function F1, F2, F3, F4, F5;
            Constant C1, C2, C3, C4, C5;
            double d1, d2, d3;
            Constant c1 = new Constant("c1",1);
            Constant c2 = new Constant("c2",2);
            Constant c3 = new Constant("c3",3);
            //Constant c4 = new Constant("c4",4);
            Constant c5 = new Constant("c5",5);
            Constant c6 = new Constant("c6",6);
            Function f1 = new Function("f1","1","x");
            Function f2 = new Function("f2","2","x");
            Function f3 = new Function("f3","3","x");
            Function f4 = new Function("f4","4","x");
            //Function f5 = new Function("f5","5","x");
            Function f6 = new Function("f6","6","x");
            Function f7 = new Function("f7","7","x");
            Argument a1 = new Argument("a1",1);
            Argument a2 = new Argument("a2",2);
            Argument a3 = new Argument("a3",3);
            Argument a4 = new Argument("a4",4);
            Argument a5 = new Argument("a5",5);
            Argument a6 = new Argument("a6",6);
            Argument a7 = new Argument("a7",7);
            //Argument a8 = new Argument("a8",8);
            bool[] test = new bool[100];
            for (int i = 0; i < 100; i++)
                test[i] = false;
            Expression e;
            int testId = -1;
            /*
             * 0. public Expression()
             */
            testId++;
            e = new Expression();
            if (	e.getExpressionString().Equals("")
                    && e.getArgumentsNumber() == 0
                    && e.getConstantsNumber() == 0
                    && e.getFunctionsNumber() == 0	)
                test[testId] = true;
            /*
             * 1.
             */
            testId++;
            e = new Expression("a1+c2", a1, a2, a3, a4, a5);
            if (	e.getExpressionString().Equals("a1+c2")
                    && e.getArgumentsNumber() == 5
                    && e.getConstantsNumber() == 0
                    && e.getFunctionsNumber() == 0	)
                test[testId] = true;
            /*
             * 2.
             */
            testId++;
            e = new Expression("a1+c2", a1, f1, a2, f2, a3, a4, f3, a5, f4);
            if (	e.getExpressionString().Equals("a1+c2")
                    && e.getArgumentsNumber() == 5
                    && e.getConstantsNumber() == 0
                    && e.getFunctionsNumber() == 4	)
                test[testId] = true;
            /*
             * 3
             */
            testId++;
            e = new Expression("a1+c2", a1, a2, c1, c2, a3, a4, c5, a5, f1, f2, f3, f4);
            if (	e.getExpressionString().Equals("a1+c2")
                    && e.getArgumentsNumber() == 5
                    && e.getConstantsNumber() == 3
                    && e.getFunctionsNumber() == 4	)
                test[testId] = true;
            /*
             * 4. void setExpressionString(String expressionString), String getExpressionString(), void clearExpressionString()
             */
            testId++;
            syn1 = e.checkSyntax();
            e.setExpressionString("c2+a1");
            syn2 = e.getSyntaxStatus();
            syn3 = e.checkSyntax();
            s1 = e.getExpressionString();
            syn4 = e.getSyntaxStatus();
            syn5 = e.checkSyntax();
            e.clearExpressionString();
            syn6 = e.getSyntaxStatus();
            syn7 = e.checkSyntax();
            s2 = e.getExpressionString();
            syn8 = e.getSyntaxStatus();
            if (	s1.Equals("c2+a1")
                    && s2.Equals("")
                    && syn1 == Expression.NO_SYNTAX_ERRORS
//.........这里部分代码省略.........
开发者ID:RoganMatrivski,项目名称:Math-Problem-Generator,代码行数:101,代码来源:RegTestExpressionAPI.cs


注:本文中的Expression.setExpressionString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。