diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-12-05 15:09:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-12-05 15:09:04 +0200 |
commit | 54870fb76b5f59cc2e6d69a8c7a8ef17853a0029 (patch) | |
tree | 770b01aa56348ec75f17fb834a2a7123ba9c3f73 /tests/eval/comp.test | |
parent | ef7cb7ea3e6fcb21a4fcf38602b3f43f03232ace (diff) |
Add comma, ternary, logical operators support in eval context
Diffstat (limited to 'tests/eval/comp.test')
-rw-r--r-- | tests/eval/comp.test | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/eval/comp.test b/tests/eval/comp.test new file mode 100644 index 0000000..4ef6c2d --- /dev/null +++ b/tests/eval/comp.test @@ -0,0 +1,47 @@ +# file : tests/eval/comp.test +# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +# Test comparison operators (eval-comp). + +.include ../common.test + +$* <'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' : gt-false +$* <'print (foo >= bar)' >'true' : gt-true +$* <'print (foo >= foo)' >'true' : gt-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 +} |