change test framework to use files for in and out (s-exp)
This commit is contained in:
34
test/cases/while/big_while.tst
Normal file
34
test/cases/while/big_while.tst
Normal file
@ -0,0 +1,34 @@
|
||||
while( n > 1)
|
||||
tmp = a
|
||||
a = b
|
||||
b = tmp + b
|
||||
puts(b)
|
||||
n = n - 1
|
||||
end
|
||||
-- -- --
|
||||
s(:list, [s(:while,
|
||||
s(:condition,
|
||||
s(:operator, ">",
|
||||
s(:name, "n"),
|
||||
s(:int, 1))),
|
||||
s(:expressions,
|
||||
s(:assign,
|
||||
s(:name, "tmp"),
|
||||
s(:name, "a")),
|
||||
s(:assign,
|
||||
s(:name, "a"),
|
||||
s(:name, "b")),
|
||||
s(:assign,
|
||||
s(:name, "b"),
|
||||
s(:operator, "+",
|
||||
s(:name, "tmp"),
|
||||
s(:name, "b"))),
|
||||
s(:call,
|
||||
s(:name, "puts"),
|
||||
s(:arguments,
|
||||
s(:name, "b"))),
|
||||
s(:assign,
|
||||
s(:name, "n"),
|
||||
s(:operator, "-",
|
||||
s(:name, "n"),
|
||||
s(:int, 1)))))])
|
16
test/cases/while/while.tst
Normal file
16
test/cases/while/while.tst
Normal file
@ -0,0 +1,16 @@
|
||||
while(1)
|
||||
tmp = a
|
||||
puts(b)
|
||||
end
|
||||
-- -- --
|
||||
s(:list, [s(:while,
|
||||
s(:condition,
|
||||
s(:int, 1)),
|
||||
s(:expressions,
|
||||
s(:assign,
|
||||
s(:name, "tmp"),
|
||||
s(:name, "a")),
|
||||
s(:call,
|
||||
s(:name, "puts"),
|
||||
s(:arguments,
|
||||
s(:name, "b")))))])
|
22
test/cases/while/while_method.tst
Normal file
22
test/cases/while/while_method.tst
Normal file
@ -0,0 +1,22 @@
|
||||
while(1)
|
||||
tmp = String.new()
|
||||
tmp.puts(i)
|
||||
end
|
||||
-- -- --
|
||||
s(:list, [s(:while,
|
||||
s(:condition,
|
||||
s(:int, 1)),
|
||||
s(:expressions,
|
||||
s(:assign,
|
||||
s(:name, "tmp"),
|
||||
s(:call,
|
||||
s(:name, "new"),
|
||||
s(:arguments),
|
||||
s(:receiver,
|
||||
s(:module, "String")))),
|
||||
s(:call,
|
||||
s(:name, "puts"),
|
||||
s(:arguments,
|
||||
s(:name, "i")),
|
||||
s(:receiver,
|
||||
s(:name, "tmp")))))])
|
Reference in New Issue
Block a user