#include "include/test.h" #include "../src/include/tokenize.h" #include "../src/include/parser.h" #include "../src/include/interpreter.h" int execute(string s) { vector tokens = tokenize({ s }); Node ast = parse(tokens); EvalResult res = eval(ast); return get(res); } int main() { _TEST_PRESENTATION("Expressions Arithmétiques"); _TEST_ASSERT( _TEST_NO_EXCEPTION(execute("10 + 3 * (7 - 2);") == 25), "Priorités", true ); _TEST_ASSERT( _TEST_NO_EXCEPTION(execute("12 - 4 - 20;") == -12), "Ordre de soustraction", true ); _TEST_ASSERT( _TEST_NO_EXCEPTION(execute("-7 + 13 + -6;") == 0), "Opérateurs unaires", true ); return 0; }