squiggle/packages/squiggle-lang/__tests__/Reducer/Reducer_functionAssignment_test.res

13 lines
451 B
Plaintext
Raw Normal View History

2022-04-23 19:13:43 +00:00
open Jest
open Reducer_TestHelpers
describe("Parse function assignment", () => {
testParseToBe("f(x)=x", "Ok((:$$_block_$$ (:$_let_$ :f (:$$_lambda_$$ [x] (:$$_block_$$ :x)))))")
testParseToBe("f(x)=2*x", "Ok((:$$_block_$$ (:$_let_$ :f (:$$_lambda_$$ [x] (:$$_block_$$ (:multiply 2 :x))))))")
2022-04-23 19:13:43 +00:00
//MathJs does not allow blocks in function definitions
})
2022-04-25 00:37:35 +00:00
describe("Evaluate function assignment", () => {
testEvalToBe("f(x)=x; f(1)", "Ok(1)")
})