diff options
author | Max Graey <maxgraey@gmail.com> | 2021-09-20 23:05:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-20 13:05:15 -0700 |
commit | 0e143ffb60b43eade8a7315e62c1f482536e3d1b (patch) | |
tree | 6cea898b57b59154f3108182ed836d33811848b2 /test/example/match.cpp | |
parent | c95f5ade0b50b8373497297bbfbe606f685d8bc9 (diff) | |
download | binaryen-0e143ffb60b43eade8a7315e62c1f482536e3d1b.tar.gz binaryen-0e143ffb60b43eade8a7315e62c1f482536e3d1b.tar.bz2 binaryen-0e143ffb60b43eade8a7315e62c1f482536e3d1b.zip |
[Matcher] Add bval for matching boolean literals (#4162)
Diffstat (limited to 'test/example/match.cpp')
-rw-r--r-- | test/example/match.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/example/match.cpp b/test/example/match.cpp index 21bbbab98..125ce8e92 100644 --- a/test/example/match.cpp +++ b/test/example/match.cpp @@ -123,10 +123,11 @@ void test_internal_exact() { } void test_internal_literal() { - std::cout << "Testing Internal::{I32,I64,Int,F32,F64,Float}Lit\n"; + std::cout << "Testing Internal::{Bool,I32,I64,Int,F32,F64,Float}Lit\n"; Literal i32Zero(int32_t(0)); Literal i32One(int32_t(1)); + Literal i32Two(int32_t(2)); Literal f32Zero(float(0)); Literal f32One(float(1)); Literal i64Zero(int64_t(0)); @@ -134,6 +135,17 @@ void test_internal_literal() { Literal f64Zero(double(0)); Literal f64One(double(1)); + auto anyBool = Internal::BoolLit(nullptr, Internal::Any<bool>(nullptr)); + assert(anyBool.matches(i32Zero)); + assert(anyBool.matches(i32One)); + assert(!anyBool.matches(i32Two)); + assert(!anyBool.matches(f32Zero)); + assert(!anyBool.matches(f32One)); + assert(!anyBool.matches(i64Zero)); + assert(!anyBool.matches(i64One)); + assert(!anyBool.matches(f64Zero)); + assert(!anyBool.matches(f64One)); + auto anyi32 = Internal::I32Lit(nullptr, Internal::Any<int32_t>(nullptr)); assert(anyi32.matches(i32Zero)); assert(anyi32.matches(i32One)); |