diff options
-rw-r--r-- | tests/core/test_loop.in | 17 | ||||
-rw-r--r-- | tests/core/test_loop.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 23 |
3 files changed, 21 insertions, 20 deletions
diff --git a/tests/core/test_loop.in b/tests/core/test_loop.in new file mode 100644 index 00000000..9df45457 --- /dev/null +++ b/tests/core/test_loop.in @@ -0,0 +1,17 @@ + + #include <stdio.h> + int main() + { + int x = 5; + for (int i = 0; i < 6; i++) { + x += x*i; + if (x > 1000) { + if (x % 7 == 0) printf("cheez\n"); + x /= 2; + break; + } + } + printf("*%d*\n", x); + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_loop.out b/tests/core/test_loop.out new file mode 100644 index 00000000..428e01b6 --- /dev/null +++ b/tests/core/test_loop.out @@ -0,0 +1 @@ +*1800*
\ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index 6c17c5e0..9d37c26d 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -906,27 +906,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co self.do_run_from_file(src, output) def test_loop(self): - src = ''' - #include <stdio.h> - int main() - { - int x = 5; - for (int i = 0; i < 6; i++) { - x += x*i; - if (x > 1000) { - if (x % 7 == 0) printf("cheez\\n"); - x /= 2; - break; - } - } - printf("*%d*\\n", x); - return 0; - } - ''' - - self.do_run(src, '*1800*') + test_path = path_from_root('tests', 'core', 'test_loop') + src, output = (test_path + s for s in ('.in', '.out')) - generated = open('src.cpp.o.js', 'r').read() + self.do_run_from_file(src, output) def test_stack(self): Settings.INLINING_LIMIT = 50 |