summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-06 23:05:30 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:52 +0200
commitac236a51943d04f17823ad5c13447aad0aeb0ef4 (patch)
tree82d6d8929c2e1e460566c74222e1089c4dc58371 /tests
parent141e48f507d239674ade401f26d2edc546263904 (diff)
Use do_run_from_file() for test_loop
Diffstat (limited to 'tests')
-rw-r--r--tests/core/test_loop.in17
-rw-r--r--tests/core/test_loop.out1
-rw-r--r--tests/test_core.py23
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