Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/cib/builder_meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ struct test_builder_meta {
} // namespace

TEST_CASE("builder_meta concept") {
static_assert(cib::builder_meta<test_builder_meta>);
STATIC_REQUIRE(cib::builder_meta<test_builder_meta>);
}

TEST_CASE(
"builder_meta builder and interface type traits return correct values") {
static_assert(
STATIC_REQUIRE(
std::is_same_v<TestBuilder, cib::builder_t<test_builder_meta>>);
static_assert(
STATIC_REQUIRE(
std::is_same_v<TestInterface, cib::interface_t<test_builder_meta>>);
}
12 changes: 6 additions & 6 deletions test/flow/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions test/flow/graph_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions test/interrupt/dynamic_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ struct without_enable_field {};
} // namespace

TEST_CASE("detect enable_field", "[dynamic controller]") {
static_assert(interrupt::has_enable_field<with_enable_field>);
static_assert(not interrupt::has_enable_field<without_enable_field>);
STATIC_REQUIRE(interrupt::has_enable_field<with_enable_field>);
STATIC_REQUIRE(not interrupt::has_enable_field<without_enable_field>);
}

namespace {
Expand Down
18 changes: 9 additions & 9 deletions test/interrupt/irq_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<no_flows_config_t>);
STATIC_REQUIRE(interrupt::irq_config<no_flows_config_t>);
}

TEST_CASE("config can enable/disable its irq", "[irq_impl]") {
Expand All @@ -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<no_flows_config_t::status_policy_t,
interrupt::clear_status_first>);
STATIC_REQUIRE(std::is_same_v<no_flows_config_t::status_policy_t,
interrupt::clear_status_first>);
}

TEST_CASE("config status policy can be supplied", "[irq_impl]") {
using config_t =
interrupt::irq<42_irq, 17,
interrupt::policies<interrupt::clear_status_last>>;
static_assert(std::is_same_v<config_t::status_policy_t,
interrupt::clear_status_last>);
STATIC_REQUIRE(std::is_same_v<config_t::status_policy_t,
interrupt::clear_status_last>);
}

TEST_CASE("impl models concept", "[irq_impl]") {
using impl_t = interrupt::irq_impl<no_flows_config_t, test_nexus>;
static_assert(interrupt::irq_interface<impl_t>);
STATIC_REQUIRE(interrupt::irq_interface<impl_t>);
}

namespace {
Expand All @@ -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<flow_config_t<std::true_type>, test_nexus>;
static_assert(impl_t::active);
STATIC_REQUIRE(impl_t::active);
flow_run<std::true_type> = false;
impl_t::run();
CHECK(flow_run<std::true_type>);
Expand All @@ -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<flow_config_t<std::false_type>, 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<no_flows_config_t, test_nexus>;
static_assert(not impl_t::active);
STATIC_REQUIRE(not impl_t::active);
}

