diff options
author | Lizzy Hunt <lizzy.hunt@usu.edu> | 2024-02-28 13:41:53 -0700 |
---|---|---|
committer | Lizzy Hunt <lizzy.hunt@usu.edu> | 2024-02-28 13:41:53 -0700 |
commit | d39cf84965dffd11cab440f5a4efa1b16932ba73 (patch) | |
tree | e0239d2047756120c51fd431999520ffbb38d29b /test/interpreter.spec.ts | |
parent | 7cc3ef5fa1feec8087618c899441a11052f84c48 (diff) | |
download | cps-interpreter-d39cf84965dffd11cab440f5a4efa1b16932ba73.tar.gz cps-interpreter-d39cf84965dffd11cab440f5a4efa1b16932ba73.zip |
branching
Diffstat (limited to 'test/interpreter.spec.ts')
-rw-r--r-- | test/interpreter.spec.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/interpreter.spec.ts b/test/interpreter.spec.ts index fa74ef0..49b741e 100644 --- a/test/interpreter.spec.ts +++ b/test/interpreter.spec.ts @@ -18,6 +18,13 @@ test('Add (1 real) and (3 int) -> result => (real 1 - result) = -3 done with cor expect(result).toEqual({ type: 'real', value: -3 }); }); +test('Branching', async () => { + const ast = peggyParse(await TestPrograms.Branching); + + const result = await evaluate(ast, testingLogger); + expect(result).toEqual({ type: 'real', value: 2 }); +}); + /* test('String equality', async () => { const ast = peggyParse(await TestPrograms.StringEquality); |