diff --git a/test/cib/builder_meta.cpp b/test/cib/builder_meta.cpp index 445edea4..d96db08c 100644 --- a/test/cib/builder_meta.cpp +++ b/test/cib/builder_meta.cpp @@ -18,13 +18,13 @@ struct test_builder_meta { } // namespace TEST_CASE("builder_meta concept") { - static_assert(cib::builder_meta); + STATIC_REQUIRE(cib::builder_meta); } TEST_CASE( "builder_meta builder and interface type traits return correct values") { - static_assert( + STATIC_REQUIRE( std::is_same_v>); - static_assert( + STATIC_REQUIRE( std::is_same_v>); } diff --git a/test/flow/graph.cpp b/test/flow/graph.cpp index 2d9431bc..758082f2 100644 --- a/test/flow/graph.cpp +++ b/test/flow/graph.cpp @@ -22,30 +22,30 @@ constexpr auto c = flow::action<"c">([] {}); TEST_CASE("node size (empty graph)", "[graph]") { constexpr auto g = flow::graph<>{}; - static_assert(node_size(g) == 0); + STATIC_REQUIRE(node_size(g) == 0); } TEST_CASE("node size (single action)", "[graph]") { constexpr auto g = flow::graph<>{}.add(*a >> *b); - static_assert(node_size(g) == 2); + STATIC_REQUIRE(node_size(g) == 2); } TEST_CASE("node size (overlapping actions)", "[graph]") { constexpr auto g = flow::graph<>{}.add(*a >> *b).add(b >> *c); - static_assert(node_size(g) == 3); + STATIC_REQUIRE(node_size(g) == 3); } TEST_CASE("edge size (empty flow)", "[graph]") { constexpr auto g = flow::graph<>{}; - static_assert(edge_size(g) == 1); + STATIC_REQUIRE(edge_size(g) == 1); } TEST_CASE("edge size (single action)", "[graph]") { constexpr auto g = flow::graph<>{}.add(*a >> *b); - static_assert(edge_size(g) == 1); + STATIC_REQUIRE(edge_size(g) == 1); } TEST_CASE("edge size (overlapping actions)", "[graph]") { constexpr auto g = flow::graph<>{}.add(*a >> *b).add(*b >> *c); - static_assert(edge_size(g) == 2); + STATIC_REQUIRE(edge_size(g) == 2); } diff --git a/test/flow/graph_builder.cpp b/test/flow/graph_builder.cpp index c0deebfb..56d3d26a 100644 --- a/test/flow/graph_builder.cpp +++ b/test/flow/graph_builder.cpp @@ -207,8 +207,8 @@ TEST_CASE("add dependency rhs", "[graph_builder]") { } TEST_CASE("reference vs non-reference", "[graph_builder]") { - static_assert(a.identity == flow::subgraph_identity::REFERENCE); - static_assert((*a).identity == flow::subgraph_identity::VALUE); + STATIC_REQUIRE(a.identity == flow::subgraph_identity::REFERENCE); + STATIC_REQUIRE((*a).identity == flow::subgraph_identity::VALUE); } TEST_CASE("reference in order with non-reference added twice", diff --git a/test/interrupt/dynamic_controller.cpp b/test/interrupt/dynamic_controller.cpp index f83d2078..d2f4c7b1 100644 --- a/test/interrupt/dynamic_controller.cpp +++ b/test/interrupt/dynamic_controller.cpp @@ -15,8 +15,8 @@ struct without_enable_field {}; } // namespace TEST_CASE("detect enable_field", "[dynamic controller]") { - static_assert(interrupt::has_enable_field); - static_assert(not interrupt::has_enable_field); + STATIC_REQUIRE(interrupt::has_enable_field); + STATIC_REQUIRE(not interrupt::has_enable_field); } namespace { diff --git a/test/interrupt/irq_impl.cpp b/test/interrupt/irq_impl.cpp index 65c07cf3..41f5b40e 100644 --- a/test/interrupt/irq_impl.cpp +++ b/test/interrupt/irq_impl.cpp @@ -11,7 +11,7 @@ using no_flows_config_t = interrupt::irq<42_irq, 17, interrupt::policies<>>; } TEST_CASE("config models concept", "[irq_impl]") { - static_assert(interrupt::irq_config); + STATIC_REQUIRE(interrupt::irq_config); } TEST_CASE("config can enable/disable its irq", "[irq_impl]") { @@ -29,21 +29,21 @@ TEST_CASE("config enables its irq with priority", "[irq_impl]") { } TEST_CASE("config default status policy is clear first", "[irq_impl]") { - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("config status policy can be supplied", "[irq_impl]") { using config_t = interrupt::irq<42_irq, 17, interrupt::policies>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("impl models concept", "[irq_impl]") { using impl_t = interrupt::irq_impl; - static_assert(interrupt::irq_interface); + STATIC_REQUIRE(interrupt::irq_interface); } namespace { @@ -54,7 +54,7 @@ using flow_config_t = interrupt::irq<17_irq, 42, interrupt::policies<>, T>; TEST_CASE("impl runs a flow", "[irq_impl]") { using impl_t = interrupt::irq_impl, test_nexus>; - static_assert(impl_t::active); + STATIC_REQUIRE(impl_t::active); flow_run = false; impl_t::run(); CHECK(flow_run); @@ -73,12 +73,12 @@ TEST_CASE("impl can init its interrupt", "[irq_impl]") { TEST_CASE("impl is inactive when flow is not active", "[irq_impl]") { using impl_t = interrupt::irq_impl, test_nexus>; - static_assert(not impl_t::active); + STATIC_REQUIRE(not impl_t::active); } TEST_CASE("impl is inactive when there are no flows", "[irq_impl]") { using impl_t = interrupt::irq_impl; - static_assert(not impl_t::active); + STATIC_REQUIRE(not impl_t::active); } TEST_CASE("impl has no enable fields", "[irq_impl]") { diff --git a/test/interrupt/policies.cpp b/test/interrupt/policies.cpp index 4f91bcf0..33a35040 100644 --- a/test/interrupt/policies.cpp +++ b/test/interrupt/policies.cpp @@ -5,14 +5,15 @@ TEST_CASE("policies get", "[policies]") { using policies_t = interrupt::policies; using default_policy_t = interrupt::clear_status_last; - static_assert( + STATIC_REQUIRE( std::is_same_v()), interrupt::clear_status_first>); - static_assert(std::is_same_v< - decltype(policies_t::get()), - default_policy_t>); + STATIC_REQUIRE( + std::is_same_v< + decltype(policies_t::get()), + default_policy_t>); } TEST_CASE("clear status first policy", "[policies]") { @@ -40,7 +41,7 @@ TEST_CASE("policy with required resources", "[policies]") { using policies_t = interrupt::policies>; using P = decltype(policies_t::get()); - static_assert(interrupt::policy

); - static_assert( + STATIC_REQUIRE(interrupt::policy

); + STATIC_REQUIRE( std::is_same_v>); } diff --git a/test/interrupt/shared_irq_impl.cpp b/test/interrupt/shared_irq_impl.cpp index 20411bf4..278576d0 100644 --- a/test/interrupt/shared_irq_impl.cpp +++ b/test/interrupt/shared_irq_impl.cpp @@ -12,7 +12,7 @@ using no_flows_config_t = } TEST_CASE("config models concept", "[shared_irq_impl]") { - static_assert(interrupt::irq_config); + STATIC_REQUIRE(interrupt::irq_config); } TEST_CASE("config can enable/disable its irq", "[shared_irq_impl]") { @@ -30,20 +30,20 @@ TEST_CASE("config enables its irq with priority", "[shared_irq_impl]") { } TEST_CASE("config default status policy is clear first", "[shared_irq_impl]") { - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("config status policy can be supplied", "[shared_irq_impl]") { using config_t = interrupt::shared_irq< 42_irq, 17, interrupt::policies>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("impl models concept", "[shared_irq_impl]") { using impl_t = interrupt::shared_irq_impl; - static_assert(interrupt::irq_interface); + STATIC_REQUIRE(interrupt::irq_interface); } namespace { @@ -61,7 +61,7 @@ TEST_CASE("impl runs a flow", "[shared_irq_impl]") { interrupt::sub_irq_impl, test_nexus>; using impl_t = interrupt::shared_irq_impl, sub_impl_t>; - static_assert(impl_t::active); + STATIC_REQUIRE(impl_t::active); enable_field_t<0>::value = true; status_field_t<0>::value = true; @@ -88,7 +88,7 @@ TEST_CASE("impl is inactive when all subs are inactive", "[shared_irq_impl]") { interrupt::sub_irq_impl, test_nexus>; using impl_t = interrupt::shared_irq_impl, sub_impl_t>; - static_assert(not impl_t::active); + STATIC_REQUIRE(not impl_t::active); } TEST_CASE("impl is active when any sub is active", "[shared_irq_impl]") { @@ -99,12 +99,12 @@ TEST_CASE("impl is active when any sub is active", "[shared_irq_impl]") { using impl_t = interrupt::shared_irq_impl, active_sub_impl_t, inactive_sub_impl_t>; - static_assert(impl_t::active); + STATIC_REQUIRE(impl_t::active); } TEST_CASE("impl is inactive when there are no subs", "[shared_irq_impl]") { using impl_t = interrupt::shared_irq_impl>; - static_assert(not impl_t::active); + STATIC_REQUIRE(not impl_t::active); } TEST_CASE("impl enable fields are active sub enable fields", diff --git a/test/interrupt/shared_sub_irq_impl.cpp b/test/interrupt/shared_sub_irq_impl.cpp index bd923d5b..51411eac 100644 --- a/test/interrupt/shared_sub_irq_impl.cpp +++ b/test/interrupt/shared_sub_irq_impl.cpp @@ -13,26 +13,26 @@ using no_flows_config_t = } // namespace TEST_CASE("config models concept", "[shared_sub_irq_impl]") { - static_assert(interrupt::sub_irq_config); + STATIC_REQUIRE(interrupt::sub_irq_config); } TEST_CASE("config default status policy is clear first", "[shared_sub_irq_impl]") { - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("config status policy can be supplied", "[shared_sub_irq_impl]") { using config_t = interrupt::shared_sub_irq< enable_field_t<0>, status_field_t<0>, interrupt::policies>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("impl models concept", "[shared_sub_irq_impl]") { using impl_t = interrupt::shared_sub_irq_impl; - static_assert(interrupt::sub_irq_interface); + STATIC_REQUIRE(interrupt::sub_irq_interface); } namespace { @@ -51,7 +51,7 @@ TEST_CASE("impl runs a flow", "[shared_sub_irq_impl]") { interrupt::sub_irq_impl, test_nexus>; using impl_t = interrupt::shared_sub_irq_impl, sub_impl_t>; - static_assert(impl_t::active); + STATIC_REQUIRE(impl_t::active); enable_field_t<0>::value = true; enable_field_t<1>::value = true; @@ -68,7 +68,7 @@ TEST_CASE("impl is inactive when all subs are inactive", interrupt::sub_irq_impl, test_nexus>; using impl_t = interrupt::shared_sub_irq_impl, sub_impl_t>; - static_assert(not impl_t::active); + STATIC_REQUIRE(not impl_t::active); } TEST_CASE("impl is active when any sub is active", "[shared_sub_irq_impl]") { @@ -79,13 +79,13 @@ TEST_CASE("impl is active when any sub is active", "[shared_sub_irq_impl]") { using impl_t = interrupt::shared_sub_irq_impl, active_sub_impl_t, inactive_sub_impl_t>; - static_assert(impl_t::active); + STATIC_REQUIRE(impl_t::active); } TEST_CASE("impl is inactive when there are no subs", "[shared_sub_irq_impl]") { using impl_t = interrupt::shared_sub_irq_impl>; - static_assert(not impl_t::active); + STATIC_REQUIRE(not impl_t::active); } TEST_CASE( diff --git a/test/interrupt/sub_irq_impl.cpp b/test/interrupt/sub_irq_impl.cpp index 29e82e5d..7332ef7f 100644 --- a/test/interrupt/sub_irq_impl.cpp +++ b/test/interrupt/sub_irq_impl.cpp @@ -13,25 +13,25 @@ using no_flows_config_t = } // namespace TEST_CASE("config models concept", "[sub_irq_impl]") { - static_assert(interrupt::sub_irq_config); + STATIC_REQUIRE(interrupt::sub_irq_config); } TEST_CASE("config default status policy is clear first", "[sub_irq_impl]") { - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("config status policy can be supplied", "[sub_irq_impl]") { using config_t = interrupt::sub_irq, status_field_t<0>, interrupt::policies>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("impl models concept", "[sub_irq_impl]") { using impl_t = interrupt::sub_irq_impl; - static_assert(interrupt::sub_irq_interface); + STATIC_REQUIRE(interrupt::sub_irq_interface); } namespace { @@ -43,7 +43,7 @@ using flow_config_t = interrupt::sub_irq, status_field_t<0>, TEST_CASE("impl runs a flow when enabled and status", "[sub_irq_impl]") { using impl_t = interrupt::sub_irq_impl, test_nexus>; - static_assert(impl_t::active); + STATIC_REQUIRE(impl_t::active); enable_field_t<0>::value = true; status_field_t<0>::value = true; @@ -55,7 +55,7 @@ TEST_CASE("impl runs a flow when enabled and status", "[sub_irq_impl]") { TEST_CASE("impl doesn't run a flow when not enabled", "[sub_irq_impl]") { using impl_t = interrupt::sub_irq_impl, test_nexus>; - static_assert(impl_t::active); + STATIC_REQUIRE(impl_t::active); enable_field_t<0>::value = false; status_field_t<0>::value = true; @@ -67,7 +67,7 @@ TEST_CASE("impl doesn't run a flow when not enabled", "[sub_irq_impl]") { TEST_CASE("impl doesn't run a flow when not status", "[sub_irq_impl]") { using impl_t = interrupt::sub_irq_impl, test_nexus>; - static_assert(impl_t::active); + STATIC_REQUIRE(impl_t::active); enable_field_t<0>::value = true; status_field_t<0>::value = false; @@ -79,12 +79,12 @@ TEST_CASE("impl doesn't run a flow when not status", "[sub_irq_impl]") { TEST_CASE("impl is inactive when flow is not active", "[sub_irq_impl]") { using impl_t = interrupt::sub_irq_impl, test_nexus>; - static_assert(not impl_t::active); + STATIC_REQUIRE(not impl_t::active); } TEST_CASE("impl is inactive when there are no flows", "[sub_irq_impl]") { using impl_t = interrupt::sub_irq_impl; - static_assert(not impl_t::active); + STATIC_REQUIRE(not impl_t::active); } TEST_CASE("impl reports one enable field when active", "[sub_irq_impl]") { diff --git a/test/log/encoder.cpp b/test/log/encoder.cpp index cfd78cbe..0c046826 100644 --- a/test/log/encoder.cpp +++ b/test/log/encoder.cpp @@ -68,7 +68,7 @@ struct test_conc_policy { int num_log_args_calls{}; constexpr auto check = [](auto value, auto expected) { - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); CHECK(value == expected); }; @@ -155,31 +155,31 @@ template <> inline auto conc::injected_policy<> = test_conc_policy{}; TEST_CASE("argument packing", "[mipi]") { using P = logging::default_arg_packer; - static_assert(std::same_as, std::int32_t>); - static_assert(std::same_as, std::uint32_t>); - static_assert(std::same_as, std::int64_t>); - static_assert(std::same_as, std::uint64_t>); - static_assert(std::same_as, std::int32_t>); - static_assert(std::same_as, std::uint32_t>); - static_assert(std::same_as, std::uint32_t>); - static_assert(std::same_as, std::uint64_t>); + STATIC_REQUIRE(std::same_as, std::int32_t>); + STATIC_REQUIRE(std::same_as, std::uint32_t>); + STATIC_REQUIRE(std::same_as, std::int64_t>); + STATIC_REQUIRE(std::same_as, std::uint64_t>); + STATIC_REQUIRE(std::same_as, std::int32_t>); + STATIC_REQUIRE(std::same_as, std::uint32_t>); + STATIC_REQUIRE(std::same_as, std::uint32_t>); + STATIC_REQUIRE(std::same_as, std::uint64_t>); } TEST_CASE("argument encoding", "[mipi]") { using P = logging::default_arg_packer; - static_assert( + STATIC_REQUIRE( std::same_as, encode_32>); - static_assert( + STATIC_REQUIRE( std::same_as, encode_u32>); - static_assert( + STATIC_REQUIRE( std::same_as, encode_64>); - static_assert( + STATIC_REQUIRE( std::same_as, encode_u64>); - static_assert(std::same_as, encode_32>); - static_assert( + STATIC_REQUIRE(std::same_as, encode_32>); + STATIC_REQUIRE( std::same_as, encode_u32>); - static_assert(std::same_as, encode_u32>); - static_assert(std::same_as, encode_u64>); + STATIC_REQUIRE(std::same_as, encode_u32>); + STATIC_REQUIRE(std::same_as, encode_u64>); } TEST_CASE("log zero arguments", "[mipi]") { @@ -330,7 +330,7 @@ template struct test_catalog_args_destination { expected_catalog32_header(Level, test_module_id); CHECK(header == Header); CHECK(id == test_string_id); - static_assert(sizeof...(Args) == 0); + STATIC_REQUIRE(sizeof...(Args) == 0); ++num_catalog_args_calls; } }; diff --git a/test/log/env.cpp b/test/log/env.cpp index 98d1b6d9..c32e0918 100644 --- a/test/log/env.cpp +++ b/test/log/env.cpp @@ -28,23 +28,23 @@ namespace { } // namespace TEST_CASE("override environment", "[log_env]") { - static_assert(custom(cib_log_env_t{}) == 42); + STATIC_REQUIRE(custom(cib_log_env_t{}) == 42); CIB_LOG_ENV(custom, 1); - static_assert(custom(cib_log_env_t{}) == 1); + STATIC_REQUIRE(custom(cib_log_env_t{}) == 1); { CIB_LOG_ENV(custom, 2); - static_assert(custom(cib_log_env_t{}) == 2); + STATIC_REQUIRE(custom(cib_log_env_t{}) == 2); } } TEST_CASE("supplement environment", "[log_env]") { CIB_LOG_ENV(custom, 1); - static_assert(custom(cib_log_env_t{}) == 1); + STATIC_REQUIRE(custom(cib_log_env_t{}) == 1); { using namespace stdx::literals; CIB_LOG_ENV(logging::get_module, "hello"); - static_assert(custom(cib_log_env_t{}) == 1); - static_assert(logging::get_module(cib_log_env_t{}) == "hello"_cts); + STATIC_REQUIRE(custom(cib_log_env_t{}) == 1); + STATIC_REQUIRE(logging::get_module(cib_log_env_t{}) == "hello"_cts); } } @@ -52,8 +52,8 @@ TEST_CASE("multi-value environment", "[log_env]") { CIB_LOG_ENV(custom, 1, logging::get_module, "hello"); using namespace stdx::literals; - static_assert(custom(cib_log_env_t{}) == 1); - static_assert(logging::get_module(cib_log_env_t{}) == "hello"_cts); + STATIC_REQUIRE(custom(cib_log_env_t{}) == 1); + STATIC_REQUIRE(logging::get_module(cib_log_env_t{}) == "hello"_cts); } namespace { diff --git a/test/log/level.cpp b/test/log/level.cpp index 7a27f8a9..0d0b54b3 100644 --- a/test/log/level.cpp +++ b/test/log/level.cpp @@ -22,8 +22,8 @@ std::string buffer{}; namespace logging { template -[[nodiscard]] constexpr auto format_as(level_wrapper) -> std::string_view { - static_assert(L == custom_level::THE_ONE_LEVEL); +[[nodiscard]] auto format_as(level_wrapper) -> std::string_view { + STATIC_REQUIRE(L == custom_level::THE_ONE_LEVEL); return "THE_ONE_LEVEL"; } } // namespace logging diff --git a/test/log/module_id.cpp b/test/log/module_id.cpp index 11e6794d..66009060 100644 --- a/test/log/module_id.cpp +++ b/test/log/module_id.cpp @@ -8,7 +8,7 @@ TEST_CASE("default log module id", "[module_id]") { using namespace stdx::literals; - static_assert(logging::get_module(cib_log_env_t{}) == "default"_cts); + STATIC_REQUIRE(logging::get_module(cib_log_env_t{}) == "default"_cts); } namespace ns { @@ -16,14 +16,14 @@ CIB_LOG_MODULE("ns"); TEST_CASE("log module id overridden at namespace scope", "[module_id]") { using namespace stdx::literals; - static_assert(logging::get_module(cib_log_env_t{}) == "ns"_cts); + STATIC_REQUIRE(logging::get_module(cib_log_env_t{}) == "ns"_cts); } } // namespace ns struct S { - template constexpr static auto test() { + template static auto test() { using namespace stdx::literals; - static_assert(logging::get_module(cib_log_env_t{}) == "S"_cts); + STATIC_REQUIRE(logging::get_module(cib_log_env_t{}) == "S"_cts); } CIB_LOG_MODULE("S"); @@ -33,10 +33,10 @@ TEST_CASE("log module id overridden at class scope", "[module_id]") { S::test(); } -template constexpr static auto func_test() { +template auto func_test() { CIB_LOG_MODULE("fn"); using namespace stdx::literals; - static_assert(logging::get_module(cib_log_env_t{}) == "fn"_cts); + STATIC_REQUIRE(logging::get_module(cib_log_env_t{}) == "fn"_cts); } TEST_CASE("log module id overridden at function scope", "[module_id]") { @@ -49,6 +49,6 @@ TEST_CASE("log module id overridden at statement scope", "[module_id]") { { CIB_LOG_MODULE("statement"); using namespace stdx::literals; - static_assert(logging::get_module(cib_log_env_t{}) == "statement"_cts); + STATIC_REQUIRE(logging::get_module(cib_log_env_t{}) == "statement"_cts); } } diff --git a/test/lookup/input.cpp b/test/lookup/input.cpp index 36b4367d..a83f389c 100644 --- a/test/lookup/input.cpp +++ b/test/lookup/input.cpp @@ -8,7 +8,7 @@ TEST_CASE("an input with no entries (type deduced)", "[input]") { constexpr auto input = lookup::input{1}; CHECK(input.default_value == 1); - static_assert( + STATIC_REQUIRE( std::is_same_v const>); CHECK(std::size(input) == 0); } @@ -16,7 +16,7 @@ TEST_CASE("an input with no entries (type deduced)", "[input]") { TEST_CASE("an input with no entries (explicit types)", "[input]") { constexpr auto input = lookup::input{1}; CHECK(input.default_value == 1); - static_assert( + STATIC_REQUIRE( std::is_same_v const>); CHECK(std::size(input) == 0); } @@ -24,7 +24,7 @@ TEST_CASE("an input with no entries (explicit types)", "[input]") { TEST_CASE("an input with some entries (type deduced)", "[input]") { constexpr auto input = lookup::input(1, std::array{lookup::entry{1.0f, 2}}); CHECK(input.default_value == 1); - static_assert( + STATIC_REQUIRE( std::is_same_v const>); CHECK(std::size(input) == 1); } diff --git a/test/lookup/linear_search.cpp b/test/lookup/linear_search.cpp index f29a80e0..520770d6 100644 --- a/test/lookup/linear_search.cpp +++ b/test/lookup/linear_search.cpp @@ -13,7 +13,7 @@ TEST_CASE("a lookup with more entries than allowed", "[linear search]") { constexpr auto lookup = LS::make(CX_VALUE(lookup::input{ 0, std::array{lookup::entry{1, 1}, lookup::entry{2, 2}, lookup::entry{3, 3}}})); - static_assert(lookup::strategy_failed(lookup)); + STATIC_REQUIRE(lookup::strategy_failed(lookup)); } TEST_CASE("a lookup with no entries", "[linear search]") { diff --git a/test/lookup/lookup.cpp b/test/lookup/lookup.cpp index 418edb1a..01142ad2 100644 --- a/test/lookup/lookup.cpp +++ b/test/lookup/lookup.cpp @@ -13,15 +13,15 @@ TEST_CASE("a lookup with no entries", "[lookup]") { constexpr auto lookup = lookup::make(CX_VALUE(lookup::input{})); - static_assert(lookup[0u] == 0u); - static_assert(lookup[42u] == 0u); + STATIC_REQUIRE(lookup[0u] == 0u); + STATIC_REQUIRE(lookup[42u] == 0u); } TEST_CASE("a lookup with no entries and non-zero default", "[lookup]") { constexpr auto lookup = lookup::make(CX_VALUE(lookup::input{5u})); - static_assert(lookup[0u] == 5u); - static_assert(lookup[42u] == 5u); + STATIC_REQUIRE(lookup[0u] == 5u); + STATIC_REQUIRE(lookup[42u] == 5u); } namespace { @@ -36,37 +36,37 @@ TEST_CASE("a linear lookup with non-integer values", "[lookup]") { lookup::entry{42, bitset<32>{stdx::place_bits, 0}}, lookup::entry{89, bitset<32>{stdx::place_bits, 12, 3}}}})); - static_assert(lookup[0] == bitset<32>{}); - static_assert(lookup[42] == bitset<32>{stdx::place_bits, 0}); - static_assert(lookup[89] == bitset<32>{stdx::place_bits, 12, 3}); + STATIC_REQUIRE(lookup[0] == bitset<32>{}); + STATIC_REQUIRE(lookup[42] == bitset<32>{stdx::place_bits, 0}); + STATIC_REQUIRE(lookup[89] == bitset<32>{stdx::place_bits, 12, 3}); } TEST_CASE("a lookup with some entries", "[lookup]") { constexpr auto lookup = lookup::make(CX_VALUE(lookup::input{ 0, std::array{lookup::entry{0, 13}, lookup::entry{6, 42}, lookup::entry{89, 10}}})); - static_assert(lookup[0] == 13); - static_assert(lookup[1] == 0); - static_assert(lookup[5] == 0); - static_assert(lookup[6] == 42); - static_assert(lookup[7] == 0); - static_assert(lookup[88] == 0); - static_assert(lookup[89] == 10); - static_assert(lookup[90] == 0); + STATIC_REQUIRE(lookup[0] == 13); + STATIC_REQUIRE(lookup[1] == 0); + STATIC_REQUIRE(lookup[5] == 0); + STATIC_REQUIRE(lookup[6] == 42); + STATIC_REQUIRE(lookup[7] == 0); + STATIC_REQUIRE(lookup[88] == 0); + STATIC_REQUIRE(lookup[89] == 10); + STATIC_REQUIRE(lookup[90] == 0); } TEST_CASE("a lookup with some entries and non-zero default", "[lookup]") { constexpr auto lookup = lookup::make(CX_VALUE(lookup::input{ 5, std::array{lookup::entry{1, 13}, lookup::entry{6, 42}, lookup::entry{89, 10}}})); - static_assert(lookup[0] == 5); - static_assert(lookup[1] == 13); - static_assert(lookup[5] == 5); - static_assert(lookup[6] == 42); - static_assert(lookup[7] == 5); - static_assert(lookup[88] == 5); - static_assert(lookup[89] == 10); - static_assert(lookup[90] == 5); + STATIC_REQUIRE(lookup[0] == 5); + STATIC_REQUIRE(lookup[1] == 13); + STATIC_REQUIRE(lookup[5] == 5); + STATIC_REQUIRE(lookup[6] == 42); + STATIC_REQUIRE(lookup[7] == 5); + STATIC_REQUIRE(lookup[88] == 5); + STATIC_REQUIRE(lookup[89] == 10); + STATIC_REQUIRE(lookup[90] == 5); } TEST_CASE("a lookup with some sequential entries", "[lookup]") { @@ -77,21 +77,21 @@ TEST_CASE("a lookup with some sequential entries", "[lookup]") { lookup::entry{4u, 25u}, lookup::entry{5u, 82u}, lookup::entry{6u, 18u}, lookup::entry{7u, 87u}, lookup::entry{8u, 55u}, lookup::entry{9u, 11u}}})); - static_assert(lookup[0] == 13); - static_assert(lookup[1] == 42); - static_assert(lookup[2] == 10); - static_assert(lookup[3] == 76); - static_assert(lookup[4] == 25); - static_assert(lookup[5] == 82); - static_assert(lookup[6] == 18); - static_assert(lookup[7] == 87); - static_assert(lookup[8] == 55); - static_assert(lookup[9] == 11); - static_assert(lookup[10] == 1); - static_assert(lookup[11] == 1); - static_assert(lookup[12] == 1); - static_assert(lookup[13] == 1); - static_assert(lookup[14] == 1); - static_assert(lookup[15] == 1); - static_assert(lookup[4'000'000'000u] == 1); + STATIC_REQUIRE(lookup[0] == 13); + STATIC_REQUIRE(lookup[1] == 42); + STATIC_REQUIRE(lookup[2] == 10); + STATIC_REQUIRE(lookup[3] == 76); + STATIC_REQUIRE(lookup[4] == 25); + STATIC_REQUIRE(lookup[5] == 82); + STATIC_REQUIRE(lookup[6] == 18); + STATIC_REQUIRE(lookup[7] == 87); + STATIC_REQUIRE(lookup[8] == 55); + STATIC_REQUIRE(lookup[9] == 11); + STATIC_REQUIRE(lookup[10] == 1); + STATIC_REQUIRE(lookup[11] == 1); + STATIC_REQUIRE(lookup[12] == 1); + STATIC_REQUIRE(lookup[13] == 1); + STATIC_REQUIRE(lookup[14] == 1); + STATIC_REQUIRE(lookup[15] == 1); + STATIC_REQUIRE(lookup[4'000'000'000u] == 1); } diff --git a/test/match/and.cpp b/test/match/and.cpp index 1783bf7d..ec6895a8 100644 --- a/test/match/and.cpp +++ b/test/match/and.cpp @@ -10,56 +10,56 @@ TEST_CASE("AND fulfils matcher concept", "[match and]") { using T = match::and_t; - static_assert(match::matcher); - static_assert(match::matcher_for); + STATIC_REQUIRE(match::matcher); + STATIC_REQUIRE(match::matcher_for); } TEST_CASE("AND describes itself", "[match and]") { constexpr auto e = test_m<0>{} and test_m<1>{}; - static_assert(e.describe() == - stdx::ct_format<"({}) and ({})">(test_m<0>{}.describe(), - test_m<1>{}.describe())); + STATIC_REQUIRE(e.describe() == + stdx::ct_format<"({}) and ({})">(test_m<0>{}.describe(), + test_m<1>{}.describe())); } TEST_CASE("AND description flattens", "[match and]") { constexpr auto e = test_m<0>{} and test_m<1>{} and test_m<2>{}; - static_assert(e.describe() == stdx::ct_format<"({}) and ({}) and ({})">( - test_m<0>{}.describe(), - test_m<1>{}.describe(), - test_m<2>{}.describe())); + STATIC_REQUIRE(e.describe() == stdx::ct_format<"({}) and ({}) and ({})">( + test_m<0>{}.describe(), + test_m<1>{}.describe(), + test_m<2>{}.describe())); } TEST_CASE("AND describes a match", "[match and]") { constexpr auto e = test_m<0>{} and test_m<1>{}; - static_assert(e.describe_match(1) == stdx::ct_format<"({}) and ({})">( - test_m<0>{}.describe_match(1), - test_m<1>{}.describe_match(1))); + STATIC_REQUIRE(e.describe_match(1) == stdx::ct_format<"({}) and ({})">( + test_m<0>{}.describe_match(1), + test_m<1>{}.describe_match(1))); } TEST_CASE("AND match description flattens", "[match and]") { constexpr auto e = test_m<0>{} and test_m<1>{} and test_m<2>{}; - static_assert(e.describe_match(1) == - stdx::ct_format<"({}) and ({}) and ({})">( - test_m<0>{}.describe_match(1), - test_m<1>{}.describe_match(1), - test_m<2>{}.describe_match(1))); + STATIC_REQUIRE(e.describe_match(1) == + stdx::ct_format<"({}) and ({}) and ({})">( + test_m<0>{}.describe_match(1), + test_m<1>{}.describe_match(1), + test_m<2>{}.describe_match(1))); } TEST_CASE("AND matches correctly", "[match and]") { constexpr auto e = test_m<0>{} and test_m<1>{}; - static_assert( + STATIC_REQUIRE( std::is_same_v, test_m<1>> const>); - static_assert(e(1)); - static_assert(not e(0)); + STATIC_REQUIRE(e(1)); + STATIC_REQUIRE(not e(0)); } TEST_CASE("AND simplifies correctly", "[match and]") { constexpr auto e = test_matcher{} and test_matcher{}; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("all expression simplifies", "[match and]") { constexpr auto m = match::all(test_m<0>{}, test_m<1>{}, match::always); - static_assert( + STATIC_REQUIRE( std::is_same_v, test_m<1>> const>); } diff --git a/test/match/constant.cpp b/test/match/constant.cpp index 2a01d7ab..3b2977fd 100644 --- a/test/match/constant.cpp +++ b/test/match/constant.cpp @@ -7,29 +7,29 @@ TEST_CASE("constant fulfils matcher concepts", "[match constant]") { using A = decltype(match::always); using N = decltype(match::never); - static_assert(match::matcher); - static_assert(match::matcher); - static_assert(match::matcher_for); - static_assert(match::matcher_for); + STATIC_REQUIRE(match::matcher); + STATIC_REQUIRE(match::matcher); + STATIC_REQUIRE(match::matcher_for); + STATIC_REQUIRE(match::matcher_for); } TEST_CASE("constant describes itself", "[match constant]") { using namespace stdx::literals; using A = decltype(match::always); using N = decltype(match::never); - static_assert(A{}.describe() == "true"_ctst); - static_assert(N{}.describe() == "false"_ctst); + STATIC_REQUIRE(A{}.describe() == "true"_ctst); + STATIC_REQUIRE(N{}.describe() == "false"_ctst); } TEST_CASE("constant describes a match", "[match not]") { using namespace stdx::literals; using A = decltype(match::always); using N = decltype(match::never); - static_assert(A{}.describe_match(0) == "true"_ctst); - static_assert(N{}.describe_match(0) == "false"_ctst); + STATIC_REQUIRE(A{}.describe_match(0) == "true"_ctst); + STATIC_REQUIRE(N{}.describe_match(0) == "false"_ctst); } TEST_CASE("constant matches correctly", "[match constant]") { - static_assert(match::always(0)); - static_assert(not match::never(0)); + STATIC_REQUIRE(match::always(0)); + STATIC_REQUIRE(not match::never(0)); } diff --git a/test/match/equivalence.cpp b/test/match/equivalence.cpp index 871e0f4d..0c3f73fd 100644 --- a/test/match/equivalence.cpp +++ b/test/match/equivalence.cpp @@ -11,27 +11,27 @@ TEST_CASE("less than", "[match equivalence]") { using T = match::and_t, test_m<1>>; using U = test_m<0>; constexpr auto result = T{} <=> U{}; - static_assert(result == std::partial_ordering::less); - static_assert(T{} < U{}); + STATIC_REQUIRE(result == std::partial_ordering::less); + STATIC_REQUIRE(T{} < U{}); } TEST_CASE("greater than", "[match equivalence]") { using T = match::or_t, test_m<1>>; using U = test_m<0>; constexpr auto result = T{} <=> U{}; - static_assert(result == std::partial_ordering::greater); - static_assert(T{} > U{}); + STATIC_REQUIRE(result == std::partial_ordering::greater); + STATIC_REQUIRE(T{} > U{}); } TEST_CASE("equivalent", "[match equivalence]") { using T = test_m<0>; constexpr auto result = T{} <=> T{}; - static_assert(result == std::partial_ordering::equivalent); + STATIC_REQUIRE(result == std::partial_ordering::equivalent); } TEST_CASE("unorderable", "[match equivalence]") { using T = test_m<0>; using U = test_m<1>; constexpr auto result = T{} <=> U{}; - static_assert(result == std::partial_ordering::unordered); + STATIC_REQUIRE(result == std::partial_ordering::unordered); } diff --git a/test/match/implies.cpp b/test/match/implies.cpp index 64e4ff5d..526e5cb6 100644 --- a/test/match/implies.cpp +++ b/test/match/implies.cpp @@ -5,39 +5,39 @@ #include TEST_CASE("X => X", "[match implies]") { - static_assert(match::implies(test_matcher{}, test_matcher{})); + STATIC_REQUIRE(match::implies(test_matcher{}, test_matcher{})); } TEST_CASE("false => X", "[match implies]") { - static_assert(match::implies(match::never, test_matcher{})); + STATIC_REQUIRE(match::implies(match::never, test_matcher{})); } TEST_CASE("X => true", "[match implies]") { - static_assert(match::implies(test_matcher{}, match::always)); + STATIC_REQUIRE(match::implies(test_matcher{}, match::always)); } TEST_CASE("disambiguate: false => true", "[match implies]") { - static_assert(match::implies(match::never, match::always)); + STATIC_REQUIRE(match::implies(match::never, match::always)); } TEST_CASE("X => (X ∨ Y)", "[match implies]") { - static_assert( + STATIC_REQUIRE( match::implies(test_matcher{}, match::or_t>{})); } TEST_CASE("recursive: X => (Y ∨ (X ∨ Z))", "[match implies]") { - static_assert(match::implies( + STATIC_REQUIRE(match::implies( test_matcher{}, match::or_t, match::or_t>>{})); } TEST_CASE("(X ∧ Y) => X", "[match implies]") { - static_assert(match::implies(match::and_t>{}, - test_matcher{})); + STATIC_REQUIRE(match::implies(match::and_t>{}, + test_matcher{})); } TEST_CASE("recursive: (Y ∧ (X ∧ Z)) => X", "[match implies]") { - static_assert(match::implies( + STATIC_REQUIRE(match::implies( match::and_t, match::and_t>>{}, test_matcher{})); } @@ -45,5 +45,5 @@ TEST_CASE("recursive: (Y ∧ (X ∧ Z)) => X", "[match implies]") { TEST_CASE("ambiguity between X => or, and => X", "[match implies]") { using T1 = match::and_t, test_m<1>>; using T2 = match::or_t, test_m<1>>; - static_assert(match::implies(T1{}, T2{})); + STATIC_REQUIRE(match::implies(T1{}, T2{})); } diff --git a/test/match/not.cpp b/test/match/not.cpp index 3ff9479e..947e7115 100644 --- a/test/match/not.cpp +++ b/test/match/not.cpp @@ -10,28 +10,29 @@ TEST_CASE("NOT fulfils matcher concept", "[match not]") { using T = decltype(not test_matcher{}); - static_assert(match::matcher); - static_assert(match::matcher_for); + STATIC_REQUIRE(match::matcher); + STATIC_REQUIRE(match::matcher_for); } TEST_CASE("NOT describes itself", "[match not]") { constexpr auto e = not test_matcher{}; - static_assert(e.describe() == - stdx::ct_format<"not ({})">(test_m<0>{}.describe())); + STATIC_REQUIRE(e.describe() == + stdx::ct_format<"not ({})">(test_m<0>{}.describe())); } TEST_CASE("NOT describes a match", "[match not]") { constexpr auto e = not test_matcher{}; - static_assert(e.describe_match(1) == stdx::ct_format<"not ({})">( - test_matcher{}.describe_match(1))); + STATIC_REQUIRE( + e.describe_match(1) == + stdx::ct_format<"not ({})">(test_matcher{}.describe_match(1))); } TEST_CASE("NOT matches correctly", "[match not]") { - static_assert((not test_matcher{})(0)); - static_assert(not(not test_matcher{})(1)); + STATIC_REQUIRE((not test_matcher{})(0)); + STATIC_REQUIRE(not(not test_matcher{})(1)); } TEST_CASE("NOT simplifies correctly", "[match not]") { constexpr auto e = not not test_matcher{}; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } diff --git a/test/match/or.cpp b/test/match/or.cpp index 1ff0ac00..5169cad7 100644 --- a/test/match/or.cpp +++ b/test/match/or.cpp @@ -10,35 +10,35 @@ TEST_CASE("OR fulfils matcher concept", "[match or]") { using T = match::or_t; - static_assert(match::matcher); - static_assert(match::matcher_for); + STATIC_REQUIRE(match::matcher); + STATIC_REQUIRE(match::matcher_for); } TEST_CASE("OR describes itself", "[match or]") { constexpr auto e = test_m<0>{} or test_m<1>{}; - static_assert(e.describe() == - stdx::ct_format<"({}) or ({})">(test_m<0>{}.describe(), - test_m<1>{}.describe())); + STATIC_REQUIRE(e.describe() == + stdx::ct_format<"({}) or ({})">(test_m<0>{}.describe(), + test_m<1>{}.describe())); } TEST_CASE("OR description flattens", "[match or]") { constexpr auto e = test_m<0>{} or test_m<1>{} or test_m<2>{}; - static_assert(e.describe() == stdx::ct_format<"({}) or ({}) or ({})">( - test_m<0>{}.describe(), - test_m<1>{}.describe(), - test_m<2>{}.describe())); + STATIC_REQUIRE(e.describe() == stdx::ct_format<"({}) or ({}) or ({})">( + test_m<0>{}.describe(), + test_m<1>{}.describe(), + test_m<2>{}.describe())); } TEST_CASE("OR describes a match", "[match or]") { constexpr auto e = test_m<0>{} or test_m<1>{}; - static_assert(e.describe_match(1) == stdx::ct_format<"({}) or ({})">( - test_m<0>{}.describe_match(1), - test_m<1>{}.describe_match(1))); + STATIC_REQUIRE(e.describe_match(1) == stdx::ct_format<"({}) or ({})">( + test_m<0>{}.describe_match(1), + test_m<1>{}.describe_match(1))); } TEST_CASE("OR match description flattens", "[match or]") { constexpr auto e = test_m<0>{} or test_m<1>{} or test_m<2>{}; - static_assert( + STATIC_REQUIRE( e.describe_match(1) == stdx::ct_format<"({}) or ({}) or ({})">(test_m<0>{}.describe_match(1), test_m<1>{}.describe_match(1), @@ -47,19 +47,19 @@ TEST_CASE("OR match description flattens", "[match or]") { TEST_CASE("OR matches correctly", "[match or]") { constexpr auto e = test_m<0>{} or test_m<1>{}; - static_assert( + STATIC_REQUIRE( std::is_same_v, test_m<1>> const>); - static_assert(e(1)); - static_assert(not e(0)); + STATIC_REQUIRE(e(1)); + STATIC_REQUIRE(not e(0)); } TEST_CASE("OR simplifies correctly", "[match or]") { constexpr auto e = test_matcher{} and test_matcher{}; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("any expression simplifies", "[match or]") { constexpr auto m = match::any(test_m<0>{}, test_m<1>{}, match::never); - static_assert( + STATIC_REQUIRE( std::is_same_v, test_m<1>> const>); } diff --git a/test/match/predicate.cpp b/test/match/predicate.cpp index 7d9f9149..bd084d3f 100644 --- a/test/match/predicate.cpp +++ b/test/match/predicate.cpp @@ -8,27 +8,27 @@ TEST_CASE("predicate fulfils matcher concepts", "[match predicate]") { [[maybe_unused]] constexpr auto p = match::predicate<"P">([](int) { return true; }); - static_assert(match::matcher); - static_assert(match::matcher_for); - static_assert(not match::matcher_for); + STATIC_REQUIRE(match::matcher); + STATIC_REQUIRE(match::matcher_for); + STATIC_REQUIRE(not match::matcher_for); } TEST_CASE("predicate describes itself", "[match predicate]") { using namespace stdx::literals; [[maybe_unused]] constexpr auto p = match::predicate<"P">([](int) { return true; }); - static_assert(p.describe() == "P"_ctst); + STATIC_REQUIRE(p.describe() == "P"_ctst); } TEST_CASE("unnamed predicate", "[match predicate]") { using namespace stdx::literals; [[maybe_unused]] constexpr auto p = match::predicate([](int) { return true; }); - static_assert(p.describe() == ""_ctst); + STATIC_REQUIRE(p.describe() == ""_ctst); } TEST_CASE("predicate matches correctly", "[match predicate]") { constexpr auto p = match::predicate([](int i) { return i % 2 == 0; }); - static_assert(p(0)); - static_assert(not p(1)); + STATIC_REQUIRE(p(0)); + STATIC_REQUIRE(not p(1)); } diff --git a/test/match/simplify_and.cpp b/test/match/simplify_and.cpp index b9918f8e..77e6bfdc 100644 --- a/test/match/simplify_and.cpp +++ b/test/match/simplify_and.cpp @@ -11,66 +11,66 @@ using namespace match; TEST_CASE("Idempotence: X ∧ X -> X", "[match simplify and]") { constexpr auto e = and_t{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Right complementation: X ∧ ¬X -> F", "[match simplify and]") { constexpr auto e = and_t>{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Left complementation: ¬X ∧ X -> F", "[match simplify and]") { constexpr auto e = and_t>{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Right identity: X ∧ T -> X", "[match simplify and]") { constexpr auto e = and_t{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Left identity: T ∧ X -> X", "[match simplify and]") { constexpr auto e = and_t{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Right annihilation: X ∧ F -> F", "[match simplify and]") { constexpr auto e = and_t{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Left annihilation: F ∧ X -> F", "[match simplify and]") { constexpr auto e = and_t{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Left absorption: X ∧ (X ∨ Y) -> X", "[match simplify and]") { constexpr auto e = and_t, or_t, test_m<1>>>{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v const>); + STATIC_REQUIRE(std::is_same_v const>); } TEST_CASE("Right absorption: (X ∨ Y) ∧ X -> X", "[match simplify and]") { constexpr auto e = and_t, test_m<1>>, test_m<0>>{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v const>); + STATIC_REQUIRE(std::is_same_v const>); } TEST_CASE("De Morgan's Law: ¬X ∧ ¬Y -> ¬(X ∨ Y)", "[match simplify and]") { constexpr auto e = and_t>, not_t>>{}; constexpr auto s = simplify(e); - static_assert( + STATIC_REQUIRE( std::is_same_v, test_m<1>>> const>); } TEST_CASE("AND simplifies recursively", "[match simplify and]") { constexpr auto e = and_t>{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } diff --git a/test/match/simplify_custom.cpp b/test/match/simplify_custom.cpp index 81593a8f..bcfd8214 100644 --- a/test/match/simplify_custom.cpp +++ b/test/match/simplify_custom.cpp @@ -11,22 +11,22 @@ using namespace match; TEST_CASE("custom matcher simplifies (NOT)", "[match simplify]") { constexpr auto e = not rel_matcher, 5>{}; - static_assert(std::is_same_v, 5> const>); + STATIC_REQUIRE(std::is_same_v, 5> const>); } TEST_CASE("custom matcher simplifies (AND negative terms)", "[match simplify]") { constexpr auto e = rel_matcher, 5>{} and rel_matcher, 5>{}; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("custom matcher simplifies (AND subsumptive terms)", "[match simplify]") { constexpr auto e = rel_matcher, 5>{} and rel_matcher, 3>{}; - static_assert( + STATIC_REQUIRE( std::is_same_v, 3> const>); } @@ -34,7 +34,7 @@ TEST_CASE("custom matcher simplifies (AND exclusive terms)", "[match simplify]") { constexpr auto e = rel_matcher, 5>{} and rel_matcher, 4>{}; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("custom matcher simplifies (exclusive terms inside AND)", @@ -42,26 +42,26 @@ TEST_CASE("custom matcher simplifies (exclusive terms inside AND)", constexpr auto e = rel_matcher, 5>{} and rel_matcher, 10>{} and rel_matcher, 4>{}; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("custom matcher simplifies (OR)", "[match simplify]") { constexpr auto e = rel_matcher, 5>{} or rel_matcher, 5>{}; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("custom matcher simplifies (OR negative terms)", "[match simplify]") { constexpr auto e = rel_matcher, 5>{} or rel_matcher, 5>{}; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("custom matcher simplifies (OR subsumptive terms)", "[match simplify]") { constexpr auto e = rel_matcher, 5>{} or rel_matcher, 3>{}; - static_assert( + STATIC_REQUIRE( std::is_same_v, 5> const>); } @@ -69,7 +69,7 @@ TEST_CASE("custom matcher simplifies (OR overlapping terms)", "[match simplify]") { constexpr auto e = rel_matcher, 5>{} or rel_matcher, 4>{}; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("custom matcher simplifies (overlapping terms inside OR)", @@ -77,5 +77,5 @@ TEST_CASE("custom matcher simplifies (overlapping terms inside OR)", constexpr auto e = rel_matcher, 5>{} or rel_matcher, 10>{} or rel_matcher, 4>{}; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } diff --git a/test/match/simplify_not.cpp b/test/match/simplify_not.cpp index b93daa2a..add6e595 100644 --- a/test/match/simplify_not.cpp +++ b/test/match/simplify_not.cpp @@ -11,17 +11,17 @@ using namespace match; TEST_CASE("Negate true: ¬T -> F", "[match simplify not]") { constexpr auto e = not_t{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Negate false: ¬F -> T", "[match simplify not]") { constexpr auto e = not_t{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Double negation: ¬¬X -> X", "[match simplify not]") { constexpr auto e = not_t>{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } diff --git a/test/match/simplify_or.cpp b/test/match/simplify_or.cpp index 40877ecd..3ded9b07 100644 --- a/test/match/simplify_or.cpp +++ b/test/match/simplify_or.cpp @@ -11,66 +11,66 @@ using namespace match; TEST_CASE("Idempotence: X ∨ X -> X", "[match simplify or]") { constexpr auto e = or_t{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Right complementation: X ∨ ¬X -> T", "[match simplify or]") { constexpr auto e = or_t>{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Left complementation: ¬X ∨ X -> F", "[match simplify or]") { constexpr auto e = or_t>{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Right annihilation: X ∨ T -> T", "[match simplify or]") { constexpr auto e = or_t{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Left annihilation: T ∨ X -> T", "[match simplify or]") { constexpr auto e = or_t{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Right identity: X ∨ F -> X", "[match simplify or]") { constexpr auto e = or_t{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Left identity: F ∨ X -> X", "[match simplify or]") { constexpr auto e = or_t{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Left absorption: X ∨ (X ∧ Y) -> X", "[match simplify or]") { constexpr auto e = or_t, and_t, test_m<1>>>{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v const>); + STATIC_REQUIRE(std::is_same_v const>); } TEST_CASE("Right absorption: (X ∧ Y) ∨ X -> X", "[match simplify or]") { constexpr auto e = or_t, test_m<1>>, test_m<0>>{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v const>); + STATIC_REQUIRE(std::is_same_v const>); } TEST_CASE("De Morgan's Law: ¬X ∨ ¬Y -> ¬(X ∧ Y)", "[match simplify or]") { constexpr auto e = or_t>, not_t>>{}; constexpr auto s = simplify(e); - static_assert( + STATIC_REQUIRE( std::is_same_v, test_m<1>>> const>); } TEST_CASE("OR simplifies recursively", "[match simplify or]") { constexpr auto e = or_t>{}; constexpr auto s = simplify(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } diff --git a/test/match/sum_of_products.cpp b/test/match/sum_of_products.cpp index 658447e2..13e71254 100644 --- a/test/match/sum_of_products.cpp +++ b/test/match/sum_of_products.cpp @@ -12,19 +12,19 @@ using namespace match; TEST_CASE("Single term: X -> X", "[match sum of products]") { constexpr auto e = test_matcher{}; constexpr auto s = sum_of_products(e); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("Negation: ¬X -> ¬X", "[match sum of products]") { constexpr auto e = not_t{}; constexpr auto s = sum_of_products(e); - static_assert(std::is_same_v const>); + STATIC_REQUIRE(std::is_same_v const>); } TEST_CASE("Disjunction: X ∨ Y -> X ∨ Y", "[match sum of products]") { constexpr auto e = or_t, test_m<1>>{}; constexpr auto s = sum_of_products(e); - static_assert( + STATIC_REQUIRE( std::is_same_v, test_m<1>> const>); } @@ -32,7 +32,7 @@ TEST_CASE("Left distributive law: X ∧ (Y ∨ Z) -> (X ∧ Y) ∨ (X ∧ Z)", "[match sum of products]") { constexpr auto e = and_t, or_t, test_m<2>>>{}; constexpr auto s = sum_of_products(e); - static_assert( + STATIC_REQUIRE( std::is_same_v, test_m<1>>, and_t, test_m<2>>> const>); } @@ -41,7 +41,7 @@ TEST_CASE("Right distributive law: (X ∨ Y) ∧ Z -> (X ∧ Z) ∨ (Y ∧ Z)", "[match sum of products]") { constexpr auto e = and_t, test_m<1>>, test_m<2>>{}; constexpr auto s = sum_of_products(e); - static_assert( + STATIC_REQUIRE( std::is_same_v, test_m<2>>, and_t, test_m<2>>> const>); } @@ -52,7 +52,7 @@ TEST_CASE("Binary distributive law: (A ∨ B) ∧ (X ∨ Y) -> (A ∧ X) ∨ (A constexpr auto e = and_t, test_m<1>>, or_t, test_m<3>>>{}; constexpr auto s = sum_of_products(e); - static_assert( + STATIC_REQUIRE( std::is_same_v< decltype(s), or_t, test_m<2>>, and_t, test_m<3>>>, @@ -66,17 +66,17 @@ TEST_CASE( constexpr auto e = or_t, and_t, or_t, test_m<3>>>>{}; constexpr auto s = sum_of_products(simplify(e)); - static_assert(std::is_same_v< - decltype(s), - or_t, or_t, test_m<2>>, - and_t, test_m<3>>>> const>); + STATIC_REQUIRE(std::is_same_v< + decltype(s), + or_t, or_t, test_m<2>>, + and_t, test_m<3>>>> const>); } TEST_CASE("Push negation inside conjunction: ¬(X ∧ Y) -> ¬X ∨ ¬Y", "[match sum of products]") { constexpr auto e = not_t, test_m<1>>>{}; constexpr auto s = sum_of_products(e); - static_assert( + STATIC_REQUIRE( std::is_same_v>, not_t>> const>); } @@ -85,7 +85,7 @@ TEST_CASE("Push negation inside disjunction: ¬(X ∨ Y) -> ¬X ∧ ¬Y", "[match sum of products]") { constexpr auto e = not_t, test_m<1>>>{}; constexpr auto s = sum_of_products(e); - static_assert( + STATIC_REQUIRE( std::is_same_v>, not_t>> const>); } @@ -94,7 +94,7 @@ TEST_CASE("Recursive inside NOT: ¬(X ∧ (Y ∨ Z)) -> ¬X ∨ (¬Y ∧ ¬Z)", "[match sum of products]") { constexpr auto e = not_t, or_t, test_m<2>>>>{}; constexpr auto s = sum_of_products(e); - static_assert( + STATIC_REQUIRE( std::is_same_v>, and_t>, not_t>>> const>); @@ -104,7 +104,7 @@ TEST_CASE("Recursive inside AND: ¬(X ∨ Y) ∧ Z -> ¬X ∧ ¬Y ∧ ¬Z", "[match sum of products]") { constexpr auto e = and_t, test_m<1>>>, test_m<2>>{}; constexpr auto s = sum_of_products(e); - static_assert( + STATIC_REQUIRE( std::is_same_v< decltype(s), and_t>, not_t>>, test_m<2>> const>); diff --git a/test/msg/callback.cpp b/test/msg/callback.cpp index 56b89f06..f43529ef 100644 --- a/test/msg/callback.cpp +++ b/test/msg/callback.cpp @@ -230,42 +230,42 @@ constexpr auto expect_matcher = expect_matcher_t{}; TEST_CASE("alternative matcher syntax (inequality)", "[callback]") { auto callback = msg::callback<"cb", msg_defn>("id"_field != msg::constant<0x80>, [] {}); - static_assert(expect_matcher, 0x80>( + STATIC_REQUIRE(expect_matcher, 0x80>( typename decltype(callback)::matcher_t{})); } TEST_CASE("alternative matcher syntax (less)", "[callback]") { auto callback = msg::callback<"cb", msg_defn>("id"_field < msg::constant<0x80>, [] {}); - static_assert(expect_matcher, 0x80>( + STATIC_REQUIRE(expect_matcher, 0x80>( typename decltype(callback)::matcher_t{})); } TEST_CASE("alternative matcher syntax (less than or equal)", "[callback]") { auto callback = msg::callback<"cb", msg_defn>("id"_field <= msg::constant<0x80>, [] {}); - static_assert(expect_matcher, 0x80>( + STATIC_REQUIRE(expect_matcher, 0x80>( typename decltype(callback)::matcher_t{})); } TEST_CASE("alternative matcher syntax (greater)", "[callback]") { auto callback = msg::callback<"cb", msg_defn>("id"_field > msg::constant<0x80>, [] {}); - static_assert(expect_matcher, 0x80>( + STATIC_REQUIRE(expect_matcher, 0x80>( typename decltype(callback)::matcher_t{})); } TEST_CASE("alternative matcher syntax (greater than or equal)", "[callback]") { auto callback = msg::callback<"cb", msg_defn>("id"_field >= msg::constant<0x80>, [] {}); - static_assert(expect_matcher, 0x80>( + STATIC_REQUIRE(expect_matcher, 0x80>( typename decltype(callback)::matcher_t{})); } TEST_CASE("alternative matcher syntax (not)", "[callback]") { auto callback = msg::callback<"cb", msg_defn>( not("id"_field < msg::constant<0x80>), [] {}); - static_assert(expect_matcher, 0x80>( + STATIC_REQUIRE(expect_matcher, 0x80>( typename decltype(callback)::matcher_t{})); } @@ -273,7 +273,7 @@ TEST_CASE("alternative matcher syntax (and)", "[callback]") { auto callback = msg::callback<"cb", msg_defn>( "id"_field > msg::constant<0x80> and "id"_field > msg::constant<0x90>, [] {}); - static_assert(expect_matcher, 0x90>( + STATIC_REQUIRE(expect_matcher, 0x90>( typename decltype(callback)::matcher_t{})); } @@ -281,7 +281,7 @@ TEST_CASE("alternative matcher syntax (or)", "[callback]") { auto callback = msg::callback<"cb", msg_defn>( "id"_field > msg::constant<0x80> or "id"_field > msg::constant<0x90>, [] {}); - static_assert(expect_matcher, 0x80>( + STATIC_REQUIRE(expect_matcher, 0x80>( typename decltype(callback)::matcher_t{})); } @@ -289,23 +289,23 @@ TEST_CASE("alternative matcher syntax (multi-field)", "[callback]") { auto callback = msg::callback<"cb", msg_defn>( "id"_field == msg::constant<0x80> and "f1"_field == msg::constant<1>, [] {}); - static_assert(std::same_as, - msg::equal_to_t>>); + STATIC_REQUIRE(std::same_as, + msg::equal_to_t>>); } TEST_CASE("alternative matcher syntax (value in set)", "[callback]") { auto callback = msg::callback<"cb", msg_defn>("id"_field.in<0x80, 0x90>, [] {}); - static_assert(std::same_as, - msg::equal_to_t>>); + STATIC_REQUIRE(std::same_as, + msg::equal_to_t>>); } TEST_CASE("alternative matcher syntax (value in singleton)", "[callback]") { auto callback = msg::callback<"cb", msg_defn>("id"_field.in<0x80>, [] {}); - static_assert(std::same_as>); + STATIC_REQUIRE(std::same_as>); } TEST_CASE("alternative matcher syntax (and-combine matcher with matcher maker)", diff --git a/test/msg/fail/message_dangling_view.cpp b/test/msg/fail/message_dangling_view.cpp index 5350a163..8578f0ae 100644 --- a/test/msg/fail/message_dangling_view.cpp +++ b/test/msg/fail/message_dangling_view.cpp @@ -15,6 +15,6 @@ auto main() -> int { #if defined(__clang__) [[maybe_unused]] auto v = msg::owning{}.as_const_view(); #else - static_assert(false, "-Wdangling"); + STATIC_REQUIRE(false, "-Wdangling"); #endif } diff --git a/test/msg/field_insert.cpp b/test/msg/field_insert.cpp index b99caf39..ec49ab20 100644 --- a/test/msg/field_insert.cpp +++ b/test/msg/field_insert.cpp @@ -152,7 +152,7 @@ TEST_CASE("trivially_copyable field type ", "[field insert]") { TEST_CASE("value fits in field", "[field insert]") { using F = field<"", std::uint32_t>::located; - static_assert(F::can_hold(15)); + STATIC_REQUIRE(F::can_hold(15)); CHECK(F::can_hold(15)); CHECK(not F::can_hold(16)); } @@ -160,7 +160,7 @@ TEST_CASE("value fits in field", "[field insert]") { TEST_CASE("value fits in split field", "[field insert]") { using F = field<"", std::uint32_t>::located; - static_assert(F::can_hold(15)); + STATIC_REQUIRE(F::can_hold(15)); CHECK(F::can_hold(15)); CHECK(not F::can_hold(16)); } diff --git a/test/msg/field_matchers.cpp b/test/msg/field_matchers.cpp index 0dfd8c0a..e94dbceb 100644 --- a/test/msg/field_matchers.cpp +++ b/test/msg/field_matchers.cpp @@ -22,7 +22,7 @@ TEST_CASE("matcher description", "[field matchers]") { using namespace stdx::literals; constexpr auto m = msg::less_than_t{}; constexpr auto desc = m.describe(); - static_assert(desc.str == "test_field < 0x5"_ctst); + STATIC_REQUIRE(desc.str == "test_field < 0x5"_ctst); } TEST_CASE("matcher description of match", "[field matchers]") { @@ -31,15 +31,15 @@ TEST_CASE("matcher description of match", "[field matchers]") { constexpr auto m = msg::less_than_t{}; constexpr auto desc = m.describe_match(msg_data{0x01ff'ffff}); - static_assert(desc.str == "test_field (0x{:x}) < 0x5"_ctst); - static_assert(desc.args == stdx::tuple{1}); + STATIC_REQUIRE(desc.str == "test_field (0x{:x}) < 0x5"_ctst); + STATIC_REQUIRE(desc.args == stdx::tuple{1}); } TEST_CASE("matcher description (enum field)", "[field matchers]") { using namespace stdx::literals; constexpr auto m = msg::less_than_t{}; constexpr auto desc = m.describe(); - static_assert(desc.str == "enum_field < C"_ctst); + STATIC_REQUIRE(desc.str == "enum_field < C"_ctst); } TEST_CASE("matcher description of match (enum field)", "[field matchers]") { @@ -48,14 +48,14 @@ TEST_CASE("matcher description of match (enum field)", "[field matchers]") { constexpr auto m = msg::less_than_t{}; constexpr auto desc = m.describe_match(msg_data{0x01ff'ffff}); - static_assert(desc.str == "enum_field ({}) < C"_ctst); - static_assert(desc.args == stdx::tuple{E::B}); + STATIC_REQUIRE(desc.str == "enum_field ({}) < C"_ctst); + STATIC_REQUIRE(desc.args == stdx::tuple{E::B}); } TEST_CASE("negate less_than", "[field matchers]") { constexpr auto m = msg::less_than_t{}; constexpr auto n = match::negate(m); - static_assert( + STATIC_REQUIRE( std::is_same_v const>); } @@ -63,7 +63,7 @@ TEST_CASE("negate less_than", "[field matchers]") { TEST_CASE("negate greater_than", "[field matchers]") { constexpr auto m = msg::greater_than_t{}; constexpr auto n = match::negate(m); - static_assert( + STATIC_REQUIRE( std::is_same_v const>); } @@ -71,168 +71,168 @@ TEST_CASE("negate greater_than", "[field matchers]") { TEST_CASE("negate less_than_or_equal_to", "[field matchers]") { constexpr auto m = msg::less_than_or_equal_to_t{}; constexpr auto n = match::negate(m); - static_assert( + STATIC_REQUIRE( std::is_same_v const>); } TEST_CASE("negate greater_than_or_equal_to", "[field matchers]") { constexpr auto m = msg::greater_than_or_equal_to_t{}; constexpr auto n = match::negate(m); - static_assert( + STATIC_REQUIRE( std::is_same_v const>); } TEST_CASE("negate equal_to", "[field matchers]") { constexpr auto m = msg::equal_to_t{}; constexpr auto n = match::negate(m); - static_assert( + STATIC_REQUIRE( std::is_same_v const>); } TEST_CASE("negate not_equal_to", "[field matchers]") { constexpr auto m = msg::not_equal_to_t{}; constexpr auto n = match::negate(m); - static_assert( + STATIC_REQUIRE( std::is_same_v const>); } TEST_CASE("less_than X implies less_than Y (X == Y)", "[field matchers]") { constexpr auto m = msg::less_than_t{}; constexpr auto n = msg::less_than_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("less_than X implies less_than Y (X <= Y)", "[field matchers]") { constexpr auto m = msg::less_than_t{}; constexpr auto n = msg::less_than_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("greater_than X implies greater_than Y (X >= Y)", "[field matchers]") { constexpr auto m = msg::greater_than_t{}; constexpr auto n = msg::greater_than_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("less_than_or_equal_to X implies less_than Y (X < Y)", "[field matchers]") { constexpr auto m = msg::less_than_or_equal_to_t{}; constexpr auto n = msg::less_than_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("less_than X implies less_than_or_equal_to Y (X <= Y + 1)", "[field matchers]") { constexpr auto m = msg::less_than_t{}; constexpr auto n = msg::less_than_or_equal_to_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("greater_than_or_equal_to X implies greater_than Y (X > Y)", "[field matchers]") { constexpr auto m = msg::greater_than_or_equal_to_t{}; constexpr auto n = msg::greater_than_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("greater_than X implies greater_than_or_equal_to Y (X + 1 >= Y)", "[field matchers]") { constexpr auto m = msg::greater_than_t{}; constexpr auto n = msg::greater_than_or_equal_to_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("equal_to X implies less_than Y (X < Y)", "[field matchers]") { constexpr auto m = msg::equal_to_t{}; constexpr auto n = msg::less_than_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("equal_to X implies less_than_or_equal_to Y (X <= Y)", "[field matchers]") { constexpr auto m = msg::equal_to_t{}; constexpr auto n = msg::less_than_or_equal_to_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("equal_to X implies greater_than Y (X > Y)", "[field matchers]") { constexpr auto m = msg::equal_to_t{}; constexpr auto n = msg::greater_than_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("equal_to X implies greater_than_or_equal_to Y (X >= Y)", "[field matchers]") { constexpr auto m = msg::equal_to_t{}; constexpr auto n = msg::greater_than_or_equal_to_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("equal_to X implies not equal_to Y (X != Y)", "[field matchers]") { constexpr auto m = msg::equal_to_t{}; constexpr auto n = not msg::equal_to_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("equal_to X and equal_to Y is false (X != Y)", "[field matchers]") { constexpr auto m = msg::equal_to_t{} and msg::equal_to_t{}; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("equal_to X and not equal_to Y is equal_to X (X != Y)", "[field matchers]") { constexpr auto m = msg::equal_to_t{} and not msg::equal_to_t{}; - static_assert( + STATIC_REQUIRE( std::is_same_v const>); } TEST_CASE("equal_to X and less_than X is false (X != Y)", "[field matchers]") { constexpr auto m = msg::equal_to_t{} and msg::less_than_t{}; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("equal_to X and less_than Y is equal_to X (X < Y)", "[field matchers]") { constexpr auto m = msg::equal_to_t{} and msg::less_than_t{}; - static_assert( + STATIC_REQUIRE( std::is_same_v const>); } TEST_CASE("less_than X implies not_equal_to X", "[field matchers]") { constexpr auto m = msg::less_than_t{}; constexpr auto n = msg::not_equal_to_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("greater_than X implies not_equal_to X", "[field matchers]") { constexpr auto m = msg::greater_than_t{}; constexpr auto n = msg::not_equal_to_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("less_than_or_equal_to X implies not_equal_to X", "[field matchers]") { constexpr auto m = msg::less_than_or_equal_to_t{}; constexpr auto n = msg::not_equal_to_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("greater_than_or_equal_to X implies not_equal_to X", "[field matchers]") { constexpr auto m = msg::greater_than_or_equal_to_t{}; constexpr auto n = msg::not_equal_to_t{}; - static_assert(match::implies(m, n)); + STATIC_REQUIRE(match::implies(m, n)); } TEST_CASE("not_equal_to X and less_than Y is less_than Y (X >= Y)", "[field matchers]") { constexpr auto m = msg::not_equal_to_t{} and msg::less_than_t{}; - static_assert( + STATIC_REQUIRE( std::is_same_v const>); } diff --git a/test/msg/indexed_callback.cpp b/test/msg/indexed_callback.cpp index 672a69f7..7e903640 100644 --- a/test/msg/indexed_callback.cpp +++ b/test/msg/indexed_callback.cpp @@ -45,7 +45,7 @@ TEST_CASE("callback with compound match", "[indexed_callback]") { TEST_CASE("callback is sum of products", "[indexed_callback]") { constexpr auto cb = msg::callback<"", msg_defn>( msg::equal_to and msg::in, [](auto) {}); - static_assert( + STATIC_REQUIRE( std::is_same_v< decltype(cb.matcher), match::or_t< @@ -108,7 +108,7 @@ TEST_CASE("remove an indexed term from a callback", "[indexed_callback]") { msg::equal_to and msg::in, [](auto) {}); constexpr auto sut = msg::remove_match_terms(cb); - static_assert( + STATIC_REQUIRE( std::is_same_v< decltype(sut.matcher), match::or_t, equal_to_t>>); @@ -120,7 +120,7 @@ TEST_CASE("remove multiple indexed terms from a callback", msg::equal_to and msg::in, [](auto) {}); constexpr auto sut = msg::remove_match_terms(cb); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } namespace { @@ -134,8 +134,8 @@ TEST_CASE("separate sum terms in a callback", "[indexed_callback]") { CHECK(cb.matcher(msg_defn::owner_t{})); auto sut = msg::separate_sum_terms(cb); - static_assert(stdx::is_specialization_of_v); - static_assert(sut.size() == 2); + STATIC_REQUIRE(stdx::is_specialization_of_v); + STATIC_REQUIRE(sut.size() == 2); auto const &cb1 = stdx::get<0>(sut); auto const &cb2 = stdx::get<1>(sut); diff --git a/test/msg/message.cpp b/test/msg/message.cpp index 15d0842d..701a36ab 100644 --- a/test/msg/message.cpp +++ b/test/msg/message.cpp @@ -35,7 +35,8 @@ inline auto logging::config<> = TEST_CASE("message with automatic storage", "[message]") { test_msg msg{}; auto data = msg.data(); - static_assert(std::is_same_v>); + STATIC_REQUIRE( + std::is_same_v>); } TEST_CASE("message with custom storage", "[message]") { @@ -43,7 +44,7 @@ TEST_CASE("message with custom storage", "[message]") { msg_defn::owner_t msg{arr, "f1"_field = 0xba11}; CHECK(0x80 == msg.get("id"_field)); CHECK(0xba11 == msg.get("f1"_field)); - static_assert( + STATIC_REQUIRE( std::is_same_v); } @@ -53,8 +54,8 @@ TEST_CASE("message constructed from span", "[message]") { auto s = stdx::span{arr}; msg_defn::owner_t msg{s}; - static_assert(std::is_same_v>); + STATIC_REQUIRE(std::is_same_v>); msg.set("f1"_field = 0xba12); CHECK(0x8000'ba11 == arr[0]); } @@ -187,8 +188,8 @@ TEST_CASE("message constructed from view", "[message]") { msg::const_view v{arr}; msg_defn::owner_t msg{v}; - static_assert(std::is_same_v>); + STATIC_REQUIRE(std::is_same_v>); msg.set("f1"_field = 0xba12); CHECK(0x8000'ba11 == arr[0]); } @@ -208,7 +209,7 @@ TEST_CASE("implicit construct view from oversized storage", "[message]") { TEST_CASE("const view from owning message", "[message]") { test_msg msg{}; auto v = msg.as_const_view(); - static_assert( + STATIC_REQUIRE( std::is_same_v); msg.set("f1"_field = 0xba11); @@ -218,7 +219,7 @@ TEST_CASE("const view from owning message", "[message]") { TEST_CASE("mutable view from owning message", "[message]") { test_msg msg{}; auto v = msg.as_mutable_view(); - static_assert( + STATIC_REQUIRE( std::is_same_v); v.set("f1"_field = 0xba11); @@ -229,7 +230,7 @@ TEST_CASE("owning from view", "[message]") { test_msg msg{"f1"_field = 0xba11, "f2"_field = 0x42, "f3"_field = 0xd00d}; auto v = msg.as_mutable_view(); auto o = v.as_owning(); - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); CHECK(std::equal(msg.data().begin(), msg.data().end(), o.data().begin())); } @@ -237,7 +238,7 @@ TEST_CASE("const view from mutable view", "[message]") { test_msg msg{}; auto mv = msg.as_mutable_view(); auto v = mv.as_const_view(); - static_assert( + STATIC_REQUIRE( std::is_same_v); msg.set("f1"_field = 0xba11); @@ -415,10 +416,10 @@ TEST_CASE("view with external custom storage (oversized)", "[message]") { TEST_CASE("implicitly downsize a message view", "[message]") { auto const arr = std::array{0x8000'ba11, 0x0042'd00d}; msg_defn::view_t msg{arr}; - static_assert(std::is_same_v>); + STATIC_REQUIRE(std::is_same_v>); const_view v = msg; - static_assert( + STATIC_REQUIRE( std::is_same_v>); CHECK(msg.data()[0] == v.data()[0]); CHECK(msg.data()[1] == v.data()[1]); @@ -427,37 +428,37 @@ TEST_CASE("implicitly downsize a message view", "[message]") { TEST_CASE("view_of concept", "[message]") { auto const arr = std::array{0x8000'ba11, 0x0042'd00d}; msg_defn::view_t msg{arr}; - static_assert(msg::view_of); + STATIC_REQUIRE(msg::view_of); const_view v = msg; - static_assert(msg::view_of); - static_assert(msg::const_view_of); + STATIC_REQUIRE(msg::view_of); + STATIC_REQUIRE(msg::const_view_of); } TEST_CASE("message fields are canonically sorted by lsb", "[message]") { using defn = message<"msg", field2, field1>; - static_assert(std::is_same_v>); + STATIC_REQUIRE(std::is_same_v>); } TEST_CASE("extend message with more fields", "[message]") { using base_defn = message<"msg_base", id_field, field1>; using defn = extend; using expected_defn = message<"msg", id_field, field1, field2, field3>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("extend message with duplicate field", "[message]") { using base_defn = message<"msg_base", id_field, field1>; using defn = extend; using expected_defn = message<"msg", id_field, field1>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("extend message with new field constraint", "[message]") { using base_defn = message<"msg_base", id_field, field1>; using defn = extend>; using expected_defn = message<"msg", id_field, field1::with_required<1>>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("message equivalence (owning)", "[message]") { @@ -548,23 +549,23 @@ TEST_CASE("message equivalence matcher", "[message]") { } TEST_CASE("message reports size", "[message]") { - static_assert(msg_defn::size::value == 2); - static_assert(msg_defn::size::value == 4); - static_assert(msg_defn::size::value == 7); + STATIC_REQUIRE(msg_defn::size::value == 2); + STATIC_REQUIRE(msg_defn::size::value == 4); + STATIC_REQUIRE(msg_defn::size::value == 7); } TEST_CASE("shift a field by bit offset", "[message]") { using new_field = id_field::shifted_by<3>; using expected_field = field<"id", std::uint32_t>::located; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("shift a field by byte offset", "[message]") { using new_field = id_field::shifted_by<1, std::uint8_t>; using expected_field = field<"id", std::uint32_t>::located; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("shift all fields in a message", "[message]") { @@ -574,7 +575,7 @@ TEST_CASE("shift all fields in a message", "[message]") { using shifted_id = id_field::shifted_by<1, std::uint8_t>; using shifted_field1 = field1::shifted_by<1, std::uint8_t>; using expected_defn = message<"msg", shifted_id, shifted_field1>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("combine messages", "[message]") { @@ -590,7 +591,7 @@ TEST_CASE("combine messages", "[message]") { using expected_defn = message<"defn", f1, f2, f3::shifted_by<1, std::uint32_t>, f4::shifted_by<1, std::uint32_t>>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("combine 1 message", "[message]") { @@ -600,7 +601,7 @@ TEST_CASE("combine 1 message", "[message]") { using defn = combine<"defn", m1>; using expected_defn = message<"defn", f1, f2>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("pack messages", "[message]") { @@ -617,7 +618,7 @@ TEST_CASE("pack messages", "[message]") { message<"defn", f1, f2, f3::shifted_by::value, std::uint8_t>, f4::shifted_by::value, std::uint8_t>>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("pack 1 message", "[message]") { @@ -627,7 +628,7 @@ TEST_CASE("pack 1 message", "[message]") { using defn = pack<"defn", std::uint8_t, m1>; using expected_defn = message<"defn", f1, f2>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("pack with empty messages", "[message]") { @@ -648,7 +649,7 @@ TEST_CASE("pack with empty messages", "[message]") { message<"defn", f1, f2, f3::shifted_by::value, std::uint8_t>, f4::shifted_by::value, std::uint8_t>>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } namespace { @@ -666,14 +667,14 @@ namespace { } // namespace TEST_CASE("message with default empty environment", "[message]") { - static_assert(custom(msg_defn::env_t{}) == 42); + STATIC_REQUIRE(custom(msg_defn::env_t{}) == 42); } TEST_CASE("message with defined environment", "[message]") { using env_t = stdx::make_env_t; using defn = message<"msg", env_t, id_field::with_required<0x80>, field1, field2, field3>; - static_assert(custom(defn::env_t{}) == 17); + STATIC_REQUIRE(custom(defn::env_t{}) == 17); } TEST_CASE("supplement message environment", "[message]") { @@ -681,7 +682,7 @@ TEST_CASE("supplement message environment", "[message]") { using defn = message<"msg", env_t, id_field::with_required<0x80>, field1, field2, field3>; using new_defn = defn::with_env>; - static_assert(custom(new_defn::env_t{}) == 18); + STATIC_REQUIRE(custom(new_defn::env_t{}) == 18); } TEST_CASE("combine appends environments", "[message]") { @@ -692,7 +693,7 @@ TEST_CASE("combine appends environments", "[message]") { using m2 = message<"m2", env2_t>; using defn = combine<"defn", m1, m2>; - static_assert(custom(defn::env_t{}) == 18); + STATIC_REQUIRE(custom(defn::env_t{}) == 18); } TEST_CASE("pack appends environments", "[message]") { @@ -703,5 +704,5 @@ TEST_CASE("pack appends environments", "[message]") { using m2 = message<"m2", env2_t>; using defn = pack<"defn", std::uint8_t, m1, m2>; - static_assert(custom(defn::env_t{}) == 18); + STATIC_REQUIRE(custom(defn::env_t{}) == 18); } diff --git a/test/msg/relaxed_message.cpp b/test/msg/relaxed_message.cpp index 2581f441..0c519b1c 100644 --- a/test/msg/relaxed_message.cpp +++ b/test/msg/relaxed_message.cpp @@ -17,7 +17,7 @@ TEST_CASE("message with automatically packed fields", "[relaxed_message]") { using expected_defn = msg::message<"msg", auto_f1::located, auto_f2::located>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("automatically packed fields are sorted by size", @@ -26,7 +26,7 @@ TEST_CASE("automatically packed fields are sorted by size", using expected_defn = msg::message<"msg", auto_f1::located, auto_f2::located>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("message with mixed fixed and automatically packed fields", @@ -35,20 +35,20 @@ TEST_CASE("message with mixed fixed and automatically packed fields", using expected_defn = msg::message<"msg", fixed_f, auto_f1::located, auto_f2::located>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("message with no automatically packed fields", "[relaxed_message]") { using defn = relaxed_message<"msg", fixed_f>; using expected_defn = msg::message<"msg", fixed_f>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("auto field with default value", "[relaxed_message]") { using defn = relaxed_message<"msg", auto_f1::with_default<42>>; using expected_defn = msg::message< "msg", auto_f1::located::with_default<42>>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("auto field with const default value", "[relaxed_message]") { @@ -56,14 +56,14 @@ TEST_CASE("auto field with const default value", "[relaxed_message]") { using expected_defn = msg::message<"msg", auto_f1::located::with_const_default<42>>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } TEST_CASE("auto field without default value", "[relaxed_message]") { using defn = relaxed_message<"msg", auto_f1::without_default>; using expected_defn = msg::message< "msg", auto_f1::located::without_default>; - static_assert(std::is_same_v); + STATIC_REQUIRE(std::is_same_v); } namespace { @@ -82,11 +82,11 @@ namespace { TEST_CASE("message with default empty environment", "[relaxed_message]") { using defn = relaxed_message<"msg", auto_f1, auto_f2>; - static_assert(custom(defn::env_t{}) == 42); + STATIC_REQUIRE(custom(defn::env_t{}) == 42); } TEST_CASE("message with defined environment", "[message]") { using env_t = stdx::make_env_t; using defn = relaxed_message<"msg", env_t, auto_f1, auto_f2>; - static_assert(custom(defn::env_t{}) == 17); + STATIC_REQUIRE(custom(defn::env_t{}) == 17); }