malicious tests
This commit is contained in:
parent
807aea112e
commit
3fc804e899
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user