forked from davidedc/Algebrite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-harness.coffee
56 lines (36 loc) · 1022 Bytes
/
test-harness.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
ok_tests = 0
ko_tests = 0
logout = (s) ->
console.log s
run_test = (s) ->
i = 0
t = ""
test_flag = 1
run("clearall")
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