feat: add ceil and floor funcs

This commit is contained in:
Matthieu Bessat 2022-05-16 10:53:45 +02:00
parent d562af9876
commit 547c5d0c63
4 changed files with 48 additions and 6 deletions

View file

@ -69,9 +69,17 @@ void test_evaluation()
assert(resType == TYPE_FLOAT);
assert(float_almost_equal(1, get_float_from_int_rep(resVal)));
evaluate(state, "get_pi()", &resVal, &resType);
assert(resType == TYPE_FLOAT);
assert(float_almost_equal(3.14159, get_float_from_int_rep(resVal)));
evaluate(state, "ceil(1.5)", &resVal, &resType);
assert(resType == TYPE_INT);
assert(2 == resVal);
evaluate(state, "floor(1.5)", &resVal, &resType);
assert(resType == TYPE_INT);
assert(1 == resVal);
evaluate(state, "floor(1.001)", &resVal, &resType);
assert(resType == TYPE_INT);
assert(1 == resVal);
evaluate(state, "random_int(1, 100)", &resVal, &resType);
assert(resType == TYPE_INT);