diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-02 11:44:42 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-02 11:44:42 -0800 |
commit | 1a9469b0ed84be32dc264effbe7736a03cb7b608 (patch) | |
tree | c47a3e605c5c1d8a8e54ba4c47cad4040c8a313e /test/control_flow.cpp | |
parent | 8d25878a2d49199079b7c81a396ee2d4fb03032d (diff) | |
download | binaryen-1a9469b0ed84be32dc264effbe7736a03cb7b608.tar.gz binaryen-1a9469b0ed84be32dc264effbe7736a03cb7b608.tar.bz2 binaryen-1a9469b0ed84be32dc264effbe7736a03cb7b608.zip |
add do-once and while-forever tests
Diffstat (limited to 'test/control_flow.cpp')
-rw-r--r-- | test/control_flow.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/control_flow.cpp b/test/control_flow.cpp index 9536d0504..871e21281 100644 --- a/test/control_flow.cpp +++ b/test/control_flow.cpp @@ -43,5 +43,27 @@ int EMSCRIPTEN_KEEPALIVE check_do_loop(int x) { return x; } +int EMSCRIPTEN_KEEPALIVE check_do_once(int x) { + do { + x *= 2; + if (x > 1000) break; + x--; + if (x > 30) continue; + x++; + } while (0); + return x; +} + +int EMSCRIPTEN_KEEPALIVE check_while_forever(int x) { + while (1) { + x *= 2; + if (x > 1000) break; + x--; + if (x > 30) continue; + x++; + } + return x; +} + } |