Skip to content

Commit

Permalink
Fixed count_to_500.self test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bystroushaak committed Sep 25, 2019
1 parent 716a2ed commit 9aefa84
Showing 1 changed file with 4 additions and 33 deletions.
37 changes: 4 additions & 33 deletions tests/scripts/count_to_500.self
Original file line number Diff line number Diff line change
@@ -1,43 +1,14 @@
(|
init_true = (| true_mirror |
true_mirror: primitives mirrorOn: true.

true_mirror toSlot: 'ifTrue:' Add: (| :blck | blck value).
true_mirror toSlot: 'ifFalse:' Add: (| :blck | nil.).
).
init_false = (| false_mirror |
false_mirror: primitives mirrorOn: false.

false_mirror toSlot: 'ifTrue:' Add: (| :blck | nil).
false_mirror toSlot: 'ifFalse:' Add: (| :blck | blck value.).
).

init = (| block_traits_mirror. |
init_true.
init_false.

block_traits_mirror: primitives mirrorOn: block_traits.
block_traits_mirror toSlot: 'whileTrue:' Add: (| :blck |
self value ifFalse: [ ^nil ].
blck value.
^self whileTrue: blck.
).
).

test_while = (| i <- 0. |
[ i < 500 ] whileTrue: [
'i: ' print.
i asString print.
'\n' print.
# 'number of frames: ' print.
# primitives interpreter numberOfFrames asString print.
# '\n\n' print.
'number of frames: ' print.
primitives interpreter numberOfFrames asString print.
'\n\n' print.

i: i + 1.
].
).
test = (||
init.
test_while.
).
|) test.
|) test_while.

0 comments on commit 9aefa84

Please sign in to comment.