squiggle/packages/squiggle-lang/__tests__/Reducer/Reducer_functionAssignment_test.res
Umur Ozkul ac3fa859c0 Replace $$_block__$$ with {}
More redable language tests
2022-05-29 17:55:01 +02:00

16 lines
412 B
Plaintext

open Jest
open Reducer_TestHelpers
describe("Parse function assignment", () => {
testParseToBe("f(x)=x", "Ok({(:$_let_$ :f (:$$_lambda_$$ [x] {:x}))})")
testParseToBe(
"f(x)=2*x",
"Ok({(:$_let_$ :f (:$$_lambda_$$ [x] {(:multiply 2 :x)}))})",
)
//MathJs does not allow blocks in function definitions
})
describe("Evaluate function assignment", () => {
testEvalToBe("f(x)=x; f(1)", "Ok(1)")
})