summaryrefslogtreecommitdiff
path: root/test/binaryen.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/binaryen.js')
-rw-r--r--test/binaryen.js/atomics.js1
-rw-r--r--test/binaryen.js/kitchen-sink.js21
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt9
3 files changed, 31 insertions, 0 deletions
diff --git a/test/binaryen.js/atomics.js b/test/binaryen.js/atomics.js
index a3880902f..7eb9cb8ec 100644
--- a/test/binaryen.js/atomics.js
+++ b/test/binaryen.js/atomics.js
@@ -59,5 +59,6 @@ module.addFunction("main", signature, [], module.block("", [
)
]));
+module.setFeatures(Binaryen.Features.Atomics);
module.validate();
console.log(module.emitText());
diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js
index 9e376e436..a798c4092 100644
--- a/test/binaryen.js/kitchen-sink.js
+++ b/test/binaryen.js/kitchen-sink.js
@@ -62,6 +62,16 @@ function test_types() {
console.log("BinaryenTypeAuto: " + Binaryen.auto);
}
+function test_features() {
+ console.log("Binaryen.Features.Atomics: " + Binaryen.Features.Atomics);
+ console.log("Binaryen.Features.BulkMemory: " + Binaryen.Features.BulkMemory);
+ console.log("Binaryen.Features.MutableGlobals: " + Binaryen.Features.MutableGlobals);
+ console.log("Binaryen.Features.NontrappingFPToInt: " + Binaryen.Features.NontrappingFPToInt);
+ console.log("Binaryen.Features.SignExt: " + Binaryen.Features.SignExt);
+ console.log("Binaryen.Features.SIMD128: " + Binaryen.Features.SIMD128);
+ console.log("Binaryen.Features.ExceptionHandling: " + Binaryen.Features.ExceptionHandling);
+}
+
function test_ids() {
console.log("BinaryenInvalidId: " + Binaryen.InvalidId);
console.log("BinaryenBlockId: " + Binaryen.BlockId);
@@ -454,6 +464,16 @@ function test_core() {
// A bunch of our code needs drop, auto-add it
module.autoDrop();
+ var features =
+ Binaryen.Features.Atomics |
+ Binaryen.Features.BulkMemory |
+ Binaryen.Features.NontrappingFPToInt |
+ Binaryen.Features.SignExt |
+ Binaryen.Features.SIMD128;
+
+ module.setFeatures(features);
+ assert(module.getFeatures() == features);
+
// Verify it validates
assert(module.validate());
@@ -766,6 +786,7 @@ function test_internals() {
function main() {
test_types();
+ test_features();
test_ids();
test_core();
test_relooper();
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index a1e8df2b4..fb937e39d 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -7,6 +7,13 @@ BinaryenTypeVec128: 5
BinaryenTypeExceptRef: 6
BinaryenTypeUnreachable: 7
BinaryenTypeAuto: -1
+Binaryen.Features.Atomics: 1
+Binaryen.Features.BulkMemory: 16
+Binaryen.Features.MutableGlobals: 2
+Binaryen.Features.NontrappingFPToInt: 4
+Binaryen.Features.SignExt: 32
+Binaryen.Features.SIMD128: 8
+Binaryen.Features.ExceptionHandling: 64
BinaryenInvalidId: 0
BinaryenBlockId: 1
BinaryenIfId: 2
@@ -3383,6 +3390,8 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5}
functionTypes[3] = BinaryenAddFunctionType(the_module, NULL, 0, paramTypes, 0);
}
BinaryenModuleAutoDrop(the_module);
+ BinaryenSetFeatures(the_module, 61);
+ BinaryenGetFeatures(the_module);
BinaryenModuleValidate(the_module);
BinaryenModulePrint(the_module);
(module