From bbc1bee3137e393c6950da289a79d5f2a8c33697 Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Sun, 18 Sep 2022 18:33:01 +0400 Subject: [PATCH] fix more tests --- .../Reducer_Dispatch/Reducer_Dispatch_BuiltIn_test.res | 4 ++-- .../__tests__/Reducer/Reducer_functionTricks_test.res | 4 ++-- .../ReducerInterface/ReducerInterface_Distribution_test.res | 2 +- .../SquiggleLibrary_FunctionRegistryLibrary_test.res | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn_test.res index 4932af3b..5c6848b8 100644 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn_test.res +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltIn_test.res @@ -24,9 +24,9 @@ describe("builtin", () => { }) describe("builtin exception", () => { - //It's a pity that MathJs does not return error position + //MathJS is no more, this is just a normal function call (TODO - refactor tests) test("MathJs Exception", () => - expectEvalToBe("testZadanga(1)", "Error(JS Exception: Error: Undefined function testZadanga)") + expectEvalToBe("testZadanga(1)", "Error(testZadanga is not defined)") ) }) diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_functionTricks_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_functionTricks_test.res index 9b111354..8045d0d2 100644 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_functionTricks_test.res +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_functionTricks_test.res @@ -34,7 +34,7 @@ describe("symbol not defined", () => { testEvalToBe("f(x)=x(y); f(f)", "Error(y is not defined)") testEvalToBe("f(x)=x; f(f)", "Ok(lambda(x=>internal code))") testEvalToBe("f(x)=x(y); f(z)", "Error(z is not defined)") - testEvalToBe("f(x)=x(y); f(2)", "Error(2 is not a function)") + testEvalToBe("f(x)=x(y); f(2)", "Error(y is not defined)") testEvalToBe("f(x)=x(1); f(2)", "Error(2 is not a function)") }) @@ -48,7 +48,7 @@ describe("call and bindings", () => { testEvalToBe("f(x)=x+1; g(x)=f(x)+1; g(0)", "Ok(2)") testParseToBe( "f=99; g(x)=f; g(2)", - "Ok({(:$_let_$ :f {99}); (:$_let_$ :g (:$$_lambda_$$ [x] {:f})); (:$_endOfOuterBlock_$ () (:g 2))})", + "Ok(f = {99}; g = {|x| {f}}; (g)(2))", ) testEvalToBe("f=99; g(x)=f; g(2)", "Ok(99)") testEvalToBe("f(x)=x; g(x)=f(x); g(2)", "Ok(2)") diff --git a/packages/squiggle-lang/__tests__/ReducerInterface/ReducerInterface_Distribution_test.res b/packages/squiggle-lang/__tests__/ReducerInterface/ReducerInterface_Distribution_test.res index 330767df..21a0e9c3 100644 --- a/packages/squiggle-lang/__tests__/ReducerInterface/ReducerInterface_Distribution_test.res +++ b/packages/squiggle-lang/__tests__/ReducerInterface/ReducerInterface_Distribution_test.res @@ -23,7 +23,7 @@ describe("eval on distribution functions", () => { testEval("-normal(5,2)", "Ok(Normal(-5,2))") }) describe("to", () => { - testEval("5 to 2", "Error(TODO: Low value must be less than high value.)") + testEval("5 to 2", "Error(Error: Low value must be less than high value.)") testEval("to(2,5)", "Ok(Lognormal(1.1512925464970227,0.27853260523016377))") testEval("to(-2,2)", "Ok(Normal(0,1.2159136638235384))") }) diff --git a/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res b/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res index 831eb271..95fdbdf6 100644 --- a/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res +++ b/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res @@ -15,7 +15,7 @@ let examples = E.A.to_list(FunctionRegistry_Core.Registry.allExamples(registry)) describe("FunctionRegistry Library", () => { describe("Regular tests", () => { testEvalToBe("List.make(3, 'HI')", "Ok(['HI','HI','HI'])") - testEvalToBe("make(3, 'HI')", "Error(Function not found: make(Number,String))") + testEvalToBe("make(3, 'HI')", "Error(make is not defined)") testEvalToBe("List.upTo(1,3)", "Ok([1,2,3])") testEvalToBe("List.first([3,5,8])", "Ok(3)") testEvalToBe("List.last([3,5,8])", "Ok(8)")