Esempio n. 1
0
        public void TestEquation()
        {
            var equations = new ScalarEquations <string>();

            var a =
                equations.CreateScalarInput("a",
                                            equations.CreateScalarConstant(0));
            var b =
                equations.CreateScalarInput("b",
                                            equations.CreateScalarConstant(1));
            var c =
                equations.CreateScalarInput("c",
                                            equations.CreateScalarConstant(2));
            var d =
                equations.CreateScalarInput("d",
                                            equations.CreateScalarConstant(3));

            var output =
                equations.CreateScalarOutput("output",
                                             a.Multiply(b).Divide(c).Add(d));

            this.AssertEquals_(equations,
                               "Inputs:",
                               "a: 0",
                               "b: 1",
                               "c: 2",
                               "d: 3",
                               "",
                               "Outputs:",
                               "output: {a}*{b}/{c} + {d}");
        }
Esempio n. 2
0
        public void TestComplexDivision()
        {
            var equations = new ScalarEquations <string>();

            var a =
                equations.CreateScalarInput("a",
                                            equations.CreateScalarConstant(0));
            var b =
                equations.CreateScalarInput("b",
                                            equations.CreateScalarConstant(1));
            var c =
                equations.CreateScalarInput("c",
                                            equations.CreateScalarConstant(2));
            var d =
                equations.CreateScalarInput("d",
                                            equations.CreateScalarConstant(3));

            var output =
                equations.CreateScalarOutput("output",
                                             (a.Add(b)).Divide(c.Subtract(d)));

            this.AssertEquals_(equations,
                               "Inputs:",
                               "a: 0",
                               "b: 1",
                               "c: 2",
                               "d: 3",
                               "",
                               "Outputs:",
                               "output: ({a} + {b})/({c} + -1*{d})");
        }
Esempio n. 3
0
        public void TestInOut()
        {
            var equations = new ScalarEquations <string>();

            var fooIn =
                equations.CreateScalarInput("fooIn",
                                            equations.CreateScalarConstant(123));
            var fooOut = equations.CreateScalarOutput("fooOut", fooIn);

            this.AssertEquals_(equations,
                               "Inputs:",
                               "fooIn: 123",
                               "",
                               "Outputs:",
                               "fooOut: {fooIn}");
        }