summaryrefslogtreecommitdiff
path: root/test/example
diff options
context:
space:
mode:
Diffstat (limited to 'test/example')
-rw-r--r--test/example/type-builder.cpp65
-rw-r--r--test/example/type-builder.txt44
2 files changed, 0 insertions, 109 deletions
diff --git a/test/example/type-builder.cpp b/test/example/type-builder.cpp
index d86643cf0..0fba565f1 100644
--- a/test/example/type-builder.cpp
+++ b/test/example/type-builder.cpp
@@ -5,70 +5,6 @@
using namespace wasm;
-// Construct Signature, Struct, and Array heap types using undefined types.
-void test_builder() {
- std::cout << ";; Test TypeBuilder\n";
-
- // (type $sig (func (param (ref $struct)) (result (ref $array) i32)))
- // (type $struct (struct (field (ref null $array) (mut rtt 0 $array))))
- // (type $array (array (mut externref)))
-
- TypeBuilder builder;
- assert(builder.size() == 0);
- builder.grow(3);
- assert(builder.size() == 3);
-
- Type refSig = builder.getTempRefType(builder[0], NonNullable);
- Type refStruct = builder.getTempRefType(builder[1], NonNullable);
- Type refArray = builder.getTempRefType(builder[2], NonNullable);
- Type refNullArray = builder.getTempRefType(builder[2], Nullable);
- Type rttArray = builder.getTempRttType(Rtt(0, builder[2]));
- Type refNullExt(HeapType::ext, Nullable);
-
- Signature sig(refStruct, builder.getTempTupleType({refArray, Type::i32}));
- Struct struct_({Field(refNullArray, Immutable), Field(rttArray, Mutable)});
- Array array(Field(refNullExt, Mutable));
-
- std::cout << "Before setting heap types:\n";
- std::cout << "(ref $sig) => " << refSig << "\n";
- std::cout << "(ref $struct) => " << refStruct << "\n";
- std::cout << "(ref $array) => " << refArray << "\n";
- std::cout << "(ref null $array) => " << refNullArray << "\n";
- std::cout << "(rtt 0 $array) => " << rttArray << "\n\n";
-
- builder[0] = sig;
- builder[1] = struct_;
- builder[2] = array;
-
- std::cout << "After setting heap types:\n";
- std::cout << "(ref $sig) => " << refSig << "\n";
- std::cout << "(ref $struct) => " << refStruct << "\n";
- std::cout << "(ref $array) => " << refArray << "\n";
- std::cout << "(ref null $array) => " << refNullArray << "\n";
- std::cout << "(rtt 0 $array) => " << rttArray << "\n\n";
-
- std::vector<HeapType> built = builder.build();
-
- Type newRefSig = Type(built[0], NonNullable);
- Type newRefStruct = Type(built[1], NonNullable);
- Type newRefArray = Type(built[2], NonNullable);
- Type newRefNullArray = Type(built[2], Nullable);
- Type newRttArray = Type(Rtt(0, built[2]));
-
- assert(refSig != newRefSig);
- assert(refStruct != newRefStruct);
- assert(refArray != newRefArray);
- assert(refNullArray != newRefNullArray);
- assert(rttArray != newRttArray);
-
- std::cout << "After building types:\n";
- std::cout << "(ref $sig) => " << newRefSig << "\n";
- std::cout << "(ref $struct) => " << newRefStruct << "\n";
- std::cout << "(ref $array) => " << newRefArray << "\n";
- std::cout << "(ref null $array) => " << newRefNullArray << "\n";
- std::cout << "(rtt 0 $array) => " << newRttArray << "\n\n";
-}
-
// Check that the builder works when there are duplicate definitions
void test_canonicalization() {
std::cout << ";; Test canonicalization\n";
@@ -496,7 +432,6 @@ int main() {
// Run the tests twice to ensure things still work when the global stores are
// already populated.
for (size_t i = 0; i < 2; ++i) {
- test_builder();
test_canonicalization();
test_basic();
test_recursive();
diff --git a/test/example/type-builder.txt b/test/example/type-builder.txt
index a219816e6..df67b599d 100644
--- a/test/example/type-builder.txt
+++ b/test/example/type-builder.txt
@@ -1,25 +1,3 @@
-;; Test TypeBuilder
-Before setting heap types:
-(ref $sig) => [T](ref [T](func))
-(ref $struct) => [T](ref [T](func))
-(ref $array) => [T](ref [T](func))
-(ref null $array) => [T](ref null [T](func))
-(rtt 0 $array) => [T](rtt 0 [T](func))
-
-After setting heap types:
-(ref $sig) => [T](ref [T](func (param [T](ref [T](struct (field [T](ref null [T](array (mut externref))) (mut [T](rtt 0 [T](array (mut externref)))))))) (result [T](ref [T](array (mut externref))) i32)))
-(ref $struct) => [T](ref [T](struct (field [T](ref null [T](array (mut externref))) (mut [T](rtt 0 [T](array (mut externref)))))))
-(ref $array) => [T](ref [T](array (mut externref)))
-(ref null $array) => [T](ref null [T](array (mut externref)))
-(rtt 0 $array) => [T](rtt 0 [T](array (mut externref)))
-
-After building types:
-(ref $sig) => (ref (func (param (ref (struct (field (ref null (array (mut externref))) (mut (rtt 0 (array (mut externref)))))))) (result (ref (array (mut externref))) i32)))
-(ref $struct) => (ref (struct (field (ref null (array (mut externref))) (mut (rtt 0 (array (mut externref)))))))
-(ref $array) => (ref (array (mut externref)))
-(ref null $array) => (ref null (array (mut externref)))
-(rtt 0 $array) => (rtt 0 (array (mut externref)))
-
;; Test canonicalization
;; Test basic
;; Test recursive types
@@ -48,28 +26,6 @@ After building types:
(func (param anyref) (result (ref null ...1)))
;; Test LUBs
-;; Test TypeBuilder
-Before setting heap types:
-(ref $sig) => [T](ref [T](func))
-(ref $struct) => [T](ref [T](func))
-(ref $array) => [T](ref [T](func))
-(ref null $array) => [T](ref null [T](func))
-(rtt 0 $array) => [T](rtt 0 [T](func))
-
-After setting heap types:
-(ref $sig) => [T](ref [T](func (param [T](ref [T](struct (field [T](ref null [T](array (mut externref))) (mut [T](rtt 0 [T](array (mut externref)))))))) (result [T](ref [T](array (mut externref))) i32)))
-(ref $struct) => [T](ref [T](struct (field [T](ref null [T](array (mut externref))) (mut [T](rtt 0 [T](array (mut externref)))))))
-(ref $array) => [T](ref [T](array (mut externref)))
-(ref null $array) => [T](ref null [T](array (mut externref)))
-(rtt 0 $array) => [T](rtt 0 [T](array (mut externref)))
-
-After building types:
-(ref $sig) => (ref (func (param (ref (struct (field (ref null (array (mut externref))) (mut (rtt 0 (array (mut externref)))))))) (result (ref (array (mut externref))) i32)))
-(ref $struct) => (ref (struct (field (ref null (array (mut externref))) (mut (rtt 0 (array (mut externref)))))))
-(ref $array) => (ref (array (mut externref)))
-(ref null $array) => (ref null (array (mut externref)))
-(rtt 0 $array) => (rtt 0 (array (mut externref)))
-
;; Test canonicalization
;; Test basic
;; Test recursive types