moved some test cases

This commit is contained in:
User 2018-02-10 15:22:27 +01:00
parent c503ff31c5
commit 12d878d24b
5 changed files with 18 additions and 16 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
bin/ bin/
src/pp/iloc/sample/ src/pp/iloc/sample/
.meta/

View File

@ -7,3 +7,4 @@
/BoppiTokens.tokens /BoppiTokens.tokens
/BoppiVisitor.java /BoppiVisitor.java
/BoppiTokens.g4 /BoppiTokens.g4
/.antlr

View File

@ -55,22 +55,6 @@ public class ConditionalTest {
*/ */
@Test @Test
public void basicPrograms() { 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"); BoppiTests.compileAndRunFile("basicProgram1.boppi", "1", "T");
assertThat(BoppiTests.log, is(empty())); assertThat(BoppiTests.log, is(empty()));
assertThat(BoppiTests.out, is(arrayContaining("T", "T"))); assertThat(BoppiTests.out, is(arrayContaining("T", "T")));

View File

@ -82,6 +82,14 @@ public class ExpressionTest {
*/ */
@Test @Test
public void correctExpressionGeneration() { 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"); BoppiTests.compileAndRunFile("simpleExpression.boppi");
assertThat(BoppiTests.log, is(empty())); assertThat(BoppiTests.log, is(empty()));
assertThat(BoppiTests.out, is(arrayContaining("1", "1", "3", "A", "false"))); assertThat(BoppiTests.out, is(arrayContaining("1", "1", "3", "A", "false")));

View File

@ -125,6 +125,14 @@ public class SimpleVariableTest {
*/ */
@Test @Test
public void correctVariableGeneration() { 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"); BoppiTests.compileAndRunFile("simpleVariable.boppi");
assertThat(BoppiTests.log, is(empty())); assertThat(BoppiTests.log, is(empty()));