Add modulo, fix #319
Some checks failed
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 2m53s

This commit is contained in:
Daniel Holle 2024-04-12 15:40:22 +02:00
parent e0d71a6003
commit 7fb4824f8d
3 changed files with 9 additions and 0 deletions

View File

@ -25,4 +25,10 @@ public class Op1 {
var b = 20;
return a ^ b;
}
public mod() {
var a = 10;
var b = 2;
return a % b;
}
}

View File

@ -958,6 +958,8 @@ public class StatementGenerator {
return BinaryExpr.Operator.EQUAL;
} else if (operator.equals("!=")) {
return BinaryExpr.Operator.NOTEQUAL;
} else if (operator.equals("%")) {
return BinaryExpr.Operator.MOD;
} else {
throw new NotImplementedException();
}

View File

@ -848,6 +848,7 @@ public class TestComplete {
assertEquals(clazz.getDeclaredMethod("or").invoke(instance), 10 | 20);
assertEquals(clazz.getDeclaredMethod("and").invoke(instance), 10 & 20);
assertEquals(clazz.getDeclaredMethod("xor").invoke(instance), 10 ^ 20);
assertEquals(clazz.getDeclaredMethod("mod").invoke(instance), 10 % 2);
}
@Ignore("Not implemented")