use of net.taken.redsnake.lang.RedsInteger in project redsnake by Taken0711.
the class CallTest method shouldReturnCallValueWhenExecuteCallWithoutParams.
@Test
void shouldReturnCallValueWhenExecuteCallWithoutParams() {
Call call = createCall("carded");
env.putFunction("carded", (x) -> new RedsInteger(500));
assertEquals(new RedsInteger(500), call.execute(env));
}
use of net.taken.redsnake.lang.RedsInteger in project redsnake by Taken0711.
the class CallTest method shouldReturnCallValueWhenExecuteCallWithParams.
@Test
void shouldReturnCallValueWhenExecuteCallWithParams() {
Call call = createCall("zymogene", 383);
env.putFunction("zymogene", (x) -> new RedsInteger(576).plus(x.get(0)));
assertEquals(new RedsInteger(576 + 383), call.execute(env));
}
use of net.taken.redsnake.lang.RedsInteger in project redsnake by Taken0711.
the class ProgramTest method shouldReturnSomethingWhenParsingStmt.
@Test
void shouldReturnSomethingWhenParsingStmt() {
Statement stmt = parseStatement("598");
assertEquals(new RedsInteger(598), stmt.execute(env));
}
use of net.taken.redsnake.lang.RedsInteger in project redsnake by Taken0711.
the class ProgramTest method shouldUpdateValueWhenAssignConditionallyAVariable.
@Test
void shouldUpdateValueWhenAssignConditionallyAVariable() {
parseProgram("a = 0\n" + "if true {\n" + " a = 1\n" + "} else {\n" + " a = 2\n" + "}\n").execute(env);
assertEquals(new RedsInteger(1), env.getVariable("a"));
}
use of net.taken.redsnake.lang.RedsInteger in project redsnake by Taken0711.
the class AssignmentTest method shouldStoreVariableAndReturnValueWhenAssignNewVariable.
@Test
void shouldStoreVariableAndReturnValueWhenAssignNewVariable() {
Assignment assignment = createAssignment("ctrl", 250);
assertEquals(new RedsInteger(250), assignment.execute(env));
assertEquals(new RedsInteger(250), env.getVariable("ctrl"));
}
Aggregations