diff options
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 21 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 9 |
2 files changed, 30 insertions, 0 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 1761ab0bb..1359385eb 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -160,6 +160,16 @@ void test_types() { printf("BinaryenTypeAuto: %d\n", BinaryenTypeAuto()); } +void test_features() { + printf("BinaryenFeatureAtomics: %d\n", BinaryenFeatureAtomics()); + printf("BinaryenFeatureBulkMemory: %d\n", BinaryenFeatureBulkMemory()); + printf("BinaryenFeatureMutableGlobals: %d\n", BinaryenFeatureMutableGlobals()); + printf("BinaryenFeatureNontrappingFPToInt: %d\n", BinaryenFeatureNontrappingFPToInt()); + printf("BinaryenFeatureSignExt: %d\n", BinaryenFeatureSignExt()); + printf("BinaryenFeatureSIMD128: %d\n", BinaryenFeatureSIMD128()); + printf("BinaryenFeatureExceptionHandling: %d\n", BinaryenFeatureExceptionHandling()); +} + void test_core() { // Module creation @@ -511,6 +521,16 @@ void test_core() { // A bunch of our code needs drop(), auto-add it BinaryenModuleAutoDrop(module); + BinaryenFeatures features = + BinaryenFeatureAtomics() | + BinaryenFeatureBulkMemory() | + BinaryenFeatureNontrappingFPToInt() | + BinaryenFeatureSignExt() | + BinaryenFeatureSIMD128(); + + BinaryenSetFeatures(module, features); + assert(BinaryenGetFeatures(module) == features); + // Verify it validates assert(BinaryenModuleValidate(module)); @@ -830,6 +850,7 @@ void test_color_status() { int main() { test_types(); + test_features(); test_core(); test_unreachable(); test_relooper(); diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 693782b60..9b5c10a05 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -7,6 +7,13 @@ BinaryenTypeVec128: 5 BinaryenTypeExceptRef: 6 BinaryenTypeUnreachable: 7 BinaryenTypeAuto: -1 +BinaryenFeatureAtomics: 1 +BinaryenFeatureBulkMemory: 16 +BinaryenFeatureMutableGlobals: 2 +BinaryenFeatureNontrappingFPToInt: 4 +BinaryenFeatureSignExt: 32 +BinaryenFeatureSIMD128: 8 +BinaryenFeatureExceptionHandling: 64 (f32.neg (f32.const -33.61199951171875) ) @@ -3312,6 +3319,8 @@ int main() { 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 |