diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-06 20:11:27 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:35:49 +0200 |
commit | 15a4d1ee3a9db4fe1d0eea61613a446f68783126 (patch) | |
tree | e26ee124c01cc964100373eee1a5671c75f89db9 | |
parent | 116d0a66332b2689ed21b3094afc07ab2f3b8b1d (diff) |
Use do_run_from_file() for test_i64_cmp
-rw-r--r-- | tests/core/test_i64_cmp.in | 18 | ||||
-rw-r--r-- | tests/core/test_i64_cmp.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 22 |
3 files changed, 22 insertions, 19 deletions
diff --git a/tests/core/test_i64_cmp.in b/tests/core/test_i64_cmp.in new file mode 100644 index 00000000..b967d2ff --- /dev/null +++ b/tests/core/test_i64_cmp.in @@ -0,0 +1,18 @@ + + #include <stdio.h> + + typedef long long int64; + + bool compare(int64 val) { + return val == -12; + } + + bool compare2(int64 val) { + return val < -12; + } + + int main(int argc, char * argv[]) { + printf("*%d,%d,%d,%d,%d,%d*\n", argc, compare(argc-1-12), compare(1000+argc), compare2(argc-1-10), compare2(argc-1-14), compare2(argc+1000)); + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_i64_cmp.out b/tests/core/test_i64_cmp.out new file mode 100644 index 00000000..6474e7f5 --- /dev/null +++ b/tests/core/test_i64_cmp.out @@ -0,0 +1 @@ +*1,1,0,0,1,0* diff --git a/tests/test_core.py b/tests/test_core.py index 48624464..319ecda6 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -272,26 +272,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co def test_i64_cmp(self): if Settings.USE_TYPED_ARRAYS != 2: return self.skip('full i64 stuff only in ta2') - src = r''' - #include <stdio.h> - - typedef long long int64; - - bool compare(int64 val) { - return val == -12; - } - - bool compare2(int64 val) { - return val < -12; - } - - int main(int argc, char * argv[]) { - printf("*%d,%d,%d,%d,%d,%d*\n", argc, compare(argc-1-12), compare(1000+argc), compare2(argc-1-10), compare2(argc-1-14), compare2(argc+1000)); - return 0; - } - ''' + test_path = path_from_root('tests', 'core', 'test_i64_cmp') + src, output = (test_path + s for s in ('.in', '.out')) - self.do_run(src, '*1,1,0,0,1,0*\n') + self.do_run_from_file(src, output) def test_i64_cmp2(self): if Settings.USE_TYPED_ARRAYS != 2: return self.skip('full i64 stuff only in ta2') |