use of net.taken.redsnake.lang.RedsInteger in project redsnake by Taken0711.
the class IfTest method shouldNotExecuteThenBlockWhenExecutingIfWithFalseAndNoElseClause.
@Test
void shouldNotExecuteThenBlockWhenExecutingIfWithFalseAndNoElseClause() {
If anIf = createIfWithAssignments("a", false, 1);
env.putVariable("a", new RedsInteger(0));
anIf.execute(env);
assertEquals(new RedsInteger(0), env.getVariable("a"));
}
use of net.taken.redsnake.lang.RedsInteger in project redsnake by Taken0711.
the class IfTest method shouldExecuteTheGoodBlockWhenExecutingIfWithTrueAndElseClause.
@Test
void shouldExecuteTheGoodBlockWhenExecutingIfWithTrueAndElseClause() {
If anIf = createIfWithAssignments("a", true, 1, 2);
env.putVariable("a", new RedsInteger(0));
anIf.execute(env);
assertEquals(new RedsInteger(1), env.getVariable("a"));
}
use of net.taken.redsnake.lang.RedsInteger in project redsnake by Taken0711.
the class ArithmeticBinaryExpressionTest method shouldReturnCorrectResultWhenExecuteBinaryExprPower.
@Test
void shouldReturnCorrectResultWhenExecuteBinaryExprPower() {
ArithmeticBinaryExpression abe = createBinaryExpression(POWER, 2, 4);
assertEquals(new RedsInteger(16), abe.execute(env));
}
use of net.taken.redsnake.lang.RedsInteger in project redsnake by Taken0711.
the class ArithmeticBinaryExpressionTest method shouldReturnCorrectResultWhenExecuteBinaryExprMod.
@Test
void shouldReturnCorrectResultWhenExecuteBinaryExprMod() {
ArithmeticBinaryExpression abe = createBinaryExpression(MODULUS, 4, 3);
assertEquals(new RedsInteger(1), abe.execute(env));
}
use of net.taken.redsnake.lang.RedsInteger in project redsnake by Taken0711.
the class ArithmeticBinaryExpressionTest method shouldReturnCorrectResultWhenExecuteBinaryMinus.
@Test
void shouldReturnCorrectResultWhenExecuteBinaryMinus() {
ArithmeticBinaryExpression abe = createBinaryExpression(SUBTRACT, 4, 3);
assertEquals(new RedsInteger(1), abe.execute(env));
}
Aggregations