19inline constexpr bool LOW_{
true };
20inline constexpr bool HIGH_{
false };
33 TEST_ASSERT_FALSE(noneHigh.active);
34 TEST_ASSERT_FALSE(noneHigh.changed);
35 TEST_ASSERT_FALSE(noneHigh.pressed());
36 TEST_ASSERT_FALSE(noneHigh.released());
38 TEST_ASSERT_TRUE(press.active);
39 TEST_ASSERT_TRUE(press.changed);
40 TEST_ASSERT_TRUE(press.pressed());
41 TEST_ASSERT_FALSE(press.released());
43 TEST_ASSERT_TRUE(held.active);
44 TEST_ASSERT_FALSE(held.changed);
45 TEST_ASSERT_FALSE(held.pressed());
46 TEST_ASSERT_FALSE(held.released());
48 TEST_ASSERT_FALSE(release.active);
49 TEST_ASSERT_TRUE(release.changed);
50 TEST_ASSERT_FALSE(release.pressed());
51 TEST_ASSERT_TRUE(release.released());
71 TEST_ASSERT_FALSE(first.active);
72 TEST_ASSERT_FALSE(first.changed);
73 TEST_ASSERT_FALSE(first.released());
80 TEST_ASSERT_TRUE(first.active);
81 TEST_ASSERT_TRUE(first.pressed());
89 TEST_ASSERT_TRUE(press.pressed());
91 for (uint8_t second = 0; second != 5; ++second)
95 TEST_ASSERT_TRUE(held.active);
96 TEST_ASSERT_FALSE(held.changed);
97 TEST_ASSERT_FALSE(held.pressed());
98 TEST_ASSERT_FALSE(held.released());
108 TEST_ASSERT_FALSE(release.active);
109 TEST_ASSERT_TRUE(release.changed);
110 TEST_ASSERT_TRUE(release.released());
111 TEST_ASSERT_FALSE(release.pressed());
114 TEST_ASSERT_FALSE(after.changed);
115 TEST_ASSERT_FALSE(after.released());
125 TEST_ASSERT_FALSE(other.changed);
139 constexpr bool pressed[]{
false,
true,
false,
false,
false,
true,
false };
140 constexpr bool released[]{
false,
false,
false,
true,
false,
false,
true };
142 for (uint8_t
i = 0;
i !=
sizeof(levels); ++
i)
146 TEST_ASSERT_EQUAL_MESSAGE(levels[
i], edges.active,
"active");
147 TEST_ASSERT_EQUAL_MESSAGE(pressed[
i], edges.pressed(),
"pressed");
148 TEST_ASSERT_EQUAL_MESSAGE(released[
i], edges.released(),
"released");
void test_a_press_while_forced_is_dropped_not_carried_over(void)
void test_press_once_then_held_is_no_edge(void)
void test_changed_is_either_edge_active_is_the_level(void)
void test_each_pin_keeps_its_own_level(void)
void test_startup_is_released(void)
void test_press_release_press(void)
void test_no_rotation_while_forced(void)
void test_release_once_then_no_edge(void)
void test_low_at_startup_is_a_press(void)
void test_rotation_on_a_press_when_nothing_is_forced(void)
void test_pinEdges_from_the_two_levels(void)
The edges of the active-LOW input pins: pressed, released, or no change.
constexpr bool isRotationRequested(const PinEdges &pin, const bool bOverridden)
Tells whether the rotation pin asks for a rotation now.
constexpr PinEdges pinEdges(const bool wasActive, const bool active)
The edges of a pin, from its previous level and its current one.
PinEdges trackPinEdges(const bool active)
Gives the edges of a pin from its current level, and keeps that level for the next call.
State of an active-LOW input pin, and how it changed since the previous reading.