Skip to content

Commit 23b7b74

Browse files
authored
Merge pull request #734 from elbeno/use-static-require
2 parents a01f93b + da6916a commit 23b7b74

35 files changed

+376
-373
lines changed

test/cib/builder_meta.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ struct test_builder_meta {
1818
} // namespace
1919

2020
TEST_CASE("builder_meta concept") {
21-
static_assert(cib::builder_meta<test_builder_meta>);
21+
STATIC_REQUIRE(cib::builder_meta<test_builder_meta>);
2222
}
2323

2424
TEST_CASE(
2525
"builder_meta builder and interface type traits return correct values") {
26-
static_assert(
26+
STATIC_REQUIRE(
2727
std::is_same_v<TestBuilder, cib::builder_t<test_builder_meta>>);
28-
static_assert(
28+
STATIC_REQUIRE(
2929
std::is_same_v<TestInterface, cib::interface_t<test_builder_meta>>);
3030
}

test/flow/graph.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,30 @@ constexpr auto c = flow::action<"c">([] {});
2222

2323
TEST_CASE("node size (empty graph)", "[graph]") {
2424
constexpr auto g = flow::graph<>{};
25-
static_assert(node_size(g) == 0);
25+
STATIC_REQUIRE(node_size(g) == 0);
2626
}
2727

2828
TEST_CASE("node size (single action)", "[graph]") {
2929
constexpr auto g = flow::graph<>{}.add(*a >> *b);
30-
static_assert(node_size(g) == 2);
30+
STATIC_REQUIRE(node_size(g) == 2);
3131
}
3232

3333
TEST_CASE("node size (overlapping actions)", "[graph]") {
3434
constexpr auto g = flow::graph<>{}.add(*a >> *b).add(b >> *c);
35-
static_assert(node_size(g) == 3);
35+
STATIC_REQUIRE(node_size(g) == 3);
3636
}
3737

3838
TEST_CASE("edge size (empty flow)", "[graph]") {
3939
constexpr auto g = flow::graph<>{};
40-
static_assert(edge_size(g) == 1);
40+
STATIC_REQUIRE(edge_size(g) == 1);
4141
}
4242

4343
TEST_CASE("edge size (single action)", "[graph]") {
4444
constexpr auto g = flow::graph<>{}.add(*a >> *b);
45-
static_assert(edge_size(g) == 1);
45+
STATIC_REQUIRE(edge_size(g) == 1);
4646
}
4747

4848
TEST_CASE("edge size (overlapping actions)", "[graph]") {
4949
constexpr auto g = flow::graph<>{}.add(*a >> *b).add(*b >> *c);
50-
static_assert(edge_size(g) == 2);
50+
STATIC_REQUIRE(edge_size(g) == 2);
5151
}

test/flow/graph_builder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ TEST_CASE("add dependency rhs", "[graph_builder]") {
207207
}
208208

209209
TEST_CASE("reference vs non-reference", "[graph_builder]") {
210-
static_assert(a.identity == flow::subgraph_identity::REFERENCE);
211-
static_assert((*a).identity == flow::subgraph_identity::VALUE);
210+
STATIC_REQUIRE(a.identity == flow::subgraph_identity::REFERENCE);
211+
STATIC_REQUIRE((*a).identity == flow::subgraph_identity::VALUE);
212212
}
213213

214214
TEST_CASE("reference in order with non-reference added twice",

test/interrupt/dynamic_controller.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ struct without_enable_field {};
1515
} // namespace
1616

1717
TEST_CASE("detect enable_field", "[dynamic controller]") {
18-
static_assert(interrupt::has_enable_field<with_enable_field>);
19-
static_assert(not interrupt::has_enable_field<without_enable_field>);
18+
STATIC_REQUIRE(interrupt::has_enable_field<with_enable_field>);
19+
STATIC_REQUIRE(not interrupt::has_enable_field<without_enable_field>);
2020
}
2121

2222
namespace {

test/interrupt/irq_impl.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ using no_flows_config_t = interrupt::irq<42_irq, 17, interrupt::policies<>>;
1111
}
1212

1313
TEST_CASE("config models concept", "[irq_impl]") {
14-
static_assert(interrupt::irq_config<no_flows_config_t>);
14+
STATIC_REQUIRE(interrupt::irq_config<no_flows_config_t>);
1515
}
1616

1717
TEST_CASE("config can enable/disable its irq", "[irq_impl]") {
@@ -29,21 +29,21 @@ TEST_CASE("config enables its irq with priority", "[irq_impl]") {
2929
}
3030

3131
TEST_CASE("config default status policy is clear first", "[irq_impl]") {
32-
static_assert(std::is_same_v<no_flows_config_t::status_policy_t,
33-
interrupt::clear_status_first>);
32+
STATIC_REQUIRE(std::is_same_v<no_flows_config_t::status_policy_t,
33+
interrupt::clear_status_first>);
3434
}
3535

3636
TEST_CASE("config status policy can be supplied", "[irq_impl]") {
3737
using config_t =
3838
interrupt::irq<42_irq, 17,
3939
interrupt::policies<interrupt::clear_status_last>>;
40-
static_assert(std::is_same_v<config_t::status_policy_t,
41-
interrupt::clear_status_last>);
40+
STATIC_REQUIRE(std::is_same_v<config_t::status_policy_t,
41+
interrupt::clear_status_last>);
4242
}
4343

4444
TEST_CASE("impl models concept", "[irq_impl]") {
4545
using impl_t = interrupt::irq_impl<no_flows_config_t, test_nexus>;
46-
static_assert(interrupt::irq_interface<impl_t>);
46+
STATIC_REQUIRE(interrupt::irq_interface<impl_t>);
4747
}
4848

4949
namespace {
@@ -54,7 +54,7 @@ using flow_config_t = interrupt::irq<17_irq, 42, interrupt::policies<>, T>;
5454
TEST_CASE("impl runs a flow", "[irq_impl]") {
5555
using impl_t =
5656
interrupt::irq_impl<flow_config_t<std::true_type>, test_nexus>;
57-
static_assert(impl_t::active);
57+
STATIC_REQUIRE(impl_t::active);
5858
flow_run<std::true_type> = false;
5959
impl_t::run();
6060
CHECK(flow_run<std::true_type>);
@@ -73,12 +73,12 @@ TEST_CASE("impl can init its interrupt", "[irq_impl]") {
7373
TEST_CASE("impl is inactive when flow is not active", "[irq_impl]") {
7474
using impl_t =
7575
interrupt::irq_impl<flow_config_t<std::false_type>, test_nexus>;
76-
static_assert(not impl_t::active);
76+
STATIC_REQUIRE(not impl_t::active);
7777
}
7878

7979
TEST_CASE("impl is inactive when there are no flows", "[irq_impl]") {
8080
using impl_t = interrupt::irq_impl<no_flows_config_t, test_nexus>;
81-
static_assert(not impl_t::active);
81+
STATIC_REQUIRE(not impl_t::active);
8282
}
8383

8484
TEST_CASE("impl has no enable fields", "[irq_impl]") {

test/interrupt/policies.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
TEST_CASE("policies get", "[policies]") {
66
using policies_t = interrupt::policies<interrupt::clear_status_first>;
77
using default_policy_t = interrupt::clear_status_last;
8-
static_assert(
8+
STATIC_REQUIRE(
99
std::is_same_v<decltype(policies_t::get<interrupt::status_clear_policy,
1010
default_policy_t>()),
1111
interrupt::clear_status_first>);
12-
static_assert(std::is_same_v<
13-
decltype(policies_t::get<interrupt::required_resources_policy,
14-
default_policy_t>()),
15-
default_policy_t>);
12+
STATIC_REQUIRE(
13+
std::is_same_v<
14+
decltype(policies_t::get<interrupt::required_resources_policy,
15+
default_policy_t>()),
16+
default_policy_t>);
1617
}
1718

1819
TEST_CASE("clear status first policy", "[policies]") {
@@ -40,7 +41,7 @@ TEST_CASE("policy with required resources", "[policies]") {
4041
using policies_t = interrupt::policies<interrupt::required_resources<int>>;
4142
using P =
4243
decltype(policies_t::get<interrupt::required_resources_policy, void>());
43-
static_assert(interrupt::policy<P>);
44-
static_assert(
44+
STATIC_REQUIRE(interrupt::policy<P>);
45+
STATIC_REQUIRE(
4546
std::is_same_v<typename P::resources, interrupt::resource_list<int>>);
4647
}

test/interrupt/shared_irq_impl.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ using no_flows_config_t =
1212
}
1313

1414
TEST_CASE("config models concept", "[shared_irq_impl]") {
15-
static_assert(interrupt::irq_config<no_flows_config_t>);
15+
STATIC_REQUIRE(interrupt::irq_config<no_flows_config_t>);
1616
}
1717

1818
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]") {
3030
}
3131

3232
TEST_CASE("config default status policy is clear first", "[shared_irq_impl]") {
33-
static_assert(std::is_same_v<no_flows_config_t::status_policy_t,
34-
interrupt::clear_status_first>);
33+
STATIC_REQUIRE(std::is_same_v<no_flows_config_t::status_policy_t,
34+
interrupt::clear_status_first>);
3535
}
3636

3737
TEST_CASE("config status policy can be supplied", "[shared_irq_impl]") {
3838
using config_t = interrupt::shared_irq<
3939
42_irq, 17, interrupt::policies<interrupt::clear_status_last>>;
40-
static_assert(std::is_same_v<config_t::status_policy_t,
41-
interrupt::clear_status_last>);
40+
STATIC_REQUIRE(std::is_same_v<config_t::status_policy_t,
41+
interrupt::clear_status_last>);
4242
}
4343

4444
TEST_CASE("impl models concept", "[shared_irq_impl]") {
4545
using impl_t = interrupt::shared_irq_impl<no_flows_config_t>;
46-
static_assert(interrupt::irq_interface<impl_t>);
46+
STATIC_REQUIRE(interrupt::irq_interface<impl_t>);
4747
}
4848

4949
namespace {
@@ -61,7 +61,7 @@ TEST_CASE("impl runs a flow", "[shared_irq_impl]") {
6161
interrupt::sub_irq_impl<sub_config_t<std::true_type, 0>, test_nexus>;
6262
using impl_t =
6363
interrupt::shared_irq_impl<flow_config_t<std::true_type>, sub_impl_t>;
64-
static_assert(impl_t::active);
64+
STATIC_REQUIRE(impl_t::active);
6565

6666
enable_field_t<0>::value = true;
6767
status_field_t<0>::value = true;
@@ -88,7 +88,7 @@ TEST_CASE("impl is inactive when all subs are inactive", "[shared_irq_impl]") {
8888
interrupt::sub_irq_impl<sub_config_t<std::false_type, 0>, test_nexus>;
8989
using impl_t =
9090
interrupt::shared_irq_impl<flow_config_t<std::true_type>, sub_impl_t>;
91-
static_assert(not impl_t::active);
91+
STATIC_REQUIRE(not impl_t::active);
9292
}
9393

9494
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]") {
9999
using impl_t =
100100
interrupt::shared_irq_impl<flow_config_t<std::true_type>,
101101
active_sub_impl_t, inactive_sub_impl_t>;
102-
static_assert(impl_t::active);
102+
STATIC_REQUIRE(impl_t::active);
103103
}
104104

105105
TEST_CASE("impl is inactive when there are no subs", "[shared_irq_impl]") {
106106
using impl_t = interrupt::shared_irq_impl<flow_config_t<std::true_type>>;
107-
static_assert(not impl_t::active);
107+
STATIC_REQUIRE(not impl_t::active);
108108
}
109109

110110
TEST_CASE("impl enable fields are active sub enable fields",

test/interrupt/shared_sub_irq_impl.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@ using no_flows_config_t =
1313
} // namespace
1414

1515
TEST_CASE("config models concept", "[shared_sub_irq_impl]") {
16-
static_assert(interrupt::sub_irq_config<no_flows_config_t>);
16+
STATIC_REQUIRE(interrupt::sub_irq_config<no_flows_config_t>);
1717
}
1818

1919
TEST_CASE("config default status policy is clear first",
2020
"[shared_sub_irq_impl]") {
21-
static_assert(std::is_same_v<no_flows_config_t::status_policy_t,
22-
interrupt::clear_status_first>);
21+
STATIC_REQUIRE(std::is_same_v<no_flows_config_t::status_policy_t,
22+
interrupt::clear_status_first>);
2323
}
2424

2525
TEST_CASE("config status policy can be supplied", "[shared_sub_irq_impl]") {
2626
using config_t = interrupt::shared_sub_irq<
2727
enable_field_t<0>, status_field_t<0>,
2828
interrupt::policies<interrupt::clear_status_last>>;
29-
static_assert(std::is_same_v<config_t::status_policy_t,
30-
interrupt::clear_status_last>);
29+
STATIC_REQUIRE(std::is_same_v<config_t::status_policy_t,
30+
interrupt::clear_status_last>);
3131
}
3232

3333
TEST_CASE("impl models concept", "[shared_sub_irq_impl]") {
3434
using impl_t = interrupt::shared_sub_irq_impl<no_flows_config_t>;
35-
static_assert(interrupt::sub_irq_interface<impl_t>);
35+
STATIC_REQUIRE(interrupt::sub_irq_interface<impl_t>);
3636
}
3737

3838
namespace {
@@ -51,7 +51,7 @@ TEST_CASE("impl runs a flow", "[shared_sub_irq_impl]") {
5151
interrupt::sub_irq_impl<sub_config_t<std::true_type, 1>, test_nexus>;
5252
using impl_t = interrupt::shared_sub_irq_impl<flow_config_t<std::true_type>,
5353
sub_impl_t>;
54-
static_assert(impl_t::active);
54+
STATIC_REQUIRE(impl_t::active);
5555

5656
enable_field_t<0>::value = true;
5757
enable_field_t<1>::value = true;
@@ -68,7 +68,7 @@ TEST_CASE("impl is inactive when all subs are inactive",
6868
interrupt::sub_irq_impl<sub_config_t<std::false_type, 1>, test_nexus>;
6969
using impl_t = interrupt::shared_sub_irq_impl<flow_config_t<std::true_type>,
7070
sub_impl_t>;
71-
static_assert(not impl_t::active);
71+
STATIC_REQUIRE(not impl_t::active);
7272
}
7373

7474
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]") {
7979
using impl_t =
8080
interrupt::shared_sub_irq_impl<flow_config_t<std::true_type>,
8181
active_sub_impl_t, inactive_sub_impl_t>;
82-
static_assert(impl_t::active);
82+
STATIC_REQUIRE(impl_t::active);
8383
}
8484

8585
TEST_CASE("impl is inactive when there are no subs", "[shared_sub_irq_impl]") {
8686
using impl_t =
8787
interrupt::shared_sub_irq_impl<flow_config_t<std::true_type>>;
88-
static_assert(not impl_t::active);
88+
STATIC_REQUIRE(not impl_t::active);
8989
}
9090

9191
TEST_CASE(

test/interrupt/sub_irq_impl.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,25 @@ using no_flows_config_t =
1313
} // namespace
1414

1515
TEST_CASE("config models concept", "[sub_irq_impl]") {
16-
static_assert(interrupt::sub_irq_config<no_flows_config_t>);
16+
STATIC_REQUIRE(interrupt::sub_irq_config<no_flows_config_t>);
1717
}
1818

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

2424
TEST_CASE("config status policy can be supplied", "[sub_irq_impl]") {
2525
using config_t =
2626
interrupt::sub_irq<enable_field_t<0>, status_field_t<0>,
2727
interrupt::policies<interrupt::clear_status_last>>;
28-
static_assert(std::is_same_v<config_t::status_policy_t,
29-
interrupt::clear_status_last>);
28+
STATIC_REQUIRE(std::is_same_v<config_t::status_policy_t,
29+
interrupt::clear_status_last>);
3030
}
3131

3232
TEST_CASE("impl models concept", "[sub_irq_impl]") {
3333
using impl_t = interrupt::sub_irq_impl<no_flows_config_t, test_nexus>;
34-
static_assert(interrupt::sub_irq_interface<impl_t>);
34+
STATIC_REQUIRE(interrupt::sub_irq_interface<impl_t>);
3535
}
3636

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

4848
enable_field_t<0>::value = true;
4949
status_field_t<0>::value = true;
@@ -55,7 +55,7 @@ TEST_CASE("impl runs a flow when enabled and status", "[sub_irq_impl]") {
5555
TEST_CASE("impl doesn't run a flow when not enabled", "[sub_irq_impl]") {
5656
using impl_t =
5757
interrupt::sub_irq_impl<flow_config_t<std::true_type>, test_nexus>;
58-
static_assert(impl_t::active);
58+
STATIC_REQUIRE(impl_t::active);
5959

6060
enable_field_t<0>::value = false;
6161
status_field_t<0>::value = true;
@@ -67,7 +67,7 @@ TEST_CASE("impl doesn't run a flow when not enabled", "[sub_irq_impl]") {
6767
TEST_CASE("impl doesn't run a flow when not status", "[sub_irq_impl]") {
6868
using impl_t =
6969
interrupt::sub_irq_impl<flow_config_t<std::true_type>, test_nexus>;
70-
static_assert(impl_t::active);
70+
STATIC_REQUIRE(impl_t::active);
7171

7272
enable_field_t<0>::value = true;
7373
status_field_t<0>::value = false;
@@ -79,12 +79,12 @@ TEST_CASE("impl doesn't run a flow when not status", "[sub_irq_impl]") {
7979
TEST_CASE("impl is inactive when flow is not active", "[sub_irq_impl]") {
8080
using impl_t =
8181
interrupt::sub_irq_impl<flow_config_t<std::false_type>, test_nexus>;
82-
static_assert(not impl_t::active);
82+
STATIC_REQUIRE(not impl_t::active);
8383
}
8484

8585
TEST_CASE("impl is inactive when there are no flows", "[sub_irq_impl]") {
8686
using impl_t = interrupt::sub_irq_impl<no_flows_config_t, test_nexus>;
87-
static_assert(not impl_t::active);
87+
STATIC_REQUIRE(not impl_t::active);
8888
}
8989

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

0 commit comments

Comments
 (0)