diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 12:52:20 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:35:56 +0200 |
commit | 72672fc7b0fd2917b0df4e45e65c6576438c813d (patch) | |
tree | 03df90cbd9ad381d127ac3e946978e2e5425fdf6 /tests/test_core.py | |
parent | 3f2932b3449f040179aa131a136b513b3a39f9b6 (diff) |
Use do_run_from_file() for test_inlinejs
Diffstat (limited to 'tests/test_core.py')
-rw-r--r-- | tests/test_core.py | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/tests/test_core.py b/tests/test_core.py index c8b4e7e2..0d70f50d 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1883,34 +1883,12 @@ def process(filename): def test_inlinejs(self): if not self.is_le32(): return self.skip('le32 needed for inline js') - src = r''' - #include <stdio.h> - - double get() { - double ret = 0; - __asm __volatile__("Math.abs(-12/3.3)":"=r"(ret)); // write to a variable - asm("#comment1"); - asm volatile("#comment2"); - asm volatile("#comment3\n" - "#comment4\n"); - return ret; - } - - int main() { - asm("Module.print('Inline JS is very cool')"); - printf("%.2f\n", get()); - // Test that passing multiple input and output variables works. - int src1 = 1, src2 = 2, src3 = 3; - int dst1 = 0, dst2 = 0, dst3 = 0; - // TODO asm("Module.print(%3); Module.print(%4); Module.print(%5); %0 = %3; %1 = %4; %2 = %5;" : "=r"(dst1),"=r"(dst2),"=r"(dst3): "r"(src1),"r"(src2),"r"(src3)); - // TODO printf("%d\n%d\n%d\n", dst1, dst2, dst3); + test_path = path_from_root('tests', 'core', 'test_inlinejs') + src, output = (test_path + s for s in ('.in', '.out')) - return 0; - } - ''' + self.do_run_from_file(src, output) - self.do_run(src, 'Inline JS is very cool\n3.64\n') # TODO 1\n2\n3\n1\n2\n3\n') if self.emcc_args == []: # opts will eliminate the comments out = open('src.cpp.o.js').read() for i in range(1, 5): assert ('comment%d' % i) in out |