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 «»
|
||||
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
|
||||
|
||||
stack
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,8 +10,10 @@ require_relative '../lib/runner'
|
|||
|
||||
class TestParser < Test::Unit::TestCase
|
||||
def test_eval
|
||||
stack, _dico = Rpn::Core::Program.eval( [{ value: '« 2 dup * »', type: :program }], Rpn::Dictionary.new )
|
||||
assert_equal [{ value: 4, type: :numeric }],
|
||||
stack = Rpn::Core::Program.eval( [{ value: '« 2 dup * dup »', type: :program }], Rpn::Dictionary.new )
|
||||
|
||||
assert_equal [{ value: 4, type: :numeric },
|
||||
{ value: 4, type: :numeric }],
|
||||
stack
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue