aboutsummaryrefslogtreecommitdiff
path: root/tests/eval/comp.testscript
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-09-03 16:37:32 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2018-09-04 16:29:59 +0300
commit5007870b52aa549971824959a55ad3bb886f09e0 (patch)
treeb0ef7f24c0b9ece2ed23f3c1792f16da324e4171 /tests/eval/comp.testscript
parent09d60452a80d14d9b8bf3a9395860b50683fa1e8 (diff)
Rename .test/test{} to .testscript/testscript{}
Diffstat (limited to 'tests/eval/comp.testscript')
-rw-r--r--tests/eval/comp.testscript47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/eval/comp.testscript b/tests/eval/comp.testscript
new file mode 100644
index 0000000..481c50b
--- /dev/null
+++ b/tests/eval/comp.testscript
@@ -0,0 +1,47 @@
+# file : tests/eval/comp.testscript
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# Test comparison operators (eval-comp).
+
+.include ../common.testscript
+
+$* <'print (foo == bar)' >'false' : eq-false
+$* <'print (foo == foo)' >'true' : eq-true
+
+$* <'print (foo != foo)' >'false' : ne-false
+$* <'print (foo != bar)' >'true' : ne-true
+
+$* <'print (foo < bar)' >'false' : lt-false
+$* <'print (bar < foo)' >'true' : lt-true
+
+$* <'print (bar > foo)' >'false' : gt-false
+$* <'print (foo > bar)' >'true' : gt-true
+
+$* <'print (foo <= bar)' >'false' : le-false
+$* <'print (bar <= foo)' >'true' : le-true
+$* <'print (bar <= bar)' >'true' : le-true-eq
+
+$* <'print (bar >= foo)' >'false' : ge-false
+$* <'print (foo >= bar)' >'true' : ge-true
+$* <'print (foo >= foo)' >'true' : ge-true-eq
+
+: associativity
+:
+$* <'print (foo == bar == false)' >'true'
+
+: type
+:
+{
+ $* <'print ((foo bar) == foo bar)' >'true' : untyped-list
+ $* <'print ("" == "")' >'true' : untyped-empty
+
+ $* <'print (0 < 00)' >'true' : untyped-untyped
+ $* <'print (0 < [null])' >'false' : untyped-null
+ $* <'print ([uint64] 00 < 0)' >'false' : uint64-untyped
+ $* <'print ([uint64] 00 < [null])' >'false' : uint64-null
+ $* <'print ([uint64] 00 < [uint64] 0)' >'false' : uint64-uint64
+ $* <'print ([uint64] 00 < [string] 0)' 2>>EOE != 0 : uint64-string
+ <stdin>:1:20: error: comparison between uint64 and string
+ EOE
+}