TEST_CASE("impl has no enable fields", "[irq_impl]") {
Expand Down
15 changes: 8 additions & 7 deletions test/interrupt/policies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
TEST_CASE("policies get", "[policies]") {
using policies_t = interrupt::policies<interrupt::clear_status_first>;
using default_policy_t = interrupt::clear_status_last;
static_assert(
STATIC_REQUIRE(
std::is_same_v<decltype(policies_t::get<interrupt::status_clear_policy,
default_policy_t>()),
interrupt::clear_status_first>);
static_assert(std::is_same_v<
decltype(policies_t::get<interrupt::required_resources_policy,
default_policy_t>()),
default_policy_t>);
STATIC_REQUIRE(
std::is_same_v<
decltype(policies_t::get<interrupt::required_resources_policy,
default_policy_t>()),
default_policy_t>);
}

TEST_CASE("clear status first policy", "[policies]") {
Expand Down Expand Up @@ -40,7 +41,7 @@ TEST_CASE("policy with required resources", "[policies]") {
using policies_t = interrupt::policies<interrupt::required_resources<int>>;
using P =
decltype(policies_t::get<interrupt::required_resources_policy, void>());
static_assert(interrupt::policy<P>);
static_assert(
STATIC_REQUIRE(interrupt::policy<P>);
STATIC_REQUIRE(
std::is_same_v<typename P::resources, interrupt::resource_list<int>>);
}
20 changes: 10 additions & 10 deletions test/interrupt/shared_irq_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using no_flows_config_t =
}

TEST_CASE("config models concept", "[shared_irq_impl]") {
static_assert(interrupt::irq_config<no_flows_config_t>);
STATIC_REQUIRE(interrupt::irq_config<no_flows_config_t>);
}

TEST_CASE("config can enable/disable its irq", "[shared_irq_impl]") {
Expand All @@ -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<no_flows_config_t::status_policy_t,
interrupt::clear_status_first>);
STATIC_REQUIRE(std::is_same_v<no_flows_config_t::status_policy_t,
interrupt::clear_status_first>);
}

TEST_CASE("config status policy can be supplied", "[shared_irq_impl]") {
using config_t = interrupt::shared_irq<
42_irq, 17, interrupt::policies<interrupt::clear_status_last>>;
static_assert(std::is_same_v<config_t::status_policy_t,
interrupt::clear_status_last>);
STATIC_REQUIRE(std::is_same_v<config_t::status_policy_t,
interrupt::clear_status_last>);
}

TEST_CASE("impl models concept", "[shared_irq_impl]") {
using impl_t = interrupt::shared_irq_impl<no_flows_config_t>;
static_assert(interrupt::irq_interface<impl_t>);
STATIC_REQUIRE(interrupt::irq_interface<impl_t>);
}

namespace {
Expand All @@ -61,7 +61,7 @@ TEST_CASE("impl runs a flow", "[shared_irq_impl]") {
interrupt::sub_irq_impl<sub_config_t<std::true_type, 0>, test_nexus>;
using impl_t =
interrupt::shared_irq_impl<flow_config_t<std::true_type>, 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;
Expand All @@ -88,7 +88,7 @@ TEST_CASE("impl is inactive when all subs are inactive", "[shared_irq_impl]") {
interrupt::sub_irq_impl<sub_config_t<std::false_type, 0>, test_nexus>;
using impl_t =
interrupt::shared_irq_impl<flow_config_t<std::true_type>, 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]") {
Expand All @@ -99,12 +99,12 @@ TEST_CASE("impl is active when any sub is active", "[shared_irq_impl]") {
using impl_t =
interrupt::shared_irq_impl<flow_config_t<std::true_type>,
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<flow_config_t<std::true_type>>;
static_assert(not impl_t::active);
STATIC_REQUIRE(not impl_t::active);
}

TEST_CASE("impl enable fields are active sub enable fields",
Expand Down
20 changes: 10 additions & 10 deletions test/interrupt/shared_sub_irq_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<no_flows_config_t>);
STATIC_REQUIRE(interrupt::sub_irq_config<no_flows_config_t>);
}

TEST_CASE("config default status policy is clear first",
"[shared_sub_irq_impl]") {
static_assert(std::is_same_v<no_flows_config_t::status_policy_t,
interrupt::clear_status_first>);
STATIC_REQUIRE(std::is_same_v<no_flows_config_t::status_policy_t,
interrupt::clear_status_first>);
}

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<interrupt::clear_status_last>>;
static_assert(std::is_same_v<config_t::status_policy_t,
interrupt::clear_status_last>);
STATIC_REQUIRE(std::is_same_v<config_t::status_policy_t,
interrupt::clear_status_last>);
}

TEST_CASE("impl models concept", "[shared_sub_irq_impl]") {
using impl_t = interrupt::shared_sub_irq_impl<no_flows_config_t>;
static_assert(interrupt::sub_irq_interface<impl_t>);
STATIC_REQUIRE(interrupt::sub_irq_interface<impl_t>);
}

namespace {
Expand All @@ -51,7 +51,7 @@ TEST_CASE("impl runs a flow", "[shared_sub_irq_impl]") {
interrupt::sub_irq_impl<sub_config_t<std::true_type, 1>, test_nexus>;
using impl_t = interrupt::shared_sub_irq_impl<flow_config_t<std::true_type>,
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;
Expand All @@ -68,7 +68,7 @@ TEST_CASE("impl is inactive when all subs are inactive",
interrupt::sub_irq_impl<sub_config_t<std::false_type, 1>, test_nexus>;
using impl_t = interrupt::shared_sub_irq_impl<flow_config_t<std::true_type>,
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]") {
Expand All @@ -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<flow_config_t<std::true_type>,
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<flow_config_t<std::true_type>>;
static_assert(not impl_t::active);
STATIC_REQUIRE(not impl_t::active);
}

TEST_CASE(
Expand Down
22 changes: 11 additions & 11 deletions test/interrupt/sub_irq_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ using no_flows_config_t =
} // namespace

TEST_CASE("config models concept", "[sub_irq_impl]") {
static_assert(interrupt::sub_irq_config<no_flows_config_t>);
STATIC_REQUIRE(interrupt::sub_irq_config<no_flows_config_t>);
}

TEST_CASE("config default status policy is clear first", "[sub_irq_impl]") {
static_assert(std::is_same_v<no_flows_config_t::status_policy_t,
interrupt::clear_status_first>);
STATIC_REQUIRE(std::is_same_v<no_flows_config_t::status_policy_t,
interrupt::clear_status_first>);
}

TEST_CASE("config status policy can be supplied", "[sub_irq_impl]") {
using config_t =
interrupt::sub_irq<enable_field_t<0>, status_field_t<0>,
interrupt::policies<interrupt::clear_status_last>>;
static_assert(std::is_same_v<config_t::status_policy_t,
interrupt::clear_status_last>);
STATIC_REQUIRE(std::is_same_v<config_t::status_policy_t,
interrupt::clear_status_last>);
}

TEST_CASE("impl models concept", "[sub_irq_impl]") {
using impl_t = interrupt::sub_irq_impl<no_flows_config_t, test_nexus>;
static_assert(interrupt::sub_irq_interface<impl_t>);
STATIC_REQUIRE(interrupt::sub_irq_interface<impl_t>);
}

namespace {
Expand All @@ -43,7 +43,7 @@ using flow_config_t = interrupt::sub_irq<enable_field_t<0>, status_field_t<0>,
TEST_CASE("impl runs a flow when enabled and status", "[sub_irq_impl]") {
using impl_t =
interrupt::sub_irq_impl<flow_config_t<std::true_type>, test_nexus>;
static_assert(impl_t::active);
STATIC_REQUIRE(impl_t::active);

enable_field_t<0>::value = true;
status_field_t<0>::value = true;
Expand All @@ -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<flow_config_t<std::true_type>, test_nexus>;
static_assert(impl_t::active);
STATIC_REQUIRE(impl_t::active);

enable_field_t<0>::value = false;
status_field_t<0>::value = true;
Expand All @@ -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<flow_config_t<std::true_type>, test_nexus>;
static_assert(impl_t::active);
STATIC_REQUIRE(impl_t::active);

enable_field_t<0>::value = true;
status_field_t<0>::value = false;
Expand All @@ -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<flow_config_t<std::false_type>, 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<no_flows_config_t, test_nexus>;
static_assert(not impl_t::active);
STATIC_REQUIRE(not impl_t::active);
}

TEST_CASE("impl reports one enable field when active", "[sub_irq_impl]") {
Expand Down
Loading
Loading