diff options
-rw-r--r-- | tests/core/test_fast_math.in | 14 | ||||
-rw-r--r-- | tests/core/test_fast_math.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 17 |
3 files changed, 18 insertions, 14 deletions
diff --git a/tests/core/test_fast_math.in b/tests/core/test_fast_math.in new file mode 100644 index 00000000..27bd01fd --- /dev/null +++ b/tests/core/test_fast_math.in @@ -0,0 +1,14 @@ + +#include <stdio.h> +#include <stdlib.h> + +int main(int argc, char** argv) { + char* endptr; + --argc, ++argv; + double total = 0.0; + for (; argc; argc--, argv++) { + total += strtod(*argv, &endptr); + } + printf("total: %g\n", total); + return 0; +} diff --git a/tests/core/test_fast_math.out b/tests/core/test_fast_math.out new file mode 100644 index 00000000..d1bb5700 --- /dev/null +++ b/tests/core/test_fast_math.out @@ -0,0 +1 @@ +total: 19
\ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index 2a056cf2..1e131563 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -770,21 +770,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co if self.emcc_args is None: return self.skip('requires emcc') Building.COMPILER_TEST_OPTS += ['-ffast-math'] - self.do_run(r''' -#include <stdio.h> -#include <stdlib.h> + test_path = path_from_root('tests', 'core', 'test_fast_math') + src, output = (test_path + s for s in ('.in', '.out')) -int main(int argc, char** argv) { - char* endptr; - --argc, ++argv; - double total = 0.0; - for (; argc; argc--, argv++) { - total += strtod(*argv, &endptr); - } - printf("total: %g\n", total); - return 0; -} -''', 'total: 19', ['5', '6', '8']) + self.do_run_from_file(src, output, ['5', '6', '8']) def test_zerodiv(self): self.do_run(r''' |