Add break tests

This commit is contained in:
augustin64 2023-12-15 10:38:13 +01:00
parent 4172071dba
commit 9af941bc2e

View File

@ -47,5 +47,17 @@ int main() {
true
);
_TEST_ASSERT(
_TEST_NO_EXCEPTION(get<int>(execute("int x; for (int i=0; i < 30; i++) { x=i; if (i==20) break; }; x;")) == 20),
"For break",
true
);
_TEST_ASSERT(
_TEST_NO_EXCEPTION(get<int>(execute("int x; int i=0; while (i < 30) { x=i; if (i==20) break; i++; }; x;")) == 20),
"While break",
true
);
return 0;
}