-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3ad27f
commit 3bfcf66
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#target WASI | ||
|
||
Function areStringsEqual(PointerToCharacter first, PointerToCharacter second) Which Returns Integer32 Does | ||
While not(ValueAt(first)=0 and ValueAt(second)=0) Loop | ||
If (not(ValueAt(first)=ValueAt(second))) Then | ||
Return 0; | ||
EndIf | ||
first += 1; | ||
second += 1; | ||
EndWhile | ||
Return 1; | ||
EndFunction | ||
|
||
Structure Point Consists Of | ||
Decimal32 x, y, z; | ||
EndStructure | ||
|
||
Function test() Which Returns Integer32 Does | ||
InstantiateStructure Point myPoint; | ||
Return areStringsEqual(TypeOf(myPoint),"Point") and areStringsEqual(TypeOf("Hello world!"),"CharacterPointer"); | ||
EndFunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const fs = require("fs"); | ||
const buffer = fs.readFileSync("typeOfTest.wasm"); | ||
WebAssembly.instantiate(buffer).then((results) => { | ||
const exports = results.instance.exports; | ||
if (exports.test()) { | ||
process.exitCode = 0; | ||
console.log("The TypeOf Test succeeded!"); | ||
} else { | ||
process.exitCode = 1; | ||
console.log("The TypeOf Test failed!"); | ||
} | ||
}); |