Skip to content

Commit

Permalink
fixed unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drkameleon committed Oct 15, 2024
1 parent db7953c commit 5d8a4b6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 80 deletions.
10 changes: 4 additions & 6 deletions tests/unittests/branching.art
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ print "---"

g: function [x][
print "in g"
if? x<5 [
switch x<5 [
print "x<5"
return x
print "after return - ERROR"
]
else [
][
print "x>=5"
return 2*x
print "after return - ERROR"
Expand All @@ -45,12 +44,11 @@ print "---"
h: function [z][
print "in h"
if? z<5 [
switch z<5 [
print "z<5"
return z
print "after return - ERROR"
]
else [
][
if z=5 [
print "z=5"
return 3*z
Expand Down
61 changes: 0 additions & 61 deletions tests/unittests/evaluator.art
Original file line number Diff line number Diff line change
Expand Up @@ -2271,67 +2271,6 @@ supersection "OPTIMIZATIONS"
; print
; end
;*****************************************************************
topic "if?-else"
;*****************************************************************
byteCode [
if? x [return true]
else [return false]
]
; ================================
; DATA
; ================================
; 0: x :word
; ================================
; CODE
; ================================
; load0
; jmpifnot @4
; constbt
; return
; goto @2
; constbf
; return
; end
byteCode [
print "before"
if? a <> 1 + 2 [print "here", return true]
else [print "there", return false]
print "after"
]
; ================================
; DATA
; ================================
; 0: before :string
; 1: a :word
; 2: here :string
; 3: there :string
; 4: after :string

; ================================
; CODE
; ================================
; push0
; print
; consti3
; load1
; jmpifeq @6
; push2
; print
; constbt
; return
; goto @4
; push3
; print
; constbf
; return
; push4
; print
; end

;*****************************************************************
topic "switch (`?`)"
;*****************************************************************
Expand Down
13 changes: 0 additions & 13 deletions tests/unittests/evaluator.res
Original file line number Diff line number Diff line change
Expand Up @@ -734,19 +734,6 @@
code: [32 189 3 65 211 4 34 189 22 167 35 189 223] (13 bytes)


>--------------------------------------------------
> if?-else
>--------------------------------------------------

input: [if? x [return true] else [return false]]
data: [x]
code: [64 199 4 21 167 216 2 22 167 223] (10 bytes)

input: [print "before" if? a <> 1 + 2 [print "here" return true] else [print "there" return false] print "after"]
data: [before a here there after]
code: [32 189 4 65 201 6 34 189 21 167 216 4 35 189 22 167 36 189 223] (19 bytes)


>--------------------------------------------------
> switch (`?`)
>--------------------------------------------------
Expand Down

0 comments on commit 5d8a4b6

Please sign in to comment.