forked from davidedc/Algebrite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new option "npm run microtest" to run just a couple of tests quickly
- Loading branch information
Showing
4 changed files
with
86 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
|
||
# quick and dirty way to run a few tests | ||
|
||
run_test [ | ||
|
||
"1+1", | ||
"2", | ||
|
||
] | ||
|
||
# alert "passed tests: " + ok_tests + " / failed tests: " + ko_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
ok_tests = 0 | ||
ko_tests = 0 | ||
|
||
logout = (s) -> | ||
console.log s | ||
|
||
|
||
run_test = (s) -> | ||
i = 0 | ||
t = "" | ||
|
||
test_flag = 1 | ||
|
||
run("clear") | ||
|
||
run("e=quote(e)") | ||
|
||
for i in [0...s.length] by 2 | ||
|
||
console.log("starting example: " + s[i]) | ||
#alert("starting example: " + s[i]) | ||
# document.write("starting example: " + s[i] ) | ||
|
||
|
||
out_count = 0 | ||
|
||
try | ||
resultFromRun = run(s[i]) | ||
catch error | ||
console.log error | ||
init() | ||
|
||
|
||
if (resultFromRun == s[i+1]) | ||
# document.write(" ...ok</br>") | ||
console.log("ok example: " + s[i]) | ||
# alert("ok example: " + s[i]) | ||
ok_tests++ | ||
continue | ||
|
||
ko_tests++ | ||
# document.write(" ...fail</br>") | ||
console.log("\n") | ||
console.log("test failed: " + s[i]) | ||
|
||
console.log("expected: " + s[i+1]) | ||
|
||
console.log("obtained: " + resultFromRun) | ||
console.log("\n") | ||
|
||
# alert "test failed: " + s[i] + " expected: " + s[i+1] + " obtained: " + resultFromRun | ||
|
||
|
||
test_flag = 0 | ||
|
||
# these tests do not use "run" but still need a "stop" context |