test/interpreter_test.rb in mojikun-1.0.0 vs test/interpreter_test.rb in mojikun-1.0.1
- old
+ new
@@ -63,28 +63,31 @@
assert_equal 0, @interpreter.runtime.current_data
end
def test_eval_end_loop_node
- # so we enter the loop
+ # so we loop twice
ast = [Mojikun::ThumbsUpNode.new,
+ Mojikun::ThumbsUpNode.new,
+
Mojikun::LoopNode.new,
# move right once, increment, move left
Mojikun::PointRightNode.new,
Mojikun::ThumbsUpNode.new,
Mojikun::PointLeftNode.new,
# decrement so we leave the loop
Mojikun::ThumbsDownNode.new,
+
Mojikun::EndLoopNode.new,
# move right so we can see the 1 we did in the loop
Mojikun::PointRightNode.new,
]
@interpreter.evaluate(ast)
- assert_equal 1, @interpreter.runtime.current_data
+ assert_equal 2, @interpreter.runtime.current_data
end
def test_loop_map
ast = [Mojikun::LoopNode.new, Mojikun::EndLoopNode.new]