summaryrefslogtreecommitdiff
path: root/test/example/match.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/example/match.cpp')
-rw-r--r--test/example/match.cpp14
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));