()
| 65 | |
| 66 | |
| 67 | function TestForeignFunctionMultipleUse() { |
| 68 | function AsmModule(stdlib, foreign, buffer) { |
| 69 | "use asm"; |
| 70 | |
| 71 | var getVal = foreign.getVal; |
| 72 | |
| 73 | function caller(int_val, double_val) { |
| 74 | int_val = int_val|0; |
| 75 | double_val = +double_val; |
| 76 | if ((getVal()|0) == (int_val|0)) { |
| 77 | if ((+getVal()) == (+double_val)) { |
| 78 | return 89; |
| 79 | } |
| 80 | } |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | return {caller:caller}; |
| 85 | } |
| 86 | |
| 87 | function ffi() { |
| 88 | function getVal() { |
| 89 | return 83.25; |
| 90 | } |
| 91 | |
| 92 | return {getVal:getVal}; |
| 93 | } |
| 94 | |
| 95 | var foreign = new ffi(); |
| 96 | |
| 97 | var module_decl = eval('(' + AsmModule.toString() + ')'); |
| 98 | var module = module_decl(stdlib, foreign, null); |
| 99 | assertValidAsm(module_decl); |
| 100 | |
| 101 | assertEquals(89, module.caller(83, 83.25)); |
| 102 | } |
| 103 | |
| 104 | print("TestForeignFunctionMultipleUse..."); |
| 105 | TestForeignFunctionMultipleUse(); |
no test coverage detected