diff options
author | kripken <alonzakai@gmail.com> | 2011-07-13 17:19:19 -0700 |
---|---|---|
committer | kripken <alonzakai@gmail.com> | 2011-07-13 17:19:19 -0700 |
commit | efbf009d0d40443c74cdef9c47e1e54206629e8d (patch) | |
tree | c485f2bee422bc5a274f94f4652c54360966cbc4 /tests/runner.py | |
parent | dc24fffc94606ccb566a3e6bb8dae5543f1ab790 (diff) | |
parent | 3c07ebaefda5c70d5014ceaa5d7cf2a3e65e9316 (diff) |
Merge pull request #52 from max99x/master
Minor improvements: Pyhon 2.6- compatibility; hyperbolic math functions
Diffstat (limited to 'tests/runner.py')
-rw-r--r-- | tests/runner.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/runner.py b/tests/runner.py index 3d122cd8..797b78f9 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -179,8 +179,8 @@ class RunnerCore(unittest.TestCase): exported_settings[setting] = value except: pass - settings = ['%s=%s' % (k, json.dumps(v)) for k, v in exported_settings.items()] - compiler_output = timeout_run(Popen([EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js', '-s'] + settings + extra_args, stdout=PIPE, stderr=STDOUT), TIMEOUT, 'Compiling') + settings = ['-s %s=%s' % (k, json.dumps(v)) for k, v in exported_settings.items()] + compiler_output = timeout_run(Popen([EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js'] + settings + extra_args, stdout=PIPE, stderr=STDOUT), TIMEOUT, 'Compiling') # Detect compilation crashes and errors if compiler_output is not None and 'Traceback' in compiler_output and 'in test_' in compiler_output: print compiler_output; assert 0 @@ -537,11 +537,25 @@ if 'benchmark' not in sys.argv: #include <cmath> int main() { - printf("*%.2f,%.2f,%f,%f*\\n", M_PI, -M_PI, 1/0.0, -1/0.0); + printf("*%.2f,%.2f,%f,%f", M_PI, -M_PI, 1/0.0, -1/0.0); + printf(",%d", finite(NAN) != 0); + printf(",%d", finite(INFINITY) != 0); + printf(",%d", finite(-INFINITY) != 0); + printf(",%d", finite(12.3) != 0); + printf(",%d", isinf(NAN) != 0); + printf(",%d", isinf(INFINITY) != 0); + printf(",%d", isinf(-INFINITY) != 0); + printf(",%d", isinf(12.3) != 0); + printf("*\\n"); return 0; } ''' - self.do_test(src, '*3.14,-3.14,inf,-inf*') + self.do_test(src, '*3.14,-3.14,inf,-inf,0,0,0,1,0,1,1,0*') + + def test_math_hyperbolic(self): + src = open(path_from_root('tests', 'hyperbolic', 'src.c'), 'r').read() + expected = open(path_from_root('tests', 'hyperbolic', 'output.txt'), 'r').read() + self.do_test(src, expected) def test_getgep(self): # Generated code includes getelementptr (getelementptr, 0, 1), i.e., GEP as the first param to GEP |