summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordcode <dcode@dcode.io>2022-07-14 17:29:56 +0200
committerGitHub <noreply@github.com>2022-07-14 08:29:56 -0700
commitadde087245c8c7b072534cfaaa461dc364dae4d3 (patch)
tree4f31f0e45e02d009b73ec8e69aabef92baca4008 /test
parent555ba8fc6787e4425c24c60e2f419bd7826b422a (diff)
downloadbinaryen-adde087245c8c7b072534cfaaa461dc364dae4d3.tar.gz
binaryen-adde087245c8c7b072534cfaaa461dc364dae4d3.tar.bz2
binaryen-adde087245c8c7b072534cfaaa461dc364dae4d3.zip
[C-API] Add utility to go between types and heap types (#4792)
Diffstat (limited to 'test')
-rw-r--r--test/example/c-api-kitchen-sink.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index cb156c7c1..28e784a05 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -287,6 +287,15 @@ void test_types() {
printf("BinaryenPackedTypeInt8: %d\n", i8);
BinaryenPackedType i16 = BinaryenPackedTypeInt16();
printf("BinaryenPackedTypeInt16: %d\n", i16);
+
+ BinaryenHeapType eq = BinaryenTypeGetHeapType(eqref);
+ BinaryenType ref_null_eq = BinaryenTypeFromHeapType(eq, true);
+ assert(BinaryenTypeGetHeapType(ref_null_eq) == eq);
+ assert(BinaryenTypeIsNullable(ref_null_eq));
+ BinaryenType ref_eq = BinaryenTypeFromHeapType(eq, false);
+ assert(ref_eq != ref_null_eq);
+ assert(BinaryenTypeGetHeapType(ref_eq) == eq);
+ assert(!BinaryenTypeIsNullable(ref_eq));
}
void test_features() {