From 5d8a4b6d54747a848924f08dcbd8f15090274167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yanis=20Zafir=C3=B3pulos?= <1265028+drkameleon@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:06:52 +0200 Subject: [PATCH] fixed unit-tests --- tests/unittests/branching.art | 10 +++--- tests/unittests/evaluator.art | 61 ----------------------------------- tests/unittests/evaluator.res | 13 -------- 3 files changed, 4 insertions(+), 80 deletions(-) diff --git a/tests/unittests/branching.art b/tests/unittests/branching.art index 4610e6961a..7fd48946c5 100644 --- a/tests/unittests/branching.art +++ b/tests/unittests/branching.art @@ -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" @@ -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 diff --git a/tests/unittests/evaluator.art b/tests/unittests/evaluator.art index 7b5230c0b2..241ecfdb3e 100644 --- a/tests/unittests/evaluator.art +++ b/tests/unittests/evaluator.art @@ -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 (`?`)" ;***************************************************************** diff --git a/tests/unittests/evaluator.res b/tests/unittests/evaluator.res index e8e6f92aef..e278c71964 100644 --- a/tests/unittests/evaluator.res +++ b/tests/unittests/evaluator.res @@ -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 (`?`) >--------------------------------------------------