fix all tests to use space.main
This commit is contained in:
parent
afe16868b5
commit
c7d1f9ec99
@ -5,7 +5,7 @@ class AddTest < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
return 5 + 7
|
||||
end
|
||||
|
@ -5,7 +5,7 @@ class IfTest < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int itest(int n)
|
||||
if_zero( n - 12)
|
||||
"then".putstring()
|
||||
|
@ -6,7 +6,7 @@ class MultTest < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
return #{2**31} * #{2**31}
|
||||
end
|
||||
|
@ -5,7 +5,7 @@ class PlusTest < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
return #{2**62 - 1} + 1
|
||||
end
|
||||
|
@ -5,7 +5,7 @@ class TestPuts < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
"Hello again".putstring()
|
||||
end
|
||||
|
@ -20,11 +20,6 @@ module Register
|
||||
check
|
||||
end
|
||||
|
||||
def test_call_self_main
|
||||
@string_input = 'self.main()'
|
||||
check
|
||||
end
|
||||
|
||||
def test_call_main_string
|
||||
@string_input = 'main("1")'
|
||||
check
|
||||
|
@ -11,7 +11,7 @@ class Bar
|
||||
return 1
|
||||
end
|
||||
end
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
return 1
|
||||
end
|
||||
|
@ -5,7 +5,7 @@ class TestFunctions < MiniTest::Test
|
||||
|
||||
def test_functions
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
|
||||
int times(int a, int b)
|
||||
if_zero( b + 0)
|
||||
@ -35,7 +35,7 @@ HERE
|
||||
|
||||
def test_class_method
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
|
||||
int self.some()
|
||||
return 5
|
||||
@ -52,7 +52,7 @@ HERE
|
||||
|
||||
def test_class_method_fails
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
return Object.som()
|
||||
end
|
||||
|
@ -5,7 +5,7 @@ class TestHello < MiniTest::Test
|
||||
|
||||
def test_hello
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
"Hello Raisa, I am salama".putstring()
|
||||
end
|
||||
|
@ -5,7 +5,7 @@ class TestIf < MiniTest::Test
|
||||
|
||||
def test_if_plus
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int n = 10
|
||||
if_plus( n - 12)
|
||||
@ -22,7 +22,7 @@ HERE
|
||||
|
||||
def test_if_zero
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int n = 10
|
||||
if_zero(n - 10 )
|
||||
@ -39,7 +39,7 @@ HERE
|
||||
|
||||
def test_if_minus
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int itest(int n)
|
||||
if_minus( n - 12)
|
||||
"then".putstring()
|
||||
|
@ -10,7 +10,7 @@ class Integer
|
||||
return 1
|
||||
end
|
||||
end
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
42.putint()
|
||||
end
|
||||
|
@ -5,7 +5,7 @@ class TestRecursinveFibo < MiniTest::Test
|
||||
|
||||
def test_recursive_fibo
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int fibonaccir( int n )
|
||||
if_plus( n - 2 )
|
||||
int tmp
|
||||
|
@ -5,7 +5,7 @@ class TestReturn < MiniTest::Test
|
||||
|
||||
def test_return1
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
return 5
|
||||
end
|
||||
@ -17,7 +17,7 @@ HERE
|
||||
|
||||
def test_return2
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int foo(int x)
|
||||
return x
|
||||
end
|
||||
@ -33,7 +33,7 @@ HERE
|
||||
|
||||
def test_return3
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int foo(int x)
|
||||
int a = 5
|
||||
return a
|
||||
|
@ -5,7 +5,7 @@ class TestWhileFragment < MiniTest::Test
|
||||
|
||||
def fibo num
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int fibonaccit(int n)
|
||||
int a = 0
|
||||
int b = 1
|
||||
|
@ -6,12 +6,12 @@ class TestWord < MiniTest::Test
|
||||
|
||||
def test_word_new
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
Word self.new()
|
||||
return nil
|
||||
end
|
||||
end
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
Word w = Word.new()
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ class TestAssignStatement < MiniTest::Test
|
||||
|
||||
def test_assign_op
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int n = 10 + 1
|
||||
end
|
||||
@ -23,7 +23,7 @@ HERE
|
||||
|
||||
def test_assign_local
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int runner
|
||||
runner = 5
|
||||
@ -36,7 +36,7 @@ HERE
|
||||
|
||||
def test_assign_local_assign
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int runner = 5
|
||||
end
|
||||
@ -48,7 +48,7 @@ HERE
|
||||
|
||||
def test_assign_call
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int r = main()
|
||||
end
|
||||
@ -62,7 +62,7 @@ HERE
|
||||
|
||||
def test_frame_get
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int r = 5
|
||||
return r
|
||||
@ -80,7 +80,7 @@ HERE
|
||||
def test_assign_arg
|
||||
Register.machine.space.get_main.arguments.push Parfait::Variable.new(:Integer , :blar)
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main(int blar)
|
||||
blar = 5
|
||||
end
|
||||
@ -95,7 +95,7 @@ HERE
|
||||
|
||||
def test_assign_int
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int r = 5
|
||||
end
|
||||
@ -112,7 +112,7 @@ HERE
|
||||
# have to define bar externally, just because redefining main. Otherwise that would be automatic
|
||||
Register.machine.space.get_main.arguments.push Parfait::Variable.new(:Integer , :balr)
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main(int balr)
|
||||
return balr
|
||||
end
|
||||
|
@ -11,7 +11,7 @@ class Integer
|
||||
return 1
|
||||
end
|
||||
end
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
42.putint()
|
||||
end
|
||||
@ -31,7 +31,7 @@ class Word
|
||||
return 1
|
||||
end
|
||||
end
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
"Hello".putstring()
|
||||
end
|
||||
@ -50,7 +50,7 @@ class Integer
|
||||
return 1
|
||||
end
|
||||
end
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int testi = 20
|
||||
testi.putint()
|
||||
@ -71,7 +71,7 @@ class List < Object
|
||||
return 1
|
||||
end
|
||||
end
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
List test_l
|
||||
test_l.add()
|
||||
@ -86,7 +86,7 @@ HERE
|
||||
|
||||
def test_call_puts
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int puts(Word str)
|
||||
return str
|
||||
end
|
||||
|
@ -11,7 +11,7 @@ class Bar
|
||||
return 1
|
||||
end
|
||||
end
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
return 1
|
||||
end
|
||||
@ -28,7 +28,7 @@ class Bar
|
||||
return 1
|
||||
end
|
||||
end
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
return Bar.buh()
|
||||
end
|
||||
@ -42,7 +42,7 @@ HERE
|
||||
|
||||
def test_class_field_value
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
field int boo1 = 1
|
||||
int main()
|
||||
return 1
|
||||
@ -55,7 +55,7 @@ HERE
|
||||
|
||||
def test_class_field
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
field int boo2
|
||||
int main()
|
||||
return self.boo2
|
||||
|
@ -7,7 +7,7 @@ module Register
|
||||
|
||||
def test_field_frame
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
Message m
|
||||
return m.name
|
||||
@ -20,7 +20,7 @@ HERE
|
||||
|
||||
def test_field_arg
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int get_name(Message main)
|
||||
return main.name
|
||||
end
|
||||
@ -39,7 +39,7 @@ HERE
|
||||
|
||||
def test_self_field
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
Layout l = self.layout
|
||||
return 1
|
||||
@ -53,7 +53,7 @@ HERE
|
||||
|
||||
def test_message_field
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
Word name = message.name
|
||||
return name
|
||||
|
@ -6,7 +6,7 @@ class TestIfStatement < MiniTest::Test
|
||||
|
||||
def test_if_basicr
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
if_plus( 10 - 12)
|
||||
return 3
|
||||
@ -25,7 +25,7 @@ HERE
|
||||
|
||||
def test_if_small_minus
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
if_minus( 10 - 12)
|
||||
return 3
|
||||
@ -41,7 +41,7 @@ HERE
|
||||
|
||||
def test_if_small_zero
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
if_zero( 10 - 12)
|
||||
return 3
|
||||
|
@ -7,7 +7,7 @@ class TestReturnStatement < MiniTest::Test
|
||||
|
||||
def test_return_int
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
return 5
|
||||
end
|
||||
@ -19,7 +19,7 @@ HERE
|
||||
|
||||
def test_return_local
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int runner
|
||||
return runner
|
||||
@ -32,7 +32,7 @@ HERE
|
||||
|
||||
def test_return_local_assign
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int runner = 5
|
||||
return runner
|
||||
@ -46,7 +46,7 @@ HERE
|
||||
|
||||
def pest_return_space_length # need to add runtime first
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
|
||||
int main()
|
||||
Layout l = space.get_layout()
|
||||
@ -60,7 +60,7 @@ HERE
|
||||
|
||||
def test_return_call
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
return main()
|
||||
end
|
||||
|
@ -7,7 +7,7 @@ module Register
|
||||
|
||||
def test_while_mini
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
while_plus(1)
|
||||
return 3
|
||||
@ -22,7 +22,7 @@ HERE
|
||||
|
||||
def test_while_assign
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int n = 5
|
||||
while_plus(n)
|
||||
@ -41,7 +41,7 @@ HERE
|
||||
|
||||
def test_while_return
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
class Space
|
||||
int main()
|
||||
int n = 10
|
||||
while_plus( n - 5)
|
||||
|
Loading…
Reference in New Issue
Block a user