Beispiel #1
0
        public void GetDependentFunctions_SingleNamedFunction()
        {
            CompileResult result = Compiler.Compile("f(x) = sin(x)");

            result.GetDependentFunctions("f").Should().ContainSingle(s => s == "f");
            result.GetDependentFunctions("sin").Should().BeEmpty();
        }
Beispiel #2
0
        public void SingleUnnamedFunction_NoDependentFunctions(string functionName)
        {
            CompileResult        result    = Compiler.Compile("sin(x)");
            IEnumerable <string> functions = result.GetDependentFunctions(functionName);

            functions.Should().BeEmpty();
        }
Beispiel #3
0
        public void Errors_NoDependentFunctions(string functionName)
        {
            CompileResult        result    = Compiler.Compile("////");
            IEnumerable <string> functions = result.GetDependentFunctions(functionName);

            functions.Should().BeEmpty();
        }
Beispiel #4
0
        public void GetDependentFunctions_SimpleGraph()
        {
            var functions = new string[]
            {
                "f(x) = x",
                "g(x) = f(x) + f(x) + 2",
                "h(x) = g(x) / 2"
            };

            CompileResult result = InvariantCompiler.Compile(functions);

            result.IsSuccess.Should().BeTrue();

            string[] dependents = result.GetDependentFunctions("f").ToArray();
            dependents.Should().Contain(new string[] { "f", "g", "h" });
        }