summaryrefslogtreecommitdiff
path: root/test/example/cpp-unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/example/cpp-unit.cpp')
-rw-r--r--test/example/cpp-unit.cpp37
1 files changed, 23 insertions, 14 deletions
diff --git a/test/example/cpp-unit.cpp b/test/example/cpp-unit.cpp
index b94530401..d2339f030 100644
--- a/test/example/cpp-unit.cpp
+++ b/test/example/cpp-unit.cpp
@@ -605,7 +605,30 @@ void test_effects() {
// ArrayCopy can trap, reads arrays, and writes arrays (but not structs).
{
+ Type arrayref = Type(HeapType(Array(Field(Type::i32, Mutable))), Nullable);
+ LocalGet dest;
+ dest.index = 0;
+ dest.type = arrayref;
+ LocalGet destIndex;
+ destIndex.index = 1;
+ destIndex.type = Type::i32;
+ LocalGet src;
+ src.index = 0;
+ src.type = arrayref;
+ LocalGet srcIndex;
+ srcIndex.index = 1;
+ srcIndex.type = Type::i32;
+ LocalGet length;
+ srcIndex.index = 2;
+ srcIndex.type = Type::i32;
ArrayCopy arrayCopy(module.allocator);
+ arrayCopy.destRef = &dest;
+ arrayCopy.destIndex = &destIndex;
+ arrayCopy.srcRef = &src;
+ arrayCopy.srcIndex = &srcIndex;
+ arrayCopy.length = &length;
+ arrayCopy.finalize();
+
EffectAnalyzer effects(options, module);
effects.visit(&arrayCopy);
assert_equal(effects.trap, true);
@@ -616,19 +639,6 @@ void test_effects() {
}
}
-void test_literals() {
- // The i31 heap type may or may not be basic, depending on if it is nullable.
- // Verify we handle both code paths.
- {
- Literal x(Type(HeapType::i31, Nullable));
- std::cout << x << '\n';
- }
- {
- Literal x(Type(HeapType::i31, NonNullable));
- std::cout << x << '\n';
- }
-}
-
void test_field() {
// Simple types
assert_equal(Field(Type::i32, Immutable).getByteSize(), 4);
@@ -681,7 +691,6 @@ int main() {
test_bits();
test_cost();
test_effects();
- test_literals();
test_field();
test_queue();