diff --git a/Test/JavaSources/Main.java b/Test/JavaSources/Main.java index 41b5d2f..ca1eb22 100644 --- a/Test/JavaSources/Main.java +++ b/Test/JavaSources/Main.java @@ -1,7 +1,7 @@ -// compile (in project root) using: -// javac -g:none -sourcepath Test/JavaSources/ Test/JavaSources/Main.java // compile all test files using: // ls Test/JavaSources/*.java | grep -v ".*Main.java" | xargs -I {} cabal run compiler {} +// compile (in project root) using: +// javac -g:none -sourcepath Test/JavaSources/ Test/JavaSources/Main.java // afterwards, run using // java -ea -cp Test/JavaSources/ Main @@ -30,5 +30,9 @@ public class Main { // intentionally dodgy expressions work assert malicious.assignNegativeIncrement(42) == -42; assert malicious.tripleAddition(1, 2, 3) == 6; + for(int i = 0; i < 3; i++) + { + assert malicious.cursedFormatting(i) == i; + } } } diff --git a/Test/JavaSources/TestMalicious.java b/Test/JavaSources/TestMalicious.java index f5f39e0..f71785b 100644 --- a/Test/JavaSources/TestMalicious.java +++ b/Test/JavaSources/TestMalicious.java @@ -8,4 +8,34 @@ public class TestMalicious { { return a+++b+++c++; } + + public int cursedFormatting(int n) + { + if + + + (n == 0) + + { + + return ((((0)))); + } + + else + + + if(n == + + 1) + { + return + + + 1; + }else { + return + 2 + ; + } + } }