예제 #1
0
        public void test_sign_precedence()
        {
            const double b = 2;

            Tester.EqnTest("-3^2", -9.0, true);
            Tester.EqnTest("-b^2^3-b^8", -Math.Pow(b, Math.Pow(2, 3)) - Math.Pow(b, 8), true);
        }
예제 #2
0
 public void test_complex_pow()
 {
     Tester.EqnTest("(-3)^(4/3)", Complex.Pow(new Complex(-3, 0), new Complex(4.0 / 3, 0)), true, 0);
     // Issue 41:  Complex pow of small numbers zeros out the imaginary part
     //            https://code.google.com/p/muparserx/issues/detail?id=41
     Tester.EqnTest("(1e-15 + 1e-15*i) ^ 2", 0, true, 0);
 }
예제 #3
0
        public void test_issue42()
        {
            double a = 1;

            Tester.EqnTest("abs(0.1) < 0.25 ? (-1) : (1) + 1", Math.Abs(0.1) < 0.25 ? (-1.0) : (1.0) + 1, true);
            Tester.EqnTest("abs(a) < 0.25 ? (-1) : (1) + 1", Math.Abs(a) < 0.25 ? (-1.0) : (1.0) + 1, true);
            Tester.EqnTest("(abs(a) < 0.25 ? -1 : 1)", Math.Abs(a) < 0.25 ? -1.0 : 1.0, true);
        }
예제 #4
0
        public void test_negation()
        {
            const double a = 1;

            Tester.EqnTest("-a", -a, true);
            Tester.EqnTest("-(a)", -(a), true);
            Tester.EqnTest("-(-a)", -(-a), true);
            Tester.EqnTest("-(-a)*2", -(-a) * 2, true);
        }
예제 #5
0
        public void test_issue42()
        {
            var v = new Value(3, 0);

            v.At(0) = 1;
            v.At(1) = 0;
            v.At(2) = 0;
            Tester.EqnTest("{1,0,0}'", v, true);
            Tester.EqnTest("{(1),0,0}'", v, true);
        }
예제 #6
0
        public void test_vector_addition()
        {
            var v = new Value(3, 0);

            v.At(0) = 5;
            v.At(1) = 5;
            v.At(2) = 5;
            Tester.EqnTest("va+vb", v, true);
            v.At(2) = 6;
            Tester.EqnTest("va+vb", v, false);
            v.At(0) = -1;
            v.At(1) = -2;
            v.At(2) = -3;
            Tester.EqnTest("-va", v, true);
        }
예제 #7
0
        public void test_issue16b()
        {
            Value a = 1.0;

            Tester.EqnTest("a==1.0 && a==1.0", a == 1.0 && a == 1.0, true);
        }
예제 #8
0
 public void test_issue16a(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #9
0
 public void test_bug_report(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #10
0
 public void test_matrix_transposition() => Tester.EqnTest("va*vb'", _dict[nameof(va_times_vb_transp)], true);
예제 #11
0
 public void test_multiarg_functions(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #12
0
 public void test_sample_expressions(string s1, string v1, bool t) => Tester.EqnTest(s1, _dict[v1], t);
예제 #13
0
 public void test_embedded_statements(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #14
0
 public void test_expression_with_new_line(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #15
0
 public void test_expressions_spaning_multiple_lines(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #16
0
 public void test_vector_indexing(string s1, object v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #17
0
 [DataRow("{a,2,3}'", nameof(va), true)]        // that was an actual bug: variable a was overwritten
 public void test_vector_creation_literal(string s1, string v1, bool t) => Tester.EqnTest(s1, _dict[v1], t);
예제 #18
0
 public void test_two_dim_tranposed_index_operator(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #19
0
 public void test_two_dimentional_index_operator(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #20
0
 public void test_real_part(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #21
0
 public void test_new_tests(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #22
0
 public void test_conditional_without_brackets(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #23
0
 public void test_assignment_operators(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #24
0
 [DataRow("size(eye(3,6))", nameof(size_3x6), true)] // check return value dimension
 public void test_eye_value(string s1, string v1, bool t) => Tester.EqnTest(s1, _dict[v1], t);
예제 #25
0
 public void test_basic_ifelse(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #26
0
 public void test_application(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #27
0
 public void test_multiple_logic(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #28
0
 public void test_matrix_transposition(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #29
0
 // [DataRow("(atan(sin((((((((((((((((pi/cos((a/((((0.53-b)-pi)*e)/b))))+2.51)+a)-0.54)/0.98)+b)*b)+e)/a)+b)+a)+b)+pi)/e)+a)))*2.77)", -2.16995656, true)]
 public void test_long_expressions(string s1, dynamic v1, bool t) => Tester.EqnTest(s1, v1, t);
예제 #30
0
 public void test_complex_numbers(string s1, double d1, double d2, bool t, int i) => Tester.EqnTest(s1, new Complex(d1, d2), t, i);