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.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/example/cpp-unit.cpp b/test/example/cpp-unit.cpp
index 07c88c1c5..2aedfd441 100644
--- a/test/example/cpp-unit.cpp
+++ b/test/example/cpp-unit.cpp
@@ -4,6 +4,8 @@
#include <ir/bits.h>
#include <ir/cost.h>
+#include <ir/effects.h>
+#include <pass.h>
#include <wasm.h>
using namespace wasm;
@@ -543,9 +545,21 @@ void test_cost() {
assert_equal(CostAnalyzer(&get).cost, 0);
}
+void test_effects() {
+ PassOptions options;
+ FeatureSet features;
+ // Unreachables trap.
+ Unreachable unreachable;
+ assert_equal(EffectAnalyzer(options, features, &unreachable).trap, true);
+ // Nops... do not.
+ Nop nop;
+ assert_equal(EffectAnalyzer(options, features, &nop).trap, false);
+}
+
int main() {
test_bits();
test_cost();
+ test_effects();
if (failsCount > 0) {
abort();