feat: add ascii and newline prints
fix(Evaluator): issue over variable reducing priority
This commit is contained in:
parent
738d16f2fc
commit
c3af6bd5ca
10 changed files with 114 additions and 21 deletions
|
|
@ -141,4 +141,26 @@ void test_evaluation()
|
|||
evaluate(state, "5.3 % 10", &resVal, &resType);
|
||||
assert(resType == TYPE_FLOAT);
|
||||
assert(float_almost_equal(5.3, get_float_from_int_rep(resVal)));
|
||||
|
||||
int ex = 43;
|
||||
var_store_set(state->varStore, "var", TYPE_INT, (void*) &ex);
|
||||
evaluate(state, "var", &resVal, &resType);
|
||||
assert(resType == TYPE_INT);
|
||||
assert(43 == resVal);
|
||||
|
||||
evaluate(state, "var < 52", &resVal, &resType);
|
||||
assert(resType == TYPE_INT);
|
||||
assert(1 == resVal);
|
||||
|
||||
evaluate(state, "var < (52-2)", &resVal, &resType);
|
||||
assert(resType == TYPE_INT);
|
||||
assert(1 == resVal);
|
||||
|
||||
int ex2 = 3;
|
||||
var_store_set(state->varStore, "var2", TYPE_INT, (void*) &ex2);
|
||||
|
||||
evaluate(state, "abs((var2^2)-((var-41)^2))+2", &resVal, &resType);
|
||||
assert(resType == TYPE_INT);
|
||||
printf("actually got: %d \n", resVal);
|
||||
assert(7 == resVal);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue