#include #include #include #include "../src/types.h" #include "../src/number_parsing.h" #include "../src/utils.h" #include "../src/evaluator.h" #include "../src/state.h" #include "../src/var_store.h" void test_line_processing() { printf("== test line processing == \n"); struct StateContainer* state = state_init(); assert(process_line(state, "#")); assert(process_line(state, "# some random comment")); assert(process_line(state, "set VAR_A to 8.5")); printf("%d \n", var_store_get_int(state->varStore, "VAR_A")); assert(float_almost_equal(8.5, var_store_get_float(state->varStore, "VAR_A"))); assert(process_line(state, "set VAR_B to 1.5")); assert(float_almost_equal(1.5, var_store_get_float(state->varStore, "VAR_B"))); assert(process_line(state, "set VAR_C to 142")); assert(142 == var_store_get_int(state->varStore, "VAR_C")); assert(process_line(state, "set VAR_D to VAR_A+VAR_B")); assert(float_almost_equal(10, var_store_get_float(state->varStore, "VAR_D"))); assert(process_line(state, "set VAR_D to VAR_A+VAR_B")); assert(float_almost_equal(10, var_store_get_float(state->varStore, "VAR_D"))); }