diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-06 21:13:12 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:35:50 +0200 |
commit | 4a871c3e0f72542cbe4d2158bed707d301c5f29e (patch) | |
tree | 9891e03a09753b2ff138e60e15ed939bfa6c38c2 | |
parent | 33c01702f81722b4aa17e01e83916af360b1e3f9 (diff) |
Use do_run_from_file() for test_i16_emcc_intrinsic
-rw-r--r-- | tests/core/test_i16_emcc_intrinsic.in | 20 | ||||
-rw-r--r-- | tests/core/test_i16_emcc_intrinsic.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 23 |
3 files changed, 24 insertions, 20 deletions
diff --git a/tests/core/test_i16_emcc_intrinsic.in b/tests/core/test_i16_emcc_intrinsic.in new file mode 100644 index 00000000..54008cee --- /dev/null +++ b/tests/core/test_i16_emcc_intrinsic.in @@ -0,0 +1,20 @@ + + #include <stdio.h> + + int test(unsigned short a, unsigned short b) { + unsigned short result = a; + result += b; + if (result < b) printf("C!"); + return result; + } + + int main(void) { + printf(",%d,", test(0, 0)); + printf(",%d,", test(1, 1)); + printf(",%d,", test(65535, 1)); + printf(",%d,", test(1, 65535)); + printf(",%d,", test(32768, 32767)); + printf(",%d,", test(32768, 32768)); + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_i16_emcc_intrinsic.out b/tests/core/test_i16_emcc_intrinsic.out new file mode 100644 index 00000000..35af1e0d --- /dev/null +++ b/tests/core/test_i16_emcc_intrinsic.out @@ -0,0 +1 @@ +,0,,2,C!,0,C!,0,,65535,C!,0,
\ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index f30a8669..74500dc3 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -445,27 +445,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co def test_i16_emcc_intrinsic(self): Settings.CORRECT_SIGNS = 1 # Relevant to this test - src = r''' - #include <stdio.h> - - int test(unsigned short a, unsigned short b) { - unsigned short result = a; - result += b; - if (result < b) printf("C!"); - return result; - } + test_path = path_from_root('tests', 'core', 'test_i16_emcc_intrinsic') + src, output = (test_path + s for s in ('.in', '.out')) - int main(void) { - printf(",%d,", test(0, 0)); - printf(",%d,", test(1, 1)); - printf(",%d,", test(65535, 1)); - printf(",%d,", test(1, 65535)); - printf(",%d,", test(32768, 32767)); - printf(",%d,", test(32768, 32768)); - return 0; - } - ''' - self.do_run(src, ',0,,2,C!,0,C!,0,,65535,C!,0,') + self.do_run_from_file(src, output) def test_double_i64_conversion(self): if Settings.USE_TYPED_ARRAYS != 2: return self.skip('needs ta2') |