diff --git a/test/elf/test_hello.rb b/test/elf/test_hello.rb index b2e63ee5..0ab288e9 100644 --- a/test/elf/test_hello.rb +++ b/test/elf/test_hello.rb @@ -13,10 +13,8 @@ class HelloTest < MiniTest::Test end def test_string_put - @input = s(:statements, s(:class, :Space, s(:derives, nil), - s(:statements, s(:function, :Integer, s(:name, :main), s(:parameters), - s(:statements, s(:return, s(:call, s(:name, :putstring), s(:arguments), - s(:receiver, s(:string, "Hello again\\n"))))))))) + @input = s(:statements, s(:return, s(:call, s(:name, :putstring), s(:arguments), + s(:receiver, s(:string, "Hello again\\n"))))) check end end diff --git a/test/register/interpreter/test_add.rb b/test/register/interpreter/test_add.rb index 24c8ad6e..dac2d0db 100644 --- a/test/register/interpreter/test_add.rb +++ b/test/register/interpreter/test_add.rb @@ -11,7 +11,7 @@ class Space end end HERE - @input = s(:statements, s(:class, :Space, s(:derives, nil), s(:statements, s(:function, :Integer, s(:name, :main), s(:parameters), s(:statements, s(:return, s(:operator_value, :+, s(:int, 5), s(:int, 7)))))))) + @input = s(:statements, s(:return, s(:operator_value, :+, s(:int, 5), s(:int, 7)))) super end diff --git a/test/register/interpreter/test_change.rb b/test/register/interpreter/test_change.rb index 6856d28a..e60a1dcd 100644 --- a/test/register/interpreter/test_change.rb +++ b/test/register/interpreter/test_change.rb @@ -4,7 +4,7 @@ class AddChange < MiniTest::Test include Ticker def setup - @input = s(:statements, s(:class, :Space, s(:derives, nil), s(:statements, s(:function, :Integer, s(:name, :main), s(:parameters), s(:statements, s(:return, s(:operator_value, :+, s(:int, 5), s(:int, 7)))))))) + @input = s(:statements, s(:return, s(:operator_value, :+, s(:int, 5), s(:int, 7)))) @state_events = {} @instruction_events = [] super diff --git a/test/register/interpreter/test_get_byte.rb b/test/register/interpreter/test_get_byte.rb index fbc8cf89..2e715da7 100644 --- a/test/register/interpreter/test_get_byte.rb +++ b/test/register/interpreter/test_get_byte.rb @@ -11,12 +11,10 @@ class Space end end HERE - @input = s(:statements, s(:class, :Space, s(:derives, nil), s(:statements, - s(:function, :Integer, s(:name, :main), s(:parameters), - s(:statements, s(:call, - s(:name, :set_internal_byte), - s(:arguments, s(:int, 1), s(:int, 104)), - s(:receiver, s(:string, "Hello")))))))) + @input = s(:statements, s(:call, + s(:name, :set_internal_byte), + s(:arguments, s(:int, 1), s(:int, 104)), + s(:receiver, s(:string, "Hello")))) super end diff --git a/test/register/interpreter/test_if.rb b/test/register/interpreter/test_if.rb index 6154234c..9fabbfcb 100644 --- a/test/register/interpreter/test_if.rb +++ b/test/register/interpreter/test_if.rb @@ -2,6 +2,7 @@ require_relative "helper" class IfTest < MiniTest::Test include Ticker + include Compiling def setup @string_input = < :Integer} , + s(:statements, s(:if_statement, :zero, s(:condition, s(:operator_value, :-, s(:name, :n), s(:int, 12))), + s(:true_statements, s(:call, s(:name, :putstring), s(:arguments), s(:receiver, s(:string, "then")))), + s(:false_statements, s(:call, s(:name, :putstring), s(:arguments), s(:receiver, s(:string, "else")))))) + end def test_if #show_ticks # get output of what is check_chain ["Branch","Label","LoadConstant","GetSlot","SetSlot", diff --git a/test/register/interpreter/test_mult.rb b/test/register/interpreter/test_mult.rb index d2c8d3c4..0a7fc4ae 100644 --- a/test/register/interpreter/test_mult.rb +++ b/test/register/interpreter/test_mult.rb @@ -13,7 +13,7 @@ class Space end HERE - @input = s(:statements, s(:class, :Space, s(:derives, nil), s(:statements, s(:function, :Integer, s(:name, :main), s(:parameters), s(:statements, s(:return, s(:operator_value, :*, s(:int, 2147483648), s(:int, 2147483648)))))))) + @input = s(:statements, s(:return, s(:operator_value, :*, s(:int, 2147483648), s(:int, 2147483648)))) super end diff --git a/test/register/interpreter/test_plus.rb b/test/register/interpreter/test_plus.rb index 73e508ef..393098e4 100644 --- a/test/register/interpreter/test_plus.rb +++ b/test/register/interpreter/test_plus.rb @@ -11,7 +11,7 @@ class Space end end HERE - @input = s(:statements, s(:class, :Space, s(:derives, nil), s(:statements, s(:function, :Integer, s(:name, :main), s(:parameters), s(:statements, s(:return, s(:operator_value, :+, s(:int, 4611686018427387903), s(:int, 1)))))))) + @input = s(:statements, s(:return, s(:operator_value, :+, s(:int, 4611686018427387903), s(:int, 1)))) super end diff --git a/test/register/interpreter/test_puts.rb b/test/register/interpreter/test_puts.rb index 898c0157..641aa5f0 100644 --- a/test/register/interpreter/test_puts.rb +++ b/test/register/interpreter/test_puts.rb @@ -11,7 +11,7 @@ class Space end end HERE - @input = s(:statements, s(:class, :Space, s(:derives, nil), s(:statements, s(:function, :Integer, s(:name, :main), s(:parameters), s(:statements, s(:call, s(:name, :putstring), s(:arguments), s(:receiver, s(:string, "Hello again")))))))) + @input = s(:statements, s(:call, s(:name, :putstring), s(:arguments), s(:receiver, s(:string, "Hello again")))) super end diff --git a/test/register/interpreter/test_set_byte.rb b/test/register/interpreter/test_set_byte.rb index cc8d56e0..e5d8054c 100644 --- a/test/register/interpreter/test_set_byte.rb +++ b/test/register/interpreter/test_set_byte.rb @@ -11,12 +11,10 @@ class Space end end HERE - @input = s(:statements, s(:class, :Space, s(:derives, nil), s(:statements, - s(:function, :Integer, s(:name, :main), s(:parameters), - s(:statements, s(:call, - s(:name, :get_internal_byte), - s(:arguments, s(:int, 1)), - s(:receiver, s(:string, "Hello")))))))) + @input = s(:statements, s(:call, + s(:name, :get_internal_byte), + s(:arguments, s(:int, 1)), + s(:receiver, s(:string, "Hello")))) super end