diff options
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 7 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 4 | ||||
-rw-r--r-- | test/example/typeinfo.cpp | 16 | ||||
-rw-r--r-- | test/example/typeinfo.txt | 2 |
4 files changed, 19 insertions, 10 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index b0a3ad302..e242cfc8e 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -211,6 +211,12 @@ void test_types() { BinaryenTypeExpand(exnref, &valueType); assert(valueType == exnref); + BinaryenType anyref = BinaryenTypeAnyref(); + printf(" // BinaryenTypeAnyref: %d\n", anyref); + assert(BinaryenTypeArity(anyref) == 1); + BinaryenTypeExpand(anyref, &valueType); + assert(valueType == anyref); + printf(" // BinaryenTypeAuto: %d\n", BinaryenTypeAuto()); BinaryenType pair[] = {i32, i32}; @@ -241,6 +247,7 @@ void test_features() { printf("BinaryenFeatureTailCall: %d\n", BinaryenFeatureTailCall()); printf("BinaryenFeatureReferenceTypes: %d\n", BinaryenFeatureReferenceTypes()); printf("BinaryenFeatureMultivalue: %d\n", BinaryenFeatureMultivalue()); + printf("BinaryenFeatureAnyref: %d\n", BinaryenFeatureAnyref()); printf("BinaryenFeatureAll: %d\n", BinaryenFeatureAll()); } diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 288174b99..c5958ff1d 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -8,6 +8,7 @@ // BinaryenTypeFuncref: 7 // BinaryenTypeExternref: 8 // BinaryenTypeExnref: 9 + // BinaryenTypeAnyref: 10 // BinaryenTypeAuto: -1 BinaryenFeatureMVP: 0 BinaryenFeatureAtomics: 1 @@ -20,7 +21,8 @@ BinaryenFeatureExceptionHandling: 64 BinaryenFeatureTailCall: 128 BinaryenFeatureReferenceTypes: 256 BinaryenFeatureMultivalue: 512 -BinaryenFeatureAll: 1023 +BinaryenFeatureAnyref: 1024 +BinaryenFeatureAll: 2047 (f32.neg (f32.const -33.61199951171875) ) diff --git a/test/example/typeinfo.cpp b/test/example/typeinfo.cpp index ac01c6a1b..345bc0788 100644 --- a/test/example/typeinfo.cpp +++ b/test/example/typeinfo.cpp @@ -21,8 +21,15 @@ void test_compound() { HeapType sameExtern(HeapType::ExternKind); assert(Type(extern_, false).getID() == Type(sameExtern, false).getID()); + HeapType exn(HeapType::ExnKind); + assert(Type(exn, true).getID() == Type::exnref); + assert(Type(exn, false).getID() == Type(exn, false).getID()); + assert(Type(exn, false).getID() != Type(exn, true).getID()); + HeapType sameExn(HeapType::ExnKind); + assert(Type(exn, false).getID() == Type(sameExn, false).getID()); + HeapType any(HeapType::AnyKind); - // assert(Type(any, true).getID() == Type::anyref); + assert(Type(any, true).getID() == Type::anyref); assert(Type(any, false).getID() == Type(any, false).getID()); assert(Type(any, false).getID() != Type(any, true).getID()); HeapType sameAny(HeapType::AnyKind); @@ -41,13 +48,6 @@ void test_compound() { assert(Type(i31, false).getID() != Type(i31, true).getID()); HeapType sameI31(HeapType::I31Kind); assert(Type(i31, false).getID() == Type(sameI31, false).getID()); - - HeapType exn(HeapType::ExnKind); - assert(Type(exn, true).getID() == Type::exnref); - assert(Type(exn, false).getID() == Type(exn, false).getID()); - assert(Type(exn, false).getID() != Type(exn, true).getID()); - HeapType sameExn(HeapType::ExnKind); - assert(Type(exn, false).getID() == Type(sameExn, false).getID()); } { Signature signature(Type::i32, Type::none); diff --git a/test/example/typeinfo.txt b/test/example/typeinfo.txt index 95706d5e2..539f305db 100644 --- a/test/example/typeinfo.txt +++ b/test/example/typeinfo.txt @@ -6,7 +6,7 @@ extern externref (ref extern) any -(ref null any) +anyref (ref any) eq (ref null eq) |