fix EVAL test
This commit is contained in:
parent
18131d462d
commit
cc99b517a7
2 changed files with 6 additions and 3 deletions
|
@ -10,8 +10,9 @@ module Rpn
|
||||||
# we trim enclosing «»
|
# we trim enclosing «»
|
||||||
parsed_input = Rpn::Parser.new.parse_input( args[0][:value][1..-2] )
|
parsed_input = Rpn::Parser.new.parse_input( args[0][:value][1..-2] )
|
||||||
|
|
||||||
stack, dictionary = Rpn::Runner.new.run_input( stack, dictionary, parsed_input )
|
stack, _dictionary = Rpn::Runner.new.run_input( stack, dictionary, parsed_input )
|
||||||
# TODO: check that STO actually updates dictionary
|
# TODO: check that STO actually updates dictionary
|
||||||
|
|
||||||
stack
|
stack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,8 +10,10 @@ require_relative '../lib/runner'
|
||||||
|
|
||||||
class TestParser < Test::Unit::TestCase
|
class TestParser < Test::Unit::TestCase
|
||||||
def test_eval
|
def test_eval
|
||||||
stack, _dico = Rpn::Core::Program.eval( [{ value: '« 2 dup * »', type: :program }], Rpn::Dictionary.new )
|
stack = Rpn::Core::Program.eval( [{ value: '« 2 dup * dup »', type: :program }], Rpn::Dictionary.new )
|
||||||
assert_equal [{ value: 4, type: :numeric }],
|
|
||||||
|
assert_equal [{ value: 4, type: :numeric },
|
||||||
|
{ value: 4, type: :numeric }],
|
||||||
stack
|
stack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue