From 9af941bc2e46e0c12d006538b2e5df79190ac32e Mon Sep 17 00:00:00 2001 From: augustin64 Date: Fri, 15 Dec 2023 10:38:13 +0100 Subject: [PATCH] Add break tests --- test/statements.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/statements.cpp b/test/statements.cpp index af9980c..2b1d650 100644 --- a/test/statements.cpp +++ b/test/statements.cpp @@ -47,5 +47,17 @@ int main() { true ); + _TEST_ASSERT( + _TEST_NO_EXCEPTION(get(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(execute("int x; int i=0; while (i < 30) { x=i; if (i==20) break; i++; }; x;")) == 20), + "While break", + true + ); + return 0; } \ No newline at end of file