summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/example/match.cpp14
-rw-r--r--test/example/match.txt2
2 files changed, 14 insertions, 2 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));
diff --git a/test/example/match.txt b/test/example/match.txt
index c4ad57d73..2a66f054e 100644
--- a/test/example/match.txt
+++ b/test/example/match.txt
@@ -1,6 +1,6 @@
Testing Internal::Any
Testing Internal::Exact
-Testing Internal::{I32,I64,Int,F32,F64,Float}Lit
+Testing Internal::{Bool,I32,I64,Int,F32,F64,Float}Lit
Testing Internal::ConstantMatcher
Testing Internal::UnaryMatcher
Testing Internal::UnaryOpMatcher