UNPKG

958 Btext/coffeescriptView Raw
1ok_tests = 0
2ko_tests = 0
3
4logout = (s) ->
5 console.log s
6
7
8run_test = (s) ->
9 i = 0
10 t = ""
11
12 test_flag = 1
13
14 run("clearall")
15
16 run("e=quote(e)")
17
18 for i in [0...s.length] by 2
19
20 console.log("starting example: " + s[i])
21 #alert("starting example: " + s[i])
22 # document.write("starting example: " + s[i] )
23
24
25 out_count = 0
26
27 try
28 resultFromRun = run(s[i])
29 catch error
30 console.log error
31 init()
32
33
34 if (resultFromRun == s[i+1])
35 # document.write(" ...ok</br>")
36 console.log("ok example: " + s[i])
37 # alert("ok example: " + s[i])
38 ok_tests++
39 continue
40
41 ko_tests++
42 # document.write(" ...fail</br>")
43 console.log("\n")
44 console.log("test failed: " + s[i])
45
46 console.log("expected: " + s[i+1])
47
48 console.log("obtained: " + resultFromRun)
49 console.log("\n")
50
51 # alert "test failed: " + s[i] + " expected: " + s[i+1] + " obtained: " + resultFromRun
52
53
54 test_flag = 0
55
56# these tests do not use "run" but still need a "stop" context
\No newline at end of file