use of net.taken.redsnake.tree.statements.Statement in project redsnake by Taken0711.
the class ArithmeticBinaryExpressionTest method shouldPrioritizePowerOverUnaryMinus.
@Test
void shouldPrioritizePowerOverUnaryMinus() {
Statement stmt = parseStatement("-(2)**2");
assertEquals(new RedsInteger(-4), stmt.execute(env));
}
use of net.taken.redsnake.tree.statements.Statement in project redsnake by Taken0711.
the class ArithmeticBinaryExpressionTest method shouldPrioritizeMultiplyDivideAndModuloOverPlusAndMinus.
@Test
void shouldPrioritizeMultiplyDivideAndModuloOverPlusAndMinus() {
Statement stmt = parseStatement("2+2*3-4/2+5%3");
assertEquals(new RedsInteger(8), stmt.execute(env));
}
use of net.taken.redsnake.tree.statements.Statement in project redsnake by Taken0711.
the class AssignmentTest method shouldPrioritizePlusAndMinusOverEquals.
@Test
void shouldPrioritizePlusAndMinusOverEquals() {
Statement stmt = parseStatement("a = 5+2-1");
stmt.execute(env);
assertEquals(new RedsInteger(6), env.getVariable("a"));
}
Aggregations