Skip to content

Commit

Permalink
Add tests for evaluator
Browse files Browse the repository at this point in the history
The evaluator is currently accompanied by test cases.

Let's add a set of tests that can be run on Source Academy
playground.

To facilitate testing, let's use a global variable to
track the most recent result from `parse_and_eval`.
  • Loading branch information
arsalan0c authored Feb 10, 2020
1 parent 9721163 commit d5e1f65
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 66 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "source-test"]
path = source-test
url = https://github.com/arsalanc-v2/source-test.git
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,11 @@ const f = amb(1, 2, 3); const g = amb(5, 6, 7); g;
// Result: 5, 6, 7, 5, 6, 7, 5, 6, 7
```

### Running Tests

1. Copy the code from the following files into the playground:
* `evaluator.js`
* `test.js`
* `source-test/main.js`

2. Remove one of the two instances of the repeated function `variable_declaration_name` (from `evaluator.js` and `source-test/main.js`)
Loading

0 comments on commit d5e1f65

Please sign in to comment.