From 12d878d24bffe27ed05f590fd243734700314d29 Mon Sep 17 00:00:00 2001 From: User <> Date: Sat, 10 Feb 2018 15:22:27 +0100 Subject: [PATCH] moved some test cases --- .gitignore | 1 + src/pp/s1184725/boppi/antlr/.gitignore | 1 + src/pp/s1184725/boppi/test/ConditionalTest.java | 16 ---------------- src/pp/s1184725/boppi/test/ExpressionTest.java | 8 ++++++++ .../s1184725/boppi/test/SimpleVariableTest.java | 8 ++++++++ 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 4796ce3..e49c27d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ bin/ src/pp/iloc/sample/ +.meta/ \ No newline at end of file diff --git a/src/pp/s1184725/boppi/antlr/.gitignore b/src/pp/s1184725/boppi/antlr/.gitignore index b7234d8..862e842 100644 --- a/src/pp/s1184725/boppi/antlr/.gitignore +++ b/src/pp/s1184725/boppi/antlr/.gitignore @@ -7,3 +7,4 @@ /BoppiTokens.tokens /BoppiVisitor.java /BoppiTokens.g4 +/.antlr diff --git a/src/pp/s1184725/boppi/test/ConditionalTest.java b/src/pp/s1184725/boppi/test/ConditionalTest.java index 69c2bf8..5bd1c42 100644 --- a/src/pp/s1184725/boppi/test/ConditionalTest.java +++ b/src/pp/s1184725/boppi/test/ConditionalTest.java @@ -55,22 +55,6 @@ public class ConditionalTest { */ @Test public void basicPrograms() { - BoppiTests.compileAndRunString("print(5*3)"); - assertThat(BoppiTests.log, is(empty())); - assertThat(BoppiTests.out, is(arrayContaining("15"))); - - BoppiTests.compileAndRunString("print({var int x; x := 8; print(x)})"); - assertThat(BoppiTests.log, is(empty())); - assertThat(BoppiTests.out, is(arrayContaining("8", "8"))); - - BoppiTests.compileAndRunString("print('T', 'e', 's', 't', '!')"); - assertThat(BoppiTests.log, is(empty())); - assertThat(BoppiTests.out, is(arrayContaining("T", "e", "s", "t", "!"))); - - BoppiTests.compileAndRunString("var int x; var int y; x := 3*(y := 4); print(x,y)"); - assertThat(BoppiTests.log, is(empty())); - assertThat(BoppiTests.out, is(arrayContaining("12", "4"))); - BoppiTests.compileAndRunFile("basicProgram1.boppi", "1", "T"); assertThat(BoppiTests.log, is(empty())); assertThat(BoppiTests.out, is(arrayContaining("T", "T"))); diff --git a/src/pp/s1184725/boppi/test/ExpressionTest.java b/src/pp/s1184725/boppi/test/ExpressionTest.java index 76abbc8..b44899b 100644 --- a/src/pp/s1184725/boppi/test/ExpressionTest.java +++ b/src/pp/s1184725/boppi/test/ExpressionTest.java @@ -82,6 +82,14 @@ public class ExpressionTest { */ @Test public void correctExpressionGeneration() { + BoppiTests.compileAndRunString("print(5*3)"); + assertThat(BoppiTests.log, is(empty())); + assertThat(BoppiTests.out, is(arrayContaining("15"))); + + BoppiTests.compileAndRunString("print('T', 'e', 's', 't', '!')"); + assertThat(BoppiTests.log, is(empty())); + assertThat(BoppiTests.out, is(arrayContaining("T", "e", "s", "t", "!"))); + BoppiTests.compileAndRunFile("simpleExpression.boppi"); assertThat(BoppiTests.log, is(empty())); assertThat(BoppiTests.out, is(arrayContaining("1", "1", "3", "A", "false"))); diff --git a/src/pp/s1184725/boppi/test/SimpleVariableTest.java b/src/pp/s1184725/boppi/test/SimpleVariableTest.java index 8540947..1dc5c72 100644 --- a/src/pp/s1184725/boppi/test/SimpleVariableTest.java +++ b/src/pp/s1184725/boppi/test/SimpleVariableTest.java @@ -125,6 +125,14 @@ public class SimpleVariableTest { */ @Test public void correctVariableGeneration() { + BoppiTests.compileAndRunString("print({var int x; x := 8; print(x)})"); + assertThat(BoppiTests.log, is(empty())); + assertThat(BoppiTests.out, is(arrayContaining("8", "8"))); + + BoppiTests.compileAndRunString("var int x; var int y; x := 3*(y := 4); print(x,y)"); + assertThat(BoppiTests.log, is(empty())); + assertThat(BoppiTests.out, is(arrayContaining("12", "4"))); + BoppiTests.compileAndRunFile("simpleVariable.boppi"); assertThat(BoppiTests.log, is(empty()));