summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-06 22:56:33 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:51 +0200
commit13ce6a163687659b805c13c0c25caa1ef1ae57f4 (patch)
treeff36899604312af1cc9eb27836311e7b3a06a107 /tests
parent7aecaee20c48839256135f83a01a96f525f50321 (diff)
Use do_run_from_file() for test_getgep
Diffstat (limited to 'tests')
-rw-r--r--tests/core/test_getgep.in17
-rw-r--r--tests/core/test_getgep.out1
-rw-r--r--tests/test_core.py22
3 files changed, 22 insertions, 18 deletions
diff --git a/tests/core/test_getgep.in b/tests/core/test_getgep.in
new file mode 100644
index 00000000..b92c4a1a
--- /dev/null
+++ b/tests/core/test_getgep.in
@@ -0,0 +1,17 @@
+
+ #include <stdio.h>
+ struct {
+ int y[10];
+ int z[10];
+ } commonblock;
+
+ int main()
+ {
+ for (int i = 0; i < 10; ++i) {
+ commonblock.y[i] = 1;
+ commonblock.z[i] = 2;
+ }
+ printf("*%d %d*\n", commonblock.y[0], commonblock.z[0]);
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_getgep.out b/tests/core/test_getgep.out
new file mode 100644
index 00000000..a53d59ff
--- /dev/null
+++ b/tests/core/test_getgep.out
@@ -0,0 +1 @@
+*1 2* \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index 7a693f36..929e724b 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -847,25 +847,11 @@ 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_getgep(self):
- # Generated code includes getelementptr (getelementptr, 0, 1), i.e., GEP as the first param to GEP
- src = '''
- #include <stdio.h>
- struct {
- int y[10];
- int z[10];
- } commonblock;
+ # Generated code includes getelementptr (getelementptr, 0, 1), i.e., GEP as the first param to GEP
+ test_path = path_from_root('tests', 'core', 'test_getgep')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main()
- {
- for (int i = 0; i < 10; ++i) {
- commonblock.y[i] = 1;
- commonblock.z[i] = 2;
- }
- printf("*%d %d*\\n", commonblock.y[0], commonblock.z[0]);
- return 0;
- }
- '''
- self.do_run(src, '*1 2*')
+ self.do_run_from_file(src, output)
def test_multiply_defined_symbols(self):
a1 = "int f() { return 1; }"