diff --git a/test/ruby/01.in b/test/ruby/01.in new file mode 100644 index 0000000..f70d7bb --- /dev/null +++ b/test/ruby/01.in @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/test/ruby/01.out b/test/ruby/01.out new file mode 100644 index 0000000..f70d7bb --- /dev/null +++ b/test/ruby/01.out @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/test/ruby/02.in b/test/ruby/02.in new file mode 100644 index 0000000..c1b0730 --- /dev/null +++ b/test/ruby/02.in @@ -0,0 +1 @@ +x \ No newline at end of file diff --git a/test/ruby/02.out b/test/ruby/02.out new file mode 100644 index 0000000..c1b0730 --- /dev/null +++ b/test/ruby/02.out @@ -0,0 +1 @@ +x \ No newline at end of file diff --git a/test/ruby/03.in b/test/ruby/03.in new file mode 100644 index 0000000..f428463 --- /dev/null +++ b/test/ruby/03.in @@ -0,0 +1 @@ +x = 5 \ No newline at end of file diff --git a/test/ruby/03.out b/test/ruby/03.out new file mode 100644 index 0000000..f428463 --- /dev/null +++ b/test/ruby/03.out @@ -0,0 +1 @@ +x = 5 \ No newline at end of file diff --git a/test/ruby/04.in b/test/ruby/04.in new file mode 100644 index 0000000..ab64bde --- /dev/null +++ b/test/ruby/04.in @@ -0,0 +1 @@ +2 + 3 \ No newline at end of file diff --git a/test/ruby/04.out b/test/ruby/04.out new file mode 100644 index 0000000..ab64bde --- /dev/null +++ b/test/ruby/04.out @@ -0,0 +1 @@ +2 + 3 \ No newline at end of file diff --git a/test/ruby/05.in b/test/ruby/05.in new file mode 100644 index 0000000..5b3f477 --- /dev/null +++ b/test/ruby/05.in @@ -0,0 +1 @@ +x = 2 + 3 \ No newline at end of file diff --git a/test/ruby/05.out b/test/ruby/05.out new file mode 100644 index 0000000..5b3f477 --- /dev/null +++ b/test/ruby/05.out @@ -0,0 +1 @@ +x = 2 + 3 \ No newline at end of file diff --git a/test/ruby/06.in b/test/ruby/06.in new file mode 100644 index 0000000..3a2decf --- /dev/null +++ b/test/ruby/06.in @@ -0,0 +1,2 @@ +x = 5 +y = 10 \ No newline at end of file diff --git a/test/ruby/06.out b/test/ruby/06.out new file mode 100644 index 0000000..3a2decf --- /dev/null +++ b/test/ruby/06.out @@ -0,0 +1,2 @@ +x = 5 +y = 10 \ No newline at end of file diff --git a/test/ruby/07.in b/test/ruby/07.in new file mode 100644 index 0000000..a57d168 --- /dev/null +++ b/test/ruby/07.in @@ -0,0 +1 @@ +foo() \ No newline at end of file diff --git a/test/ruby/07.out b/test/ruby/07.out new file mode 100644 index 0000000..a57d168 --- /dev/null +++ b/test/ruby/07.out @@ -0,0 +1 @@ +foo() \ No newline at end of file diff --git a/test/ruby/08.in b/test/ruby/08.in new file mode 100644 index 0000000..e1dca18 --- /dev/null +++ b/test/ruby/08.in @@ -0,0 +1 @@ +print(x, y) \ No newline at end of file diff --git a/test/ruby/08.out b/test/ruby/08.out new file mode 100644 index 0000000..e1dca18 --- /dev/null +++ b/test/ruby/08.out @@ -0,0 +1 @@ +print(x, y) \ No newline at end of file diff --git a/test/ruby/09.in b/test/ruby/09.in new file mode 100644 index 0000000..25d8bf3 --- /dev/null +++ b/test/ruby/09.in @@ -0,0 +1,2 @@ +if x: + y = 5 \ No newline at end of file diff --git a/test/ruby/09.out b/test/ruby/09.out new file mode 100644 index 0000000..79029c2 --- /dev/null +++ b/test/ruby/09.out @@ -0,0 +1,3 @@ +if x + y = 5 +end \ No newline at end of file diff --git a/test/ruby/10.in b/test/ruby/10.in new file mode 100644 index 0000000..a5a3317 --- /dev/null +++ b/test/ruby/10.in @@ -0,0 +1,4 @@ +if x: + y = 5 +else: + y = 10 \ No newline at end of file diff --git a/test/ruby/10.out b/test/ruby/10.out new file mode 100644 index 0000000..a0bd09b --- /dev/null +++ b/test/ruby/10.out @@ -0,0 +1,5 @@ +if x + y = 5 +else + y = 10 +end \ No newline at end of file diff --git a/test/ruby/11.in b/test/ruby/11.in new file mode 100644 index 0000000..0526925 --- /dev/null +++ b/test/ruby/11.in @@ -0,0 +1,2 @@ +for i in items: + print(i) \ No newline at end of file diff --git a/test/ruby/11.out b/test/ruby/11.out new file mode 100644 index 0000000..7c036de --- /dev/null +++ b/test/ruby/11.out @@ -0,0 +1,3 @@ +for i in items + print(i) +end \ No newline at end of file diff --git a/test/ruby/12.in b/test/ruby/12.in new file mode 100644 index 0000000..f9afc99 --- /dev/null +++ b/test/ruby/12.in @@ -0,0 +1,2 @@ +while x: + x = x - 1 \ No newline at end of file diff --git a/test/ruby/12.out b/test/ruby/12.out new file mode 100644 index 0000000..51cac14 --- /dev/null +++ b/test/ruby/12.out @@ -0,0 +1,3 @@ +while x + x = x - 1 +end \ No newline at end of file diff --git a/test/ruby/13.in b/test/ruby/13.in new file mode 100644 index 0000000..19cf2a0 --- /dev/null +++ b/test/ruby/13.in @@ -0,0 +1,2 @@ +def add(a, b): + return a + b \ No newline at end of file diff --git a/test/ruby/13.out b/test/ruby/13.out new file mode 100644 index 0000000..07e600c --- /dev/null +++ b/test/ruby/13.out @@ -0,0 +1,3 @@ +def add(a, b) + return a + b +end \ No newline at end of file diff --git a/test/ruby/14.in b/test/ruby/14.in new file mode 100644 index 0000000..d1f4866 --- /dev/null +++ b/test/ruby/14.in @@ -0,0 +1,3 @@ +if x: + if y: + z = 1 \ No newline at end of file diff --git a/test/ruby/14.out b/test/ruby/14.out new file mode 100644 index 0000000..a592792 --- /dev/null +++ b/test/ruby/14.out @@ -0,0 +1,5 @@ +if x + if y + z = 1 + end +end \ No newline at end of file diff --git a/test/ruby/15.in b/test/ruby/15.in new file mode 100644 index 0000000..6001c44 --- /dev/null +++ b/test/ruby/15.in @@ -0,0 +1 @@ +[1, 2, 3] \ No newline at end of file diff --git a/test/ruby/15.out b/test/ruby/15.out new file mode 100644 index 0000000..6001c44 --- /dev/null +++ b/test/ruby/15.out @@ -0,0 +1 @@ +[1, 2, 3] \ No newline at end of file diff --git a/test/ruby/16.in b/test/ruby/16.in new file mode 100644 index 0000000..0287d08 --- /dev/null +++ b/test/ruby/16.in @@ -0,0 +1 @@ +obj.method() \ No newline at end of file diff --git a/test/ruby/16.out b/test/ruby/16.out new file mode 100644 index 0000000..e69de29 diff --git a/test/ruby/17.in b/test/ruby/17.in new file mode 100644 index 0000000..101aa8f --- /dev/null +++ b/test/ruby/17.in @@ -0,0 +1 @@ +lst[0] \ No newline at end of file diff --git a/test/ruby/17.out b/test/ruby/17.out new file mode 100644 index 0000000..101aa8f --- /dev/null +++ b/test/ruby/17.out @@ -0,0 +1 @@ +lst[0] \ No newline at end of file diff --git a/test/ruby/18.in b/test/ruby/18.in new file mode 100644 index 0000000..84ed78b --- /dev/null +++ b/test/ruby/18.in @@ -0,0 +1 @@ +"hello" \ No newline at end of file diff --git a/test/ruby/18.out b/test/ruby/18.out new file mode 100644 index 0000000..84ed78b --- /dev/null +++ b/test/ruby/18.out @@ -0,0 +1 @@ +"hello" \ No newline at end of file diff --git a/test/ruby/19.in b/test/ruby/19.in new file mode 100644 index 0000000..52f1476 --- /dev/null +++ b/test/ruby/19.in @@ -0,0 +1 @@ +x and y \ No newline at end of file diff --git a/test/ruby/19.out b/test/ruby/19.out new file mode 100644 index 0000000..52f1476 --- /dev/null +++ b/test/ruby/19.out @@ -0,0 +1 @@ +x and y \ No newline at end of file diff --git a/test/ruby/20.in b/test/ruby/20.in new file mode 100644 index 0000000..87a70fe --- /dev/null +++ b/test/ruby/20.in @@ -0,0 +1 @@ +not x \ No newline at end of file diff --git a/test/ruby/20.out b/test/ruby/20.out new file mode 100644 index 0000000..87a70fe --- /dev/null +++ b/test/ruby/20.out @@ -0,0 +1 @@ +not x \ No newline at end of file diff --git a/test/ruby/21.in b/test/ruby/21.in new file mode 100644 index 0000000..f06e865 --- /dev/null +++ b/test/ruby/21.in @@ -0,0 +1,4 @@ +class Point: + def __init__(self, x, y): + self.x = x + self.y = y \ No newline at end of file diff --git a/test/ruby/21.out b/test/ruby/21.out new file mode 100644 index 0000000..8e1abc0 --- /dev/null +++ b/test/ruby/21.out @@ -0,0 +1,6 @@ +class Point + def initialize(x, y) + @x = x + @y = y + end +end \ No newline at end of file diff --git a/test/ruby/22.in b/test/ruby/22.in new file mode 100644 index 0000000..22eb16f --- /dev/null +++ b/test/ruby/22.in @@ -0,0 +1,3 @@ +class Counter: + def increment(self): + self.count = self.count + 1 \ No newline at end of file diff --git a/test/ruby/22.out b/test/ruby/22.out new file mode 100644 index 0000000..84e5a2e --- /dev/null +++ b/test/ruby/22.out @@ -0,0 +1,5 @@ +class Counter + def increment + @count = @count + 1 + end +end \ No newline at end of file diff --git a/test/tester.sh b/test/tester.sh index 7ef7bf2..475658b 100755 --- a/test/tester.sh +++ b/test/tester.sh @@ -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" \ No newline at end of file