new tests
This commit is contained in:
parent
a2fb31ab5a
commit
2a04b62f45
45 changed files with 97 additions and 0 deletions
1
test/ruby/01.in
Normal file
1
test/ruby/01.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
42
|
||||
1
test/ruby/01.out
Normal file
1
test/ruby/01.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
42
|
||||
1
test/ruby/02.in
Normal file
1
test/ruby/02.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
x
|
||||
1
test/ruby/02.out
Normal file
1
test/ruby/02.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
x
|
||||
1
test/ruby/03.in
Normal file
1
test/ruby/03.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
x = 5
|
||||
1
test/ruby/03.out
Normal file
1
test/ruby/03.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
x = 5
|
||||
1
test/ruby/04.in
Normal file
1
test/ruby/04.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
2 + 3
|
||||
1
test/ruby/04.out
Normal file
1
test/ruby/04.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
2 + 3
|
||||
1
test/ruby/05.in
Normal file
1
test/ruby/05.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
x = 2 + 3
|
||||
1
test/ruby/05.out
Normal file
1
test/ruby/05.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
x = 2 + 3
|
||||
2
test/ruby/06.in
Normal file
2
test/ruby/06.in
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
x = 5
|
||||
y = 10
|
||||
2
test/ruby/06.out
Normal file
2
test/ruby/06.out
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
x = 5
|
||||
y = 10
|
||||
1
test/ruby/07.in
Normal file
1
test/ruby/07.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
foo()
|
||||
1
test/ruby/07.out
Normal file
1
test/ruby/07.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
foo()
|
||||
1
test/ruby/08.in
Normal file
1
test/ruby/08.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
print(x, y)
|
||||
1
test/ruby/08.out
Normal file
1
test/ruby/08.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
print(x, y)
|
||||
2
test/ruby/09.in
Normal file
2
test/ruby/09.in
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
if x:
|
||||
y = 5
|
||||
3
test/ruby/09.out
Normal file
3
test/ruby/09.out
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
if x
|
||||
y = 5
|
||||
end
|
||||
4
test/ruby/10.in
Normal file
4
test/ruby/10.in
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
if x:
|
||||
y = 5
|
||||
else:
|
||||
y = 10
|
||||
5
test/ruby/10.out
Normal file
5
test/ruby/10.out
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
if x
|
||||
y = 5
|
||||
else
|
||||
y = 10
|
||||
end
|
||||
2
test/ruby/11.in
Normal file
2
test/ruby/11.in
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
for i in items:
|
||||
print(i)
|
||||
3
test/ruby/11.out
Normal file
3
test/ruby/11.out
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
for i in items
|
||||
print(i)
|
||||
end
|
||||
2
test/ruby/12.in
Normal file
2
test/ruby/12.in
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
while x:
|
||||
x = x - 1
|
||||
3
test/ruby/12.out
Normal file
3
test/ruby/12.out
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
while x
|
||||
x = x - 1
|
||||
end
|
||||
2
test/ruby/13.in
Normal file
2
test/ruby/13.in
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def add(a, b):
|
||||
return a + b
|
||||
3
test/ruby/13.out
Normal file
3
test/ruby/13.out
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
def add(a, b)
|
||||
return a + b
|
||||
end
|
||||
3
test/ruby/14.in
Normal file
3
test/ruby/14.in
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
if x:
|
||||
if y:
|
||||
z = 1
|
||||
5
test/ruby/14.out
Normal file
5
test/ruby/14.out
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
if x
|
||||
if y
|
||||
z = 1
|
||||
end
|
||||
end
|
||||
1
test/ruby/15.in
Normal file
1
test/ruby/15.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
[1, 2, 3]
|
||||
1
test/ruby/15.out
Normal file
1
test/ruby/15.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
[1, 2, 3]
|
||||
1
test/ruby/16.in
Normal file
1
test/ruby/16.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
obj.method()
|
||||
0
test/ruby/16.out
Normal file
0
test/ruby/16.out
Normal file
1
test/ruby/17.in
Normal file
1
test/ruby/17.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
lst[0]
|
||||
1
test/ruby/17.out
Normal file
1
test/ruby/17.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
lst[0]
|
||||
1
test/ruby/18.in
Normal file
1
test/ruby/18.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
"hello"
|
||||
1
test/ruby/18.out
Normal file
1
test/ruby/18.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
"hello"
|
||||
1
test/ruby/19.in
Normal file
1
test/ruby/19.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
x and y
|
||||
1
test/ruby/19.out
Normal file
1
test/ruby/19.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
x and y
|
||||
1
test/ruby/20.in
Normal file
1
test/ruby/20.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
not x
|
||||
1
test/ruby/20.out
Normal file
1
test/ruby/20.out
Normal file
|
|
@ -0,0 +1 @@
|
|||
not x
|
||||
4
test/ruby/21.in
Normal file
4
test/ruby/21.in
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
class Point:
|
||||
def __init__(self, x, y):
|
||||
self.x = x
|
||||
self.y = y
|
||||
6
test/ruby/21.out
Normal file
6
test/ruby/21.out
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class Point
|
||||
def initialize(x, y)
|
||||
@x = x
|
||||
@y = y
|
||||
end
|
||||
end
|
||||
3
test/ruby/22.in
Normal file
3
test/ruby/22.in
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
class Counter:
|
||||
def increment(self):
|
||||
self.count = self.count + 1
|
||||
5
test/ruby/22.out
Normal file
5
test/ruby/22.out
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class Counter
|
||||
def increment
|
||||
@count = @count + 1
|
||||
end
|
||||
end
|
||||
|
|
@ -26,5 +26,18 @@ for test in parser/*.in; do
|
|||
done
|
||||
echo "✓ All parser tests passed"
|
||||
|
||||
echo ""
|
||||
echo "=== Ruby output TESTS ==="
|
||||
for test in ruby/*.in; do
|
||||
name=$(basename "$test" .in)
|
||||
echo "Testing ruby output/$name..."
|
||||
|
||||
if ! ../build/py2rb < "$test" | diff - "ruby/${name}.out"; then
|
||||
echo "FAILED: ruby output/$name"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "✓ All ruby output tests passed"
|
||||
. .
|
||||
echo ""
|
||||
echo "SUCCESS: All tests passed"
|
||||
Loading…
Add table
Add a link
Reference in a new issue