diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-06 20:46:30 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:35:50 +0200 |
commit | 72cbc30fb0898ec61fea669b97c9a31860df81a9 (patch) | |
tree | 1302df2eda7a56a49567951745ba43b89e30546b | |
parent | ca35cf2e6a10ffcf5ecdca04b2055e65bdf45270 (diff) |
Use do_run_from_file() for test_i64_varargs
-rw-r--r-- | tests/core/test_i64_varargs.in | 30 | ||||
-rw-r--r-- | tests/core/test_i64_varargs.out | 12 | ||||
-rw-r--r-- | tests/test_core.py | 45 |
3 files changed, 45 insertions, 42 deletions
diff --git a/tests/core/test_i64_varargs.in b/tests/core/test_i64_varargs.in new file mode 100644 index 00000000..94982b51 --- /dev/null +++ b/tests/core/test_i64_varargs.in @@ -0,0 +1,30 @@ + + #include <stdio.h> + #include <stdint.h> + #include <stdarg.h> + + int64_t ccv_cache_generate_signature(char *msg, int len, int64_t sig_start, ...) { + if (sig_start < 10123) + printf("%s\n", msg+len); + va_list v; + va_start(v, sig_start); + if (sig_start > 1413) + printf("%d\n", va_arg(v, int)); + else + printf("nada\n"); + va_end(v); + return len*sig_start*(msg[0]+1); + } + + int main(int argc, char **argv) + { + for (int i = 0; i < argc; i++) { + int64_t x; + if (i % 123123 == 0) + x = ccv_cache_generate_signature(argv[i], i+2, (int64_t)argc*argc, 54.111); + else + x = ccv_cache_generate_signature(argv[i], i+2, (int64_t)argc*argc, 13); + printf("%lld\n", x); + } + }; +
\ No newline at end of file diff --git a/tests/core/test_i64_varargs.out b/tests/core/test_i64_varargs.out new file mode 100644 index 00000000..8c7b7843 --- /dev/null +++ b/tests/core/test_i64_varargs.out @@ -0,0 +1,12 @@ +in/this.program +nada +1536 +a +nada +5760 +fl +nada +6592 +sdfasdfasdf +nada +7840 diff --git a/tests/test_core.py b/tests/test_core.py index 00a98363..03a95551 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -419,49 +419,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co def test_i64_varargs(self): if Settings.USE_TYPED_ARRAYS != 2: return self.skip('full i64 stuff only in ta2') - src = r''' - #include <stdio.h> - #include <stdint.h> - #include <stdarg.h> - - int64_t ccv_cache_generate_signature(char *msg, int len, int64_t sig_start, ...) { - if (sig_start < 10123) - printf("%s\n", msg+len); - va_list v; - va_start(v, sig_start); - if (sig_start > 1413) - printf("%d\n", va_arg(v, int)); - else - printf("nada\n"); - va_end(v); - return len*sig_start*(msg[0]+1); - } + test_path = path_from_root('tests', 'core', 'test_i64_varargs') + src, output = (test_path + s for s in ('.in', '.out')) - int main(int argc, char **argv) - { - for (int i = 0; i < argc; i++) { - int64_t x; - if (i % 123123 == 0) - x = ccv_cache_generate_signature(argv[i], i+2, (int64_t)argc*argc, 54.111); - else - x = ccv_cache_generate_signature(argv[i], i+2, (int64_t)argc*argc, 13); - printf("%lld\n", x); - } - }; - ''' - self.do_run(src, '''in/this.program -nada -1536 -a -nada -5760 -fl -nada -6592 -sdfasdfasdf -nada -7840 -''', 'waka fleefl asdfasdfasdfasdf'.split(' ')) + self.do_run_from_file(src, output, 'waka fleefl asdfasdfasdfasdf'.split(' ')) def test_i32_mul_precise(self): if self.emcc_args == None: return self.skip('needs ta2') |