diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-06 20:16:53 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:35:49 +0200 |
commit | 5a1d1b688b520864f635398e3b03583f6eef4b4e (patch) | |
tree | 11b8cd3ba5196eaf9a11277f1d2facf0edc8dfc9 /tests/test_core.py | |
parent | fe2422bc853882769f893af77ff97422c6716952 (diff) |
Use do_run_from_file() for test_i64_double
Diffstat (limited to 'tests/test_core.py')
-rw-r--r-- | tests/test_core.py | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/tests/test_core.py b/tests/test_core.py index bd57b541..52cbbec6 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -285,50 +285,13 @@ 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_i64_double(self): if Settings.USE_TYPED_ARRAYS != 2: return self.skip('full i64 stuff only in ta2') + test_path = path_from_root('tests', 'core', 'test_i64_double') + src, output = (test_path + s for s in ('.in', '.out')) - src = r''' - #include <stdio.h> - - typedef long long int64; - #define JSDOUBLE_HI32_SIGNBIT 0x80000000 - - bool JSDOUBLE_IS_NEGZERO(double d) - { - union { - struct { - unsigned int lo, hi; - } s; - double d; - } x; - if (d != 0) - return false; - x.d = d; - return (x.s.hi & JSDOUBLE_HI32_SIGNBIT) != 0; - } - - bool JSINT64_IS_NEGZERO(int64 l) - { - union { - int64 i; - double d; - } x; - if (l != 0) - return false; - x.i = l; - return x.d == -0; - } - - int main(int argc, char * argv[]) { - printf("*%d,%d,%d,%d*\n", JSDOUBLE_IS_NEGZERO(0), JSDOUBLE_IS_NEGZERO(-0), JSDOUBLE_IS_NEGZERO(-1), JSDOUBLE_IS_NEGZERO(+1)); - printf("*%d,%d,%d,%d*\n", JSINT64_IS_NEGZERO(0), JSINT64_IS_NEGZERO(-0), JSINT64_IS_NEGZERO(-1), JSINT64_IS_NEGZERO(+1)); - return 0; - } - ''' - self.do_run(src, '*0,0,0,0*\n*1,1,0,0*\n') # same as gcc + self.do_run_from_file(src, output) def test_i64_umul(self): if Settings.USE_TYPED_ARRAYS != 2: return self.skip('full i64 stuff only in ta2') |