summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/core/test_i32_mul_precise.in11
-rw-r--r--tests/core/test_i32_mul_precise.out1
-rw-r--r--tests/test_core.py14
3 files changed, 15 insertions, 11 deletions
diff --git a/tests/core/test_i32_mul_precise.in b/tests/core/test_i32_mul_precise.in
new file mode 100644
index 00000000..f045a768
--- /dev/null
+++ b/tests/core/test_i32_mul_precise.in
@@ -0,0 +1,11 @@
+
+ #include <stdio.h>
+
+ int main(int argc, char **argv) {
+ unsigned long d1 = 0x847c9b5d;
+ unsigned long q = 0x549530e1;
+ if (argc > 1000) { q += argc; d1 -= argc; } // confuse optimizer
+ printf("%lu\n", d1*q);
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_i32_mul_precise.out b/tests/core/test_i32_mul_precise.out
new file mode 100644
index 00000000..d46a5055
--- /dev/null
+++ b/tests/core/test_i32_mul_precise.out
@@ -0,0 +1 @@
+3217489085 \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index 03a95551..351745e2 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -427,18 +427,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
def test_i32_mul_precise(self):
if self.emcc_args == None: return self.skip('needs ta2')
- src = r'''
- #include <stdio.h>
+ test_path = path_from_root('tests', 'core', 'test_i32_mul_precise')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main(int argc, char **argv) {
- unsigned long d1 = 0x847c9b5d;
- unsigned long q = 0x549530e1;
- if (argc > 1000) { q += argc; d1 -= argc; } // confuse optimizer
- printf("%lu\n", d1*q);
- return 0;
- }
- '''
- self.do_run(src, '3217489085')
+ self.do_run_from_file(src, output)
def test_i32_mul_semiprecise(self):
if Settings.ASM_JS: return self.skip('asm is always fully precise')