fix more tests
This commit is contained in:
parent
fd4137b596
commit
bbc1bee313
|
@ -24,9 +24,9 @@ describe("builtin", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("builtin exception", () => {
|
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", () =>
|
test("MathJs Exception", () =>
|
||||||
expectEvalToBe("testZadanga(1)", "Error(JS Exception: Error: Undefined function testZadanga)")
|
expectEvalToBe("testZadanga(1)", "Error(testZadanga is not defined)")
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ describe("symbol not defined", () => {
|
||||||
testEvalToBe("f(x)=x(y); f(f)", "Error(y is 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; 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(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)")
|
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)")
|
testEvalToBe("f(x)=x+1; g(x)=f(x)+1; g(0)", "Ok(2)")
|
||||||
testParseToBe(
|
testParseToBe(
|
||||||
"f=99; g(x)=f; g(2)",
|
"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=99; g(x)=f; g(2)", "Ok(99)")
|
||||||
testEvalToBe("f(x)=x; g(x)=f(x); g(2)", "Ok(2)")
|
testEvalToBe("f(x)=x; g(x)=f(x); g(2)", "Ok(2)")
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe("eval on distribution functions", () => {
|
||||||
testEval("-normal(5,2)", "Ok(Normal(-5,2))")
|
testEval("-normal(5,2)", "Ok(Normal(-5,2))")
|
||||||
})
|
})
|
||||||
describe("to", () => {
|
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,5)", "Ok(Lognormal(1.1512925464970227,0.27853260523016377))")
|
||||||
testEval("to(-2,2)", "Ok(Normal(0,1.2159136638235384))")
|
testEval("to(-2,2)", "Ok(Normal(0,1.2159136638235384))")
|
||||||
})
|
})
|
||||||
|
|
|
@ -15,7 +15,7 @@ let examples = E.A.to_list(FunctionRegistry_Core.Registry.allExamples(registry))
|
||||||
describe("FunctionRegistry Library", () => {
|
describe("FunctionRegistry Library", () => {
|
||||||
describe("Regular tests", () => {
|
describe("Regular tests", () => {
|
||||||
testEvalToBe("List.make(3, 'HI')", "Ok(['HI','HI','HI'])")
|
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.upTo(1,3)", "Ok([1,2,3])")
|
||||||
testEvalToBe("List.first([3,5,8])", "Ok(3)")
|
testEvalToBe("List.first([3,5,8])", "Ok(3)")
|
||||||
testEvalToBe("List.last([3,5,8])", "Ok(8)")
|
testEvalToBe("List.last([3,5,8])", "Ok(8)")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user