use of net.taken.redsnake.lang.RedsInteger 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"));
}
use of net.taken.redsnake.lang.RedsInteger in project redsnake by Taken0711.
the class VariableDesignatorTest method shouldReturnVariableValueWhenExecuteVarDesignator.
@Test
void shouldReturnVariableValueWhenExecuteVarDesignator() {
VariableDesignator var = createVariableDesignator("testvar");
env.putVariable("testvar", new RedsInteger(223));
assertEquals(new RedsInteger(223), var.execute(env));
}
use of net.taken.redsnake.lang.RedsInteger in project redsnake by Taken0711.
the class VariableDesignatorTest method shouldCallFunctionWhenExecuteVarDesignatorAndVarDoesntExist.
@Test
void shouldCallFunctionWhenExecuteVarDesignatorAndVarDoesntExist() {
VariableDesignator var = createVariableDesignator("testFunction");
env.putFunction("testFunction", list -> new RedsInteger(22));
assertEquals(new RedsInteger(22), var.execute(env));
}
Aggregations