diff options
| author | mryouse | 2022-07-03 01:00:18 +0000 |
|---|---|---|
| committer | mryouse | 2022-07-03 01:00:18 +0000 |
| commit | e169e50e9d2ab5584e3b72ed069e7695a123e1e7 (patch) | |
| tree | 47c0ec4120518807e3a60a133502e9e84f126153 /tests | |
| parent | 74a048dd493788bab9f9c93b0ed6d925a998822b (diff) | |
initial commit of tests for math things
Diffstat (limited to 'tests')
67 files changed, 218 insertions, 0 deletions
diff --git a/tests/math/addition/bad_arity.neb b/tests/math/addition/bad_arity.neb new file mode 100644 index 0000000..fd4763d --- /dev/null +++ b/tests/math/addition/bad_arity.neb @@ -0,0 +1,2 @@ +(+) +; panic! [1] '+': expected [1+] arguments, received 0 diff --git a/tests/math/addition/bad_type_bool.neb b/tests/math/addition/bad_type_bool.neb new file mode 100644 index 0000000..a4bfecc --- /dev/null +++ b/tests/math/addition/bad_type_bool.neb @@ -0,0 +1,2 @@ +(+ 7.34 #true) +; panic! [1] '+': received :bool, expected :number (got #true) diff --git a/tests/math/addition/bad_type_list.neb b/tests/math/addition/bad_type_list.neb new file mode 100644 index 0000000..cb8a999 --- /dev/null +++ b/tests/math/addition/bad_type_list.neb @@ -0,0 +1,2 @@ +(+ 4 (list "hello")) +; panic! [1] '+': received :list, expected :number (got ("hello")) diff --git a/tests/math/addition/bad_type_string.neb b/tests/math/addition/bad_type_string.neb new file mode 100644 index 0000000..23a161c --- /dev/null +++ b/tests/math/addition/bad_type_string.neb @@ -0,0 +1,2 @@ +(+ 3 "hello") +; panic! [1] '+': received :string, expected :number (got "hello") diff --git a/tests/math/addition/bad_type_type.neb b/tests/math/addition/bad_type_type.neb new file mode 100644 index 0000000..088fefb --- /dev/null +++ b/tests/math/addition/bad_type_type.neb @@ -0,0 +1,2 @@ +(+ .4 :string) +; panic! [1] '+': received :type, expected :number (got :string) diff --git a/tests/math/addition/happy.neb b/tests/math/addition/happy.neb new file mode 100644 index 0000000..4c037b2 --- /dev/null +++ b/tests/math/addition/happy.neb @@ -0,0 +1,10 @@ +(print + (concat + (->string (+ 2)) " " + (->string (+ 4 5)) " " + (->string (+ .9)) " " + (->string (+ 2.9 4)) " " + (->string (+ 2 4.5)) " " + (->string (+ 6 7 8 15)))) + +; 2 9 0.9 6.9 6.5 36 diff --git a/tests/math/division/bad_arity_one.neb b/tests/math/division/bad_arity_one.neb new file mode 100644 index 0000000..eb243d1 --- /dev/null +++ b/tests/math/division/bad_arity_one.neb @@ -0,0 +1,2 @@ +(/ 7) +; panic! [1] '/': expected [2] arguments, received 1 diff --git a/tests/math/division/bad_arity_three.neb b/tests/math/division/bad_arity_three.neb new file mode 100644 index 0000000..34f7313 --- /dev/null +++ b/tests/math/division/bad_arity_three.neb @@ -0,0 +1,2 @@ +(/ 20 4 5) +; panic! [1] '/': expected [2] arguments, received 3 diff --git a/tests/math/division/bad_arity_zero.neb b/tests/math/division/bad_arity_zero.neb new file mode 100644 index 0000000..c5c47c3 --- /dev/null +++ b/tests/math/division/bad_arity_zero.neb @@ -0,0 +1,2 @@ +(/) +; panic! [1] '/': expected [2] arguments, received 0 diff --git a/tests/math/division/bad_type_bool.neb b/tests/math/division/bad_type_bool.neb new file mode 100644 index 0000000..ad15afe --- /dev/null +++ b/tests/math/division/bad_type_bool.neb @@ -0,0 +1,2 @@ +(/ 7.34 #true) +; panic! [1] '/': received :bool, expected :number (got #true) diff --git a/tests/math/division/bad_type_list.neb b/tests/math/division/bad_type_list.neb new file mode 100644 index 0000000..e394b7b --- /dev/null +++ b/tests/math/division/bad_type_list.neb @@ -0,0 +1,2 @@ +(/ 4 (list "hello")) +; panic! [1] '/': received :list, expected :number (got ("hello")) diff --git a/tests/math/division/bad_type_string.neb b/tests/math/division/bad_type_string.neb new file mode 100644 index 0000000..11f236e --- /dev/null +++ b/tests/math/division/bad_type_string.neb @@ -0,0 +1,2 @@ +(/ 3 "hello") +; panic! [1] '/': received :string, expected :number (got "hello") diff --git a/tests/math/division/bad_type_type.neb b/tests/math/division/bad_type_type.neb new file mode 100644 index 0000000..c008850 --- /dev/null +++ b/tests/math/division/bad_type_type.neb @@ -0,0 +1,2 @@ +(/ .4 :string) +; panic! [1] '/': received :type, expected :number (got :string) diff --git a/tests/math/division/happy.neb b/tests/math/division/happy.neb new file mode 100644 index 0000000..dc0692d --- /dev/null +++ b/tests/math/division/happy.neb @@ -0,0 +1,8 @@ +(print + (concat + (->string (/ 20 5)) " " + (->string (/ 3.6 2)) " " + (->string (/ 4 2.5)) " " + (->string (/ 1.1 4.4)))) + +; 4 1.8 1.6 0.25 diff --git a/tests/math/floor/bad_arity_two.neb b/tests/math/floor/bad_arity_two.neb new file mode 100644 index 0000000..2968901 --- /dev/null +++ b/tests/math/floor/bad_arity_two.neb @@ -0,0 +1,2 @@ +(floor 20 4) +; panic! [1] 'floor': expected [1] arguments, received 2 diff --git a/tests/math/floor/bad_arity_zero.neb b/tests/math/floor/bad_arity_zero.neb new file mode 100644 index 0000000..cc21ccc --- /dev/null +++ b/tests/math/floor/bad_arity_zero.neb @@ -0,0 +1,2 @@ +(floor) +; panic! [1] 'floor': expected [1] arguments, received 0 diff --git a/tests/math/floor/bad_type_bool.neb b/tests/math/floor/bad_type_bool.neb new file mode 100644 index 0000000..4404bfc --- /dev/null +++ b/tests/math/floor/bad_type_bool.neb @@ -0,0 +1,2 @@ +(floor #true) +; panic! [1] 'floor': received :bool, expected :number (got #true) diff --git a/tests/math/floor/bad_type_list.neb b/tests/math/floor/bad_type_list.neb new file mode 100644 index 0000000..a0d3b3b --- /dev/null +++ b/tests/math/floor/bad_type_list.neb @@ -0,0 +1,2 @@ +(floor (list "hello")) +; panic! [1] 'floor': received :list, expected :number (got ("hello")) diff --git a/tests/math/floor/bad_type_string.neb b/tests/math/floor/bad_type_string.neb new file mode 100644 index 0000000..c1abd33 --- /dev/null +++ b/tests/math/floor/bad_type_string.neb @@ -0,0 +1,2 @@ +(floor "hello") +; panic! [1] 'floor': received :string, expected :number (got "hello") diff --git a/tests/math/floor/bad_type_type.neb b/tests/math/floor/bad_type_type.neb new file mode 100644 index 0000000..d5383cf --- /dev/null +++ b/tests/math/floor/bad_type_type.neb @@ -0,0 +1,2 @@ +(floor :string) +; panic! [1] 'floor': received :type, expected :number (got :string) diff --git a/tests/math/floor/happy.neb b/tests/math/floor/happy.neb new file mode 100644 index 0000000..7fda23e --- /dev/null +++ b/tests/math/floor/happy.neb @@ -0,0 +1,7 @@ +(print + (concat + (->string (floor 5)) " " + (->string (floor 3.6)) " " + (->string (floor 2.5)))) + +; 5 3 2 diff --git a/tests/math/greaterthan/bad_arity_one.neb b/tests/math/greaterthan/bad_arity_one.neb new file mode 100644 index 0000000..08c456a --- /dev/null +++ b/tests/math/greaterthan/bad_arity_one.neb @@ -0,0 +1,2 @@ +(> 7) +; panic! [1] '>': expected [2] arguments, received 1 diff --git a/tests/math/greaterthan/bad_arity_three.neb b/tests/math/greaterthan/bad_arity_three.neb new file mode 100644 index 0000000..039cf79 --- /dev/null +++ b/tests/math/greaterthan/bad_arity_three.neb @@ -0,0 +1,2 @@ +(> 20 4 5) +; panic! [1] '>': expected [2] arguments, received 3 diff --git a/tests/math/greaterthan/bad_arity_zero.neb b/tests/math/greaterthan/bad_arity_zero.neb new file mode 100644 index 0000000..8ca1597 --- /dev/null +++ b/tests/math/greaterthan/bad_arity_zero.neb @@ -0,0 +1,2 @@ +(>) +; panic! [1] '>': expected [2] arguments, received 0 diff --git a/tests/math/greaterthan/bad_type_bool.neb b/tests/math/greaterthan/bad_type_bool.neb new file mode 100644 index 0000000..2907546 --- /dev/null +++ b/tests/math/greaterthan/bad_type_bool.neb @@ -0,0 +1,2 @@ +(> 7.34 #true) +; panic! [1] '>': received :bool, expected :number (got #true) diff --git a/tests/math/greaterthan/bad_type_list.neb b/tests/math/greaterthan/bad_type_list.neb new file mode 100644 index 0000000..f24a46c --- /dev/null +++ b/tests/math/greaterthan/bad_type_list.neb @@ -0,0 +1,2 @@ +(> 4 (list "hello")) +; panic! [1] '>': received :list, expected :number (got ("hello")) diff --git a/tests/math/greaterthan/bad_type_string.neb b/tests/math/greaterthan/bad_type_string.neb new file mode 100644 index 0000000..e1f8e15 --- /dev/null +++ b/tests/math/greaterthan/bad_type_string.neb @@ -0,0 +1,2 @@ +(> 3 "hello") +; panic! [1] '>': received :string, expected :number (got "hello") diff --git a/tests/math/greaterthan/bad_type_type.neb b/tests/math/greaterthan/bad_type_type.neb new file mode 100644 index 0000000..3fe2e5b --- /dev/null +++ b/tests/math/greaterthan/bad_type_type.neb @@ -0,0 +1,2 @@ +(> .4 :string) +; panic! [1] '>': received :type, expected :number (got :string) diff --git a/tests/math/greaterthan/happy.neb b/tests/math/greaterthan/happy.neb new file mode 100644 index 0000000..e195b7e --- /dev/null +++ b/tests/math/greaterthan/happy.neb @@ -0,0 +1,9 @@ +(print + (concat + (->string (> 20 5)) " " + (->string (> 3.6 2)) " " + (->string (> 1 2.5)) " " + (->string (> 5 5)) " " + (->string (> 1.1 4.4)))) + +; #true #true #false #false #false diff --git a/tests/math/greaterthanequal/bad_arity_one.neb b/tests/math/greaterthanequal/bad_arity_one.neb new file mode 100644 index 0000000..4de4de8 --- /dev/null +++ b/tests/math/greaterthanequal/bad_arity_one.neb @@ -0,0 +1,2 @@ +(>= 7) +; panic! [1] '>=': expected [2] arguments, received 1 diff --git a/tests/math/greaterthanequal/bad_arity_three.neb b/tests/math/greaterthanequal/bad_arity_three.neb new file mode 100644 index 0000000..20861f1 --- /dev/null +++ b/tests/math/greaterthanequal/bad_arity_three.neb @@ -0,0 +1,2 @@ +(>= 20 4 5) +; panic! [1] '>=': expected [2] arguments, received 3 diff --git a/tests/math/greaterthanequal/bad_arity_zero.neb b/tests/math/greaterthanequal/bad_arity_zero.neb new file mode 100644 index 0000000..56c08ac --- /dev/null +++ b/tests/math/greaterthanequal/bad_arity_zero.neb @@ -0,0 +1,2 @@ +(>=) +; panic! [1] '>=': expected [2] arguments, received 0 diff --git a/tests/math/greaterthanequal/bad_type_bool.neb b/tests/math/greaterthanequal/bad_type_bool.neb new file mode 100644 index 0000000..3fd50e2 --- /dev/null +++ b/tests/math/greaterthanequal/bad_type_bool.neb @@ -0,0 +1,2 @@ +(>= 7.34 #true) +; panic! [1] '>=': received :bool, expected :number (got #true) diff --git a/tests/math/greaterthanequal/bad_type_list.neb b/tests/math/greaterthanequal/bad_type_list.neb new file mode 100644 index 0000000..b7b9cf8 --- /dev/null +++ b/tests/math/greaterthanequal/bad_type_list.neb @@ -0,0 +1,2 @@ +(>= 4 (list "hello")) +; panic! [1] '>=': received :list, expected :number (got ("hello")) diff --git a/tests/math/greaterthanequal/bad_type_string.neb b/tests/math/greaterthanequal/bad_type_string.neb new file mode 100644 index 0000000..10fdaea --- /dev/null +++ b/tests/math/greaterthanequal/bad_type_string.neb @@ -0,0 +1,2 @@ +(>= 3 "hello") +; panic! [1] '>=': received :string, expected :number (got "hello") diff --git a/tests/math/greaterthanequal/bad_type_type.neb b/tests/math/greaterthanequal/bad_type_type.neb new file mode 100644 index 0000000..ae5b166 --- /dev/null +++ b/tests/math/greaterthanequal/bad_type_type.neb @@ -0,0 +1,2 @@ +(>= .4 :string) +; panic! [1] '>=': received :type, expected :number (got :string) diff --git a/tests/math/greaterthanequal/happy.neb b/tests/math/greaterthanequal/happy.neb new file mode 100644 index 0000000..16d3c66 --- /dev/null +++ b/tests/math/greaterthanequal/happy.neb @@ -0,0 +1,10 @@ +(print + (concat + (->string (>= 20 5)) " " + (->string (>= 3.6 2)) " " + (->string (>= 1 2.5)) " " + (->string (>= 5 5)) " " + (->string (>= 45 45.0)) " " + (->string (>= 1.1 4.4)))) + +; #true #true #false #true #true #false diff --git a/tests/math/lessthan/bad_arity_one.neb b/tests/math/lessthan/bad_arity_one.neb new file mode 100644 index 0000000..9e33b3e --- /dev/null +++ b/tests/math/lessthan/bad_arity_one.neb @@ -0,0 +1,2 @@ +(< 7) +; panic! [1] '<': expected [2] arguments, received 1 diff --git a/tests/math/lessthan/bad_arity_three.neb b/tests/math/lessthan/bad_arity_three.neb new file mode 100644 index 0000000..fedcbd2 --- /dev/null +++ b/tests/math/lessthan/bad_arity_three.neb @@ -0,0 +1,2 @@ +(< 20 4 5) +; panic! [1] '<': expected [2] arguments, received 3 diff --git a/tests/math/lessthan/bad_arity_zero.neb b/tests/math/lessthan/bad_arity_zero.neb new file mode 100644 index 0000000..64217c6 --- /dev/null +++ b/tests/math/lessthan/bad_arity_zero.neb @@ -0,0 +1,2 @@ +(<) +; panic! [1] '<': expected [2] arguments, received 0 diff --git a/tests/math/lessthan/bad_type_bool.neb b/tests/math/lessthan/bad_type_bool.neb new file mode 100644 index 0000000..b68fb9f --- /dev/null +++ b/tests/math/lessthan/bad_type_bool.neb @@ -0,0 +1,2 @@ +(< 7.34 #true) +; panic! [1] '<': received :bool, expected :number (got #true) diff --git a/tests/math/lessthan/bad_type_list.neb b/tests/math/lessthan/bad_type_list.neb new file mode 100644 index 0000000..7b1153c --- /dev/null +++ b/tests/math/lessthan/bad_type_list.neb @@ -0,0 +1,2 @@ +(< 4 (list "hello")) +; panic! [1] '<': received :list, expected :number (got ("hello")) diff --git a/tests/math/lessthan/bad_type_string.neb b/tests/math/lessthan/bad_type_string.neb new file mode 100644 index 0000000..b98f088 --- /dev/null +++ b/tests/math/lessthan/bad_type_string.neb @@ -0,0 +1,2 @@ +(< 3 "hello") +; panic! [1] '<': received :string, expected :number (got "hello") diff --git a/tests/math/lessthan/bad_type_type.neb b/tests/math/lessthan/bad_type_type.neb new file mode 100644 index 0000000..339d283 --- /dev/null +++ b/tests/math/lessthan/bad_type_type.neb @@ -0,0 +1,2 @@ +(< .4 :string) +; panic! [1] '<': received :type, expected :number (got :string) diff --git a/tests/math/lessthan/happy.neb b/tests/math/lessthan/happy.neb new file mode 100644 index 0000000..796a8f1 --- /dev/null +++ b/tests/math/lessthan/happy.neb @@ -0,0 +1,9 @@ +(print + (concat + (->string (< 20 5)) " " + (->string (< 3.6 2)) " " + (->string (< 1 2.5)) " " + (->string (< 5 5)) " " + (->string (< 1.1 4.4)))) + +; #false #false #true #false #true diff --git a/tests/math/lessthanequal/bad_arity_one.neb b/tests/math/lessthanequal/bad_arity_one.neb new file mode 100644 index 0000000..32bf4c1 --- /dev/null +++ b/tests/math/lessthanequal/bad_arity_one.neb @@ -0,0 +1,2 @@ +(<= 7) +; panic! [1] '<=': expected [2] arguments, received 1 diff --git a/tests/math/lessthanequal/bad_arity_three.neb b/tests/math/lessthanequal/bad_arity_three.neb new file mode 100644 index 0000000..2430b0f --- /dev/null +++ b/tests/math/lessthanequal/bad_arity_three.neb @@ -0,0 +1,2 @@ +(<= 20 4 5) +; panic! [1] '<=': expected [2] arguments, received 3 diff --git a/tests/math/lessthanequal/bad_arity_zero.neb b/tests/math/lessthanequal/bad_arity_zero.neb new file mode 100644 index 0000000..9130333 --- /dev/null +++ b/tests/math/lessthanequal/bad_arity_zero.neb @@ -0,0 +1,2 @@ +(<=) +; panic! [1] '<=': expected [2] arguments, received 0 diff --git a/tests/math/lessthanequal/bad_type_bool.neb b/tests/math/lessthanequal/bad_type_bool.neb new file mode 100644 index 0000000..6c68ead --- /dev/null +++ b/tests/math/lessthanequal/bad_type_bool.neb @@ -0,0 +1,2 @@ +(<= 7.34 #true) +; panic! [1] '<=': received :bool, expected :number (got #true) diff --git a/tests/math/lessthanequal/bad_type_list.neb b/tests/math/lessthanequal/bad_type_list.neb new file mode 100644 index 0000000..530c8cc --- /dev/null +++ b/tests/math/lessthanequal/bad_type_list.neb @@ -0,0 +1,2 @@ +(<= 4 (list "hello")) +; panic! [1] '<=': received :list, expected :number (got ("hello")) diff --git a/tests/math/lessthanequal/bad_type_string.neb b/tests/math/lessthanequal/bad_type_string.neb new file mode 100644 index 0000000..22b0360 --- /dev/null +++ b/tests/math/lessthanequal/bad_type_string.neb @@ -0,0 +1,2 @@ +(<= 3 "hello") +; panic! [1] '<=': received :string, expected :number (got "hello") diff --git a/tests/math/lessthanequal/bad_type_type.neb b/tests/math/lessthanequal/bad_type_type.neb new file mode 100644 index 0000000..7ebbe12 --- /dev/null +++ b/tests/math/lessthanequal/bad_type_type.neb @@ -0,0 +1,2 @@ +(<= .4 :string) +; panic! [1] '<=': received :type, expected :number (got :string) diff --git a/tests/math/lessthanequal/happy.neb b/tests/math/lessthanequal/happy.neb new file mode 100644 index 0000000..246f069 --- /dev/null +++ b/tests/math/lessthanequal/happy.neb @@ -0,0 +1,10 @@ +(print + (concat + (->string (<= 20 5)) " " + (->string (<= 3.6 2)) " " + (->string (<= 1 2.5)) " " + (->string (<= 5 5)) " " + (->string (<= 45 45.0)) " " + (->string (<= 1.1 4.4)))) + +; #false #false #true #true #true #true diff --git a/tests/math/multiplication/bad_arity_one.neb b/tests/math/multiplication/bad_arity_one.neb new file mode 100644 index 0000000..740725a --- /dev/null +++ b/tests/math/multiplication/bad_arity_one.neb @@ -0,0 +1,2 @@ +(* 7) +; panic! [1] '*': expected [2+] arguments, received 1 diff --git a/tests/math/multiplication/bad_arity_zero.neb b/tests/math/multiplication/bad_arity_zero.neb new file mode 100644 index 0000000..f1301ae --- /dev/null +++ b/tests/math/multiplication/bad_arity_zero.neb @@ -0,0 +1,2 @@ +(*) +; panic! [1] '*': expected [2+] arguments, received 0 diff --git a/tests/math/multiplication/bad_type_bool.neb b/tests/math/multiplication/bad_type_bool.neb new file mode 100644 index 0000000..5344e1a --- /dev/null +++ b/tests/math/multiplication/bad_type_bool.neb @@ -0,0 +1,2 @@ +(* 7.34 #true) +; panic! [1] '*': received :bool, expected :number (got #true) diff --git a/tests/math/multiplication/bad_type_list.neb b/tests/math/multiplication/bad_type_list.neb new file mode 100644 index 0000000..9bc8418 --- /dev/null +++ b/tests/math/multiplication/bad_type_list.neb @@ -0,0 +1,2 @@ +(* 4 (list "hello")) +; panic! [1] '*': received :list, expected :number (got ("hello")) diff --git a/tests/math/multiplication/bad_type_string.neb b/tests/math/multiplication/bad_type_string.neb new file mode 100644 index 0000000..ca9b70d --- /dev/null +++ b/tests/math/multiplication/bad_type_string.neb @@ -0,0 +1,2 @@ +(* 3 "hello") +; panic! [1] '*': received :string, expected :number (got "hello") diff --git a/tests/math/multiplication/bad_type_type.neb b/tests/math/multiplication/bad_type_type.neb new file mode 100644 index 0000000..4d0d2d1 --- /dev/null +++ b/tests/math/multiplication/bad_type_type.neb @@ -0,0 +1,2 @@ +(* .4 :string) +; panic! [1] '*': received :type, expected :number (got :string) diff --git a/tests/math/multiplication/happy.neb b/tests/math/multiplication/happy.neb new file mode 100644 index 0000000..8233975 --- /dev/null +++ b/tests/math/multiplication/happy.neb @@ -0,0 +1,9 @@ +(print + (concat + (->string (* 4 5)) " " + (->string (* 2.9 4)) " " + (->string (* 2 4.5)) " " + (->string (* 1.1 4.5)) " " + (->string (* 6 7 8 15)))) + +; 20 11.6 9.0 4.95 5040 diff --git a/tests/math/subtraction/bad_arity.neb b/tests/math/subtraction/bad_arity.neb new file mode 100644 index 0000000..4fd1a01 --- /dev/null +++ b/tests/math/subtraction/bad_arity.neb @@ -0,0 +1,2 @@ +(-) +; panic! [1] '-': expected [1+] arguments, received 0 diff --git a/tests/math/subtraction/bad_type_bool.neb b/tests/math/subtraction/bad_type_bool.neb new file mode 100644 index 0000000..64a8a7b --- /dev/null +++ b/tests/math/subtraction/bad_type_bool.neb @@ -0,0 +1,2 @@ +(- 7.34 #true) +; panic! [1] '-': received :bool, expected :number (got #true) diff --git a/tests/math/subtraction/bad_type_list.neb b/tests/math/subtraction/bad_type_list.neb new file mode 100644 index 0000000..e06685e --- /dev/null +++ b/tests/math/subtraction/bad_type_list.neb @@ -0,0 +1,2 @@ +(- 4 (list "hello")) +; panic! [1] '-': received :list, expected :number (got ("hello")) diff --git a/tests/math/subtraction/bad_type_string.neb b/tests/math/subtraction/bad_type_string.neb new file mode 100644 index 0000000..5685b59 --- /dev/null +++ b/tests/math/subtraction/bad_type_string.neb @@ -0,0 +1,2 @@ +(- 3 "hello") +; panic! [1] '-': received :string, expected :number (got "hello") diff --git a/tests/math/subtraction/bad_type_type.neb b/tests/math/subtraction/bad_type_type.neb new file mode 100644 index 0000000..7bb72aa --- /dev/null +++ b/tests/math/subtraction/bad_type_type.neb @@ -0,0 +1,2 @@ +(- .4 :string) +; panic! [1] '-': received :type, expected :number (got :string) diff --git a/tests/math/subtraction/happy.neb b/tests/math/subtraction/happy.neb new file mode 100644 index 0000000..035b83c --- /dev/null +++ b/tests/math/subtraction/happy.neb @@ -0,0 +1,10 @@ +(print + (concat + (->string (- 2)) " " + (->string (- 4 5)) " " + (->string (- .9)) " " + (->string (- 2.9 4)) " " + (->string (- 2 4.5)) " " + (->string (- 6 7 8 15)))) + +; -2 -1 -0.9 -1.1 -2.5 -24 diff --git a/tests/runner.bash b/tests/runner.bash new file mode 100755 index 0000000..32af554 --- /dev/null +++ b/tests/runner.bash @@ -0,0 +1,22 @@ +#!/bin/bash +passed=0 +total=0 +for item in $(find . -name *.neb) +do + expected=$(tail -1 $item | sed 's/; //') + actual=$(python3 ../neb.py $item) + if [[ "$expected" == "$actual" ]]; then + ((passed=passed+1)) + else + echo "$item... FAILED" + echo " Expected: $expected" + echo " Actual: $actual" + echo "" + fi + ((total=total+1)) +done + +pct=$(python -c "print('{:.2f}'.format($passed / float($total) * 100))") + +echo "Total: $total" +echo "Passed: $passed ($pct%)" |
