Skip to content

Commit

Permalink
More test coverage for expressions.
Browse files Browse the repository at this point in the history
  • Loading branch information
kilobyte committed Sep 21, 2023
1 parent b9c8600 commit f21254b
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/data/eval.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#var pi 3.14
#var symb pi
#ali m {#math x {$0};#show {$0 ⇒ $x}}
m -3 * -3
m -(3) * -(3)
m -(2+1)*-(2+1)
m - 3
m !3
m !0
m ! 3
m ! 0
m !(3)
m !(0)
m F
m T
m $
m $pi
m ${$symb}
m 1<2
m 1>2
m 1<=2
m 1>=2
m 1=2
m 1!=2
m 1&2
m 1&&2
m 1|1
m 1||1
#if {0} {#show if} #elif {1} #show elif
26 changes: 26 additions & 0 deletions tests/data/eval.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-3 * -3 ⇒ 9
-(3) * -(3) ⇒ 9
-(2+1)*-(2+1) ⇒ 9
- 3 ⇒ -3
!3 ⇒ 0
!0 ⇒ 1
! 3 ⇒ 0
! 0 ⇒ 1
!(3) ⇒ 0
!(0) ⇒ 1
F ⇒ 0
T ⇒ 1
$ ⇒ 0
3.14 ⇒ 3.14
3.14 ⇒ 3.14
1<2 ⇒ 1
1>2 ⇒ 0
1<=2 ⇒ 1
1>=2 ⇒ 0
1=2 ⇒ 0
1!=2 ⇒ 1
1&2 ⇒ 1
1&&2 ⇒ 1
1|1 ⇒ 1
1||1 ⇒ 1
elif
12 changes: 12 additions & 0 deletions tests/data/stringcmp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ali m {#if {$0} {#show {✓ $0}} #else {#show ✗ $0}}
m [ ]
m [ 1 ]
m [ a b = a b ]
m [ a b = a c ]
m [ x != x ]
m [ x == x ]
m [ x =~ x ]
m [ x =~ * ]
m [ x = * ]
m [ x !~ * ]
m [ x !~ y ]
13 changes: 13 additions & 0 deletions tests/data/stringcmp.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#Compare to what ? (only one var between [ ])
✗ [ ]
#Compare 1 to what ? (only one var between [ ])
✗ [ 1 ]
✓ [ a b = a b ]
✗ [ a b = a c ]
✗ [ x != x ]
✓ [ x == x ]
✓ [ x =~ x ]
✓ [ x =~ * ]
✗ [ x = * ]
✗ [ x !~ * ]
✓ [ x !~ y ]

0 comments on commit f21254b

Please sign in to comment.