add decent method to get the programs return to interpreter

only had such methods in tests, but they really belong in code
also adding fake values to true ,false and nil
This commit is contained in:
2020-03-28 18:39:49 +02:00
parent 8fa00d1413
commit 8dfcc0f5de
5 changed files with 35 additions and 4 deletions

View File

@ -54,5 +54,20 @@ module Parfait
assert_equal 33 , addr.value
end
end
class TrueTest < MiniTest::Test
def test_true
assert TrueClass.new
end
def test_set
tru = TrueClass.new
assert_equal 20 , tru.set_internal_word( Integer.integer_index , 20 )
assert_equal 20 , tru.get_internal_word( Integer.integer_index )
end
def test_get_true
assert_equal 1 , TrueClass.new.get_internal_word( Integer.integer_index )
end
def test_get_false
assert_equal 0 , FalseClass.new.get_internal_word( Integer.integer_index )
end
end
end