diff options
Diffstat (limited to 'quantum/debounce/tests')
-rw-r--r-- | quantum/debounce/tests/asym_eager_defer_pk_tests.cpp | 66 | ||||
-rw-r--r-- | quantum/debounce/tests/debounce_test_common.cpp | 72 | ||||
-rw-r--r-- | quantum/debounce/tests/debounce_test_common.h | 24 | ||||
-rw-r--r-- | quantum/debounce/tests/sym_defer_g_tests.cpp | 45 | ||||
-rw-r--r-- | quantum/debounce/tests/sym_defer_pk_tests.cpp | 45 | ||||
-rw-r--r-- | quantum/debounce/tests/sym_eager_pk_tests.cpp | 48 | ||||
-rw-r--r-- | quantum/debounce/tests/sym_eager_pr_tests.cpp | 57 |
7 files changed, 208 insertions, 149 deletions
diff --git a/quantum/debounce/tests/asym_eager_defer_pk_tests.cpp b/quantum/debounce/tests/asym_eager_defer_pk_tests.cpp index fe374c3dfa..44b4fe1956 100644 --- a/quantum/debounce/tests/asym_eager_defer_pk_tests.cpp +++ b/quantum/debounce/tests/asym_eager_defer_pk_tests.cpp @@ -19,7 +19,8 @@ #include "debounce_test_common.h" TEST_F(DebounceTest, OneKeyShort1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Release key after 1ms delay */ {1, {{0, 1, UP}}, {}}, @@ -43,7 +44,8 @@ TEST_F(DebounceTest, OneKeyShort1) { } TEST_F(DebounceTest, OneKeyShort2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Release key after 2ms delay */ {2, {{0, 1, UP}}, {}}, @@ -58,7 +60,8 @@ TEST_F(DebounceTest, OneKeyShort2) { } TEST_F(DebounceTest, OneKeyShort3) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Release key after 3ms delay */ {3, {{0, 1, UP}}, {}}, @@ -73,7 +76,8 @@ TEST_F(DebounceTest, OneKeyShort3) { } TEST_F(DebounceTest, OneKeyShort4) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Release key after 4ms delay */ {4, {{0, 1, UP}}, {}}, @@ -88,7 +92,8 @@ TEST_F(DebounceTest, OneKeyShort4) { } TEST_F(DebounceTest, OneKeyShort5) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Release key after 5ms delay */ @@ -102,7 +107,8 @@ TEST_F(DebounceTest, OneKeyShort5) { } TEST_F(DebounceTest, OneKeyShort6) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Release key after 6ms delay */ @@ -116,7 +122,8 @@ TEST_F(DebounceTest, OneKeyShort6) { } TEST_F(DebounceTest, OneKeyShort7) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Release key after 7ms delay */ @@ -130,7 +137,8 @@ TEST_F(DebounceTest, OneKeyShort7) { } TEST_F(DebounceTest, OneKeyShort8) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Release key after 1ms delay */ {1, {{0, 1, UP}}, {}}, @@ -145,7 +153,8 @@ TEST_F(DebounceTest, OneKeyShort8) { } TEST_F(DebounceTest, OneKeyShort9) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Release key after 1ms delay */ {1, {{0, 1, UP}}, {}}, @@ -159,7 +168,8 @@ TEST_F(DebounceTest, OneKeyShort9) { } TEST_F(DebounceTest, OneKeyBouncing1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, {2, {{0, 1, DOWN}}, {}}, @@ -185,7 +195,8 @@ TEST_F(DebounceTest, OneKeyBouncing1) { } TEST_F(DebounceTest, OneKeyBouncing2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Change twice in the same time period */ {1, {{0, 1, UP}}, {}}, @@ -217,7 +228,8 @@ TEST_F(DebounceTest, OneKeyBouncing2) { } TEST_F(DebounceTest, OneKeyLong) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {25, {{0, 1, UP}}, {}}, @@ -236,7 +248,8 @@ TEST_F(DebounceTest, OneKeyLong) { } TEST_F(DebounceTest, TwoKeysShort) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 2, DOWN}}, {{0, 2, DOWN}}}, /* Release key after 2ms delay */ @@ -249,14 +262,14 @@ TEST_F(DebounceTest, TwoKeysShort) { {10, {}, {{0, 1, UP}}}, /* 5ms+5ms after DOWN at time 0 */ /* Press key again after 1ms delay */ {11, {{0, 1, DOWN}}, {{0, 1, DOWN}, {0, 2, UP}}}, /* 5ms+5ms after DOWN at time 0 */ - {12, {{0, 2, DOWN}}, {{0, 2, DOWN}}}, /* 5ms+5ms after DOWN at time 0 */ + {12, {{0, 2, DOWN}}, {{0, 2, DOWN}}}, /* 5ms+5ms after DOWN at time 0 */ }); runEvents(); } - TEST_F(DebounceTest, OneKeyDelayedScan1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late, immediately release key */ @@ -269,7 +282,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan1) { } TEST_F(DebounceTest, OneKeyDelayedScan2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late, immediately release key */ @@ -283,7 +297,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan2) { } TEST_F(DebounceTest, OneKeyDelayedScan3) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late */ @@ -298,7 +313,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan3) { } TEST_F(DebounceTest, OneKeyDelayedScan4) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late */ @@ -314,7 +330,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan4) { } TEST_F(DebounceTest, OneKeyDelayedScan5) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {5, {{0, 1, UP}}, {}}, @@ -329,7 +346,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan5) { } TEST_F(DebounceTest, OneKeyDelayedScan6) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {5, {{0, 1, UP}}, {}}, @@ -345,7 +363,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan6) { } TEST_F(DebounceTest, OneKeyDelayedScan7) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {5, {{0, 1, UP}}, {}}, @@ -358,7 +377,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan7) { } TEST_F(DebounceTest, OneKeyDelayedScan8) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is a bit late */ diff --git a/quantum/debounce/tests/debounce_test_common.cpp b/quantum/debounce/tests/debounce_test_common.cpp index 1c5e7c9f4e..f9414e571d 100644 --- a/quantum/debounce/tests/debounce_test_common.cpp +++ b/quantum/debounce/tests/debounce_test_common.cpp @@ -31,9 +31,7 @@ void set_time(uint32_t t); void advance_time(uint32_t ms); } -void DebounceTest::addEvents(std::initializer_list<DebounceTestEvent> events) { - events_.insert(events_.end(), events.begin(), events.end()); -} +void DebounceTest::addEvents(std::initializer_list<DebounceTestEvent> events) { events_.insert(events_.end(), events.begin(), events.end()); } void DebounceTest::runEvents() { /* Run the test multiple times, from 1kHz to 10kHz scan rate */ @@ -54,7 +52,7 @@ void DebounceTest::runEvents() { void DebounceTest::runEventsInternal() { fast_timer_t previous = 0; - bool first = true; + bool first = true; /* Initialise keyboard with start time (offset to avoid testing at 0) and all keys UP */ debounce_init(MATRIX_ROWS); @@ -80,7 +78,7 @@ void DebounceTest::runEventsInternal() { } } - first = false; + first = false; previous = event.time_; /* Prepare input matrix */ @@ -98,12 +96,7 @@ void DebounceTest::runEventsInternal() { /* Check output matrix has expected change events */ for (auto &output : event.outputs_) { - EXPECT_EQ(!!(cooked_matrix_[output.row_] & (1U << output.col_)), directionValue(output.direction_)) - << "Missing event at " << strTime() - << " expected key " << output.row_ << "," << output.col_ << " " << directionLabel(output.direction_) - << "\ninput_matrix: changed=" << !event.inputs_.empty() << "\n" << strMatrix(input_matrix_) - << "\nexpected_matrix:\n" << strMatrix(output_matrix_) - << "\nactual_matrix:\n" << strMatrix(cooked_matrix_); + EXPECT_EQ(!!(cooked_matrix_[output.row_] & (1U << output.col_)), directionValue(output.direction_)) << "Missing event at " << strTime() << " expected key " << output.row_ << "," << output.col_ << " " << directionLabel(output.direction_) << "\ninput_matrix: changed=" << !event.inputs_.empty() << "\n" << strMatrix(input_matrix_) << "\nexpected_matrix:\n" << strMatrix(output_matrix_) << "\nactual_matrix:\n" << strMatrix(cooked_matrix_); } /* Check output matrix has no other changes */ @@ -133,27 +126,20 @@ void DebounceTest::runDebounce(bool changed) { debounce(raw_matrix_, cooked_matrix_, MATRIX_ROWS, changed); if (!std::equal(std::begin(input_matrix_), std::end(input_matrix_), std::begin(raw_matrix_))) { - FAIL() << "Fatal error: debounce() modified raw matrix at " << strTime() - << "\ninput_matrix: changed=" << changed << "\n" << strMatrix(input_matrix_) - << "\nraw_matrix:\n" << strMatrix(raw_matrix_); + FAIL() << "Fatal error: debounce() modified raw matrix at " << strTime() << "\ninput_matrix: changed=" << changed << "\n" << strMatrix(input_matrix_) << "\nraw_matrix:\n" << strMatrix(raw_matrix_); } } void DebounceTest::checkCookedMatrix(bool changed, const std::string &error_message) { if (!std::equal(std::begin(output_matrix_), std::end(output_matrix_), std::begin(cooked_matrix_))) { - FAIL() << "Unexpected event: " << error_message << " at " << strTime() - << "\ninput_matrix: changed=" << changed << "\n" << strMatrix(input_matrix_) - << "\nexpected_matrix:\n" << strMatrix(output_matrix_) - << "\nactual_matrix:\n" << strMatrix(cooked_matrix_); + FAIL() << "Unexpected event: " << error_message << " at " << strTime() << "\ninput_matrix: changed=" << changed << "\n" << strMatrix(input_matrix_) << "\nexpected_matrix:\n" << strMatrix(output_matrix_) << "\nactual_matrix:\n" << strMatrix(cooked_matrix_); } } std::string DebounceTest::strTime() { std::stringstream text; - text << "time " << (timer_read_fast() - time_offset_) - << " (extra_iterations=" << extra_iterations_ - << ", auto_advance_time=" << auto_advance_time_ << ")"; + text << "time " << (timer_read_fast() - time_offset_) << " (extra_iterations=" << extra_iterations_ << ", auto_advance_time=" << auto_advance_time_ << ")"; return text.str(); } @@ -181,49 +167,39 @@ std::string DebounceTest::strMatrix(matrix_row_t matrix[]) { bool DebounceTest::directionValue(Direction direction) { switch (direction) { - case DOWN: - return true; + case DOWN: + return true; - case UP: - return false; + case UP: + return false; } } std::string DebounceTest::directionLabel(Direction direction) { switch (direction) { - case DOWN: - return "DOWN"; + case DOWN: + return "DOWN"; - case UP: - return "UP"; + case UP: + return "UP"; } } /* Modify a matrix and verify that events always specify a change */ void DebounceTest::matrixUpdate(matrix_row_t matrix[], const std::string &name, const MatrixTestEvent &event) { - ASSERT_NE(!!(matrix[event.row_] & (1U << event.col_)), directionValue(event.direction_)) - << "Test " << name << " at " << strTime() - << " sets key " << event.row_ << "," << event.col_ << " " << directionLabel(event.direction_) - << " but it is already " << directionLabel(event.direction_) - << "\n" << name << "_matrix:\n" << strMatrix(matrix); + ASSERT_NE(!!(matrix[event.row_] & (1U << event.col_)), directionValue(event.direction_)) << "Test " << name << " at " << strTime() << " sets key " << event.row_ << "," << event.col_ << " " << directionLabel(event.direction_) << " but it is already " << directionLabel(event.direction_) << "\n" << name << "_matrix:\n" << strMatrix(matrix); switch (event.direction_) { - case DOWN: - matrix[event.row_] |= (1U << event.col_); - break; + case DOWN: + matrix[event.row_] |= (1U << event.col_); + break; - case UP: - matrix[event.row_] &= ~(1U << event.col_); - break; + case UP: + matrix[event.row_] &= ~(1U << event.col_); + break; } } -DebounceTestEvent::DebounceTestEvent(fast_timer_t time, - std::initializer_list<MatrixTestEvent> inputs, - std::initializer_list<MatrixTestEvent> outputs) - : time_(time), inputs_(inputs), outputs_(outputs) { -} +DebounceTestEvent::DebounceTestEvent(fast_timer_t time, std::initializer_list<MatrixTestEvent> inputs, std::initializer_list<MatrixTestEvent> outputs) : time_(time), inputs_(inputs), outputs_(outputs) {} -MatrixTestEvent::MatrixTestEvent(int row, int col, Direction direction) - : row_(row), col_(col), direction_(direction) { -} +MatrixTestEvent::MatrixTestEvent(int row, int col, Direction direction) : row_(row), col_(col), direction_(direction) {} diff --git a/quantum/debounce/tests/debounce_test_common.h b/quantum/debounce/tests/debounce_test_common.h index d87e310594..b7becb3782 100644 --- a/quantum/debounce/tests/debounce_test_common.h +++ b/quantum/debounce/tests/debounce_test_common.h @@ -31,36 +31,34 @@ enum Direction { }; class MatrixTestEvent { -public: + public: MatrixTestEvent(int row, int col, Direction direction); - const int row_; - const int col_; + const int row_; + const int col_; const Direction direction_; }; class DebounceTestEvent { -public: + public: // 0, {{0, 1, DOWN}}, {{0, 1, DOWN}}) - DebounceTestEvent(fast_timer_t time, - std::initializer_list<MatrixTestEvent> inputs, - std::initializer_list<MatrixTestEvent> outputs); + DebounceTestEvent(fast_timer_t time, std::initializer_list<MatrixTestEvent> inputs, std::initializer_list<MatrixTestEvent> outputs); - const fast_timer_t time_; + const fast_timer_t time_; const std::list<MatrixTestEvent> inputs_; const std::list<MatrixTestEvent> outputs_; }; class DebounceTest : public ::testing::Test { -protected: + protected: void addEvents(std::initializer_list<DebounceTestEvent> events); void runEvents(); fast_timer_t time_offset_ = 7777; - bool time_jumps_ = false; + bool time_jumps_ = false; -private: - static bool directionValue(Direction direction); + private: + static bool directionValue(Direction direction); static std::string directionLabel(Direction direction); void runEventsInternal(); @@ -78,6 +76,6 @@ private: matrix_row_t cooked_matrix_[MATRIX_ROWS]; matrix_row_t output_matrix_[MATRIX_ROWS]; - int extra_iterations_; + int extra_iterations_; bool auto_advance_time_; }; diff --git a/quantum/debounce/tests/sym_defer_g_tests.cpp b/quantum/debounce/tests/sym_defer_g_tests.cpp index a56aecd8f3..73d3d45e30 100644 --- a/quantum/debounce/tests/sym_defer_g_tests.cpp +++ b/quantum/debounce/tests/sym_defer_g_tests.cpp @@ -19,7 +19,8 @@ #include "debounce_test_common.h" TEST_F(DebounceTest, OneKeyShort1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}}}, @@ -32,7 +33,8 @@ TEST_F(DebounceTest, OneKeyShort1) { } TEST_F(DebounceTest, OneKeyShort2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}}}, @@ -45,7 +47,8 @@ TEST_F(DebounceTest, OneKeyShort2) { } TEST_F(DebounceTest, OneKeyShort3) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}}}, @@ -58,7 +61,8 @@ TEST_F(DebounceTest, OneKeyShort3) { } TEST_F(DebounceTest, OneKeyTooQuick1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, /* Release key exactly on the debounce time */ {5, {{0, 1, UP}}, {}}, @@ -67,7 +71,8 @@ TEST_F(DebounceTest, OneKeyTooQuick1) { } TEST_F(DebounceTest, OneKeyTooQuick2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}}}, @@ -80,7 +85,8 @@ TEST_F(DebounceTest, OneKeyTooQuick2) { } TEST_F(DebounceTest, OneKeyBouncing1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {1, {{0, 1, UP}}, {}}, {2, {{0, 1, DOWN}}, {}}, @@ -94,7 +100,8 @@ TEST_F(DebounceTest, OneKeyBouncing1) { } TEST_F(DebounceTest, OneKeyBouncing2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}}}, {6, {{0, 1, UP}}, {}}, @@ -108,7 +115,8 @@ TEST_F(DebounceTest, OneKeyBouncing2) { } TEST_F(DebounceTest, OneKeyLong) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}}}, @@ -125,7 +133,8 @@ TEST_F(DebounceTest, OneKeyLong) { } TEST_F(DebounceTest, TwoKeysShort) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {1, {{0, 2, DOWN}}, {}}, @@ -140,7 +149,8 @@ TEST_F(DebounceTest, TwoKeysShort) { } TEST_F(DebounceTest, TwoKeysSimultaneous1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}, {0, 2, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}, {0, 2, DOWN}}}, @@ -152,7 +162,8 @@ TEST_F(DebounceTest, TwoKeysSimultaneous1) { } TEST_F(DebounceTest, TwoKeysSimultaneous2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {1, {{0, 2, DOWN}}, {}}, @@ -167,7 +178,8 @@ TEST_F(DebounceTest, TwoKeysSimultaneous2) { } TEST_F(DebounceTest, OneKeyDelayedScan1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, /* Processing is very late */ @@ -182,7 +194,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan1) { } TEST_F(DebounceTest, OneKeyDelayedScan2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, /* Processing is very late */ @@ -197,7 +210,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan2) { } TEST_F(DebounceTest, OneKeyDelayedScan3) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, /* Release key before debounce expires */ @@ -208,7 +222,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan3) { } TEST_F(DebounceTest, OneKeyDelayedScan4) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, /* Processing is a bit late */ diff --git a/quantum/debounce/tests/sym_defer_pk_tests.cpp b/quantum/debounce/tests/sym_defer_pk_tests.cpp index 1f3061e59c..7542c2dad4 100644 --- a/quantum/debounce/tests/sym_defer_pk_tests.cpp +++ b/quantum/debounce/tests/sym_defer_pk_tests.cpp @@ -19,7 +19,8 @@ #include "debounce_test_common.h" TEST_F(DebounceTest, OneKeyShort1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}}}, @@ -32,7 +33,8 @@ TEST_F(DebounceTest, OneKeyShort1) { } TEST_F(DebounceTest, OneKeyShort2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}}}, @@ -45,7 +47,8 @@ TEST_F(DebounceTest, OneKeyShort2) { } TEST_F(DebounceTest, OneKeyShort3) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}}}, @@ -58,7 +61,8 @@ TEST_F(DebounceTest, OneKeyShort3) { } TEST_F(DebounceTest, OneKeyTooQuick1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, /* Release key exactly on the debounce time */ {5, {{0, 1, UP}}, {}}, @@ -67,7 +71,8 @@ TEST_F(DebounceTest, OneKeyTooQuick1) { } TEST_F(DebounceTest, OneKeyTooQuick2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}}}, @@ -80,7 +85,8 @@ TEST_F(DebounceTest, OneKeyTooQuick2) { } TEST_F(DebounceTest, OneKeyBouncing1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {1, {{0, 1, UP}}, {}}, {2, {{0, 1, DOWN}}, {}}, @@ -94,7 +100,8 @@ TEST_F(DebounceTest, OneKeyBouncing1) { } TEST_F(DebounceTest, OneKeyBouncing2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}}}, {6, {{0, 1, UP}}, {}}, @@ -108,7 +115,8 @@ TEST_F(DebounceTest, OneKeyBouncing2) { } TEST_F(DebounceTest, OneKeyLong) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}}}, @@ -125,7 +133,8 @@ TEST_F(DebounceTest, OneKeyLong) { } TEST_F(DebounceTest, TwoKeysShort) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {1, {{0, 2, DOWN}}, {}}, @@ -142,7 +151,8 @@ TEST_F(DebounceTest, TwoKeysShort) { } TEST_F(DebounceTest, TwoKeysSimultaneous1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}, {0, 2, DOWN}}, {}}, {5, {}, {{0, 1, DOWN}, {0, 2, DOWN}}}, @@ -154,7 +164,8 @@ TEST_F(DebounceTest, TwoKeysSimultaneous1) { } TEST_F(DebounceTest, TwoKeysSimultaneous2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, {1, {{0, 2, DOWN}}, {}}, @@ -169,7 +180,8 @@ TEST_F(DebounceTest, TwoKeysSimultaneous2) { } TEST_F(DebounceTest, OneKeyDelayedScan1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, /* Processing is very late */ @@ -184,7 +196,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan1) { } TEST_F(DebounceTest, OneKeyDelayedScan2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, /* Processing is very late */ @@ -199,7 +212,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan2) { } TEST_F(DebounceTest, OneKeyDelayedScan3) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, /* Release key before debounce expires */ @@ -210,7 +224,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan3) { } TEST_F(DebounceTest, OneKeyDelayedScan4) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {}}, /* Processing is a bit late */ diff --git a/quantum/debounce/tests/sym_eager_pk_tests.cpp b/quantum/debounce/tests/sym_eager_pk_tests.cpp index e0fc205e33..d9a02fe33c 100644 --- a/quantum/debounce/tests/sym_eager_pk_tests.cpp +++ b/quantum/debounce/tests/sym_eager_pk_tests.cpp @@ -19,7 +19,8 @@ #include "debounce_test_common.h" TEST_F(DebounceTest, OneKeyShort1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, @@ -32,7 +33,8 @@ TEST_F(DebounceTest, OneKeyShort1) { } TEST_F(DebounceTest, OneKeyShort2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, @@ -45,7 +47,8 @@ TEST_F(DebounceTest, OneKeyShort2) { } TEST_F(DebounceTest, OneKeyShort3) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, @@ -58,7 +61,8 @@ TEST_F(DebounceTest, OneKeyShort3) { } TEST_F(DebounceTest, OneKeyShort4) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, @@ -71,7 +75,8 @@ TEST_F(DebounceTest, OneKeyShort4) { } TEST_F(DebounceTest, OneKeyShort5) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, @@ -83,7 +88,8 @@ TEST_F(DebounceTest, OneKeyShort5) { } TEST_F(DebounceTest, OneKeyShort6) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, @@ -95,7 +101,8 @@ TEST_F(DebounceTest, OneKeyShort6) { } TEST_F(DebounceTest, OneKeyBouncing1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, {2, {{0, 1, DOWN}}, {}}, @@ -110,7 +117,8 @@ TEST_F(DebounceTest, OneKeyBouncing1) { } TEST_F(DebounceTest, OneKeyBouncing2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Change twice in the same time period */ {1, {{0, 1, UP}}, {}}, @@ -135,7 +143,8 @@ TEST_F(DebounceTest, OneKeyBouncing2) { } TEST_F(DebounceTest, OneKeyLong) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {25, {{0, 1, UP}}, {{0, 1, UP}}}, @@ -146,7 +155,8 @@ TEST_F(DebounceTest, OneKeyLong) { } TEST_F(DebounceTest, TwoKeysShort) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, {2, {{0, 2, DOWN}}, {{0, 2, DOWN}}}, @@ -167,7 +177,8 @@ TEST_F(DebounceTest, TwoKeysShort) { } TEST_F(DebounceTest, OneKeyDelayedScan1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late but the change will now be accepted */ @@ -178,7 +189,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan1) { } TEST_F(DebounceTest, OneKeyDelayedScan2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late but the change will now be accepted even with a 1 scan delay */ @@ -190,7 +202,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan2) { } TEST_F(DebounceTest, OneKeyDelayedScan3) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late but the change will now be accepted even with a 1ms delay */ @@ -202,7 +215,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan3) { } TEST_F(DebounceTest, OneKeyDelayedScan4) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is a bit late but the change will now be accepted */ @@ -213,7 +227,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan4) { } TEST_F(DebounceTest, OneKeyDelayedScan5) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late but the change will now be accepted even with a 1 scan delay */ @@ -225,7 +240,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan5) { } TEST_F(DebounceTest, OneKeyDelayedScan6) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late but the change will now be accepted even with a 1ms delay */ diff --git a/quantum/debounce/tests/sym_eager_pr_tests.cpp b/quantum/debounce/tests/sym_eager_pr_tests.cpp index 2c4bca127e..e91dd9cb87 100644 --- a/quantum/debounce/tests/sym_eager_pr_tests.cpp +++ b/quantum/debounce/tests/sym_eager_pr_tests.cpp @@ -19,7 +19,8 @@ #include "debounce_test_common.h" TEST_F(DebounceTest, OneKeyShort1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, @@ -32,7 +33,8 @@ TEST_F(DebounceTest, OneKeyShort1) { } TEST_F(DebounceTest, OneKeyShort2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, @@ -45,7 +47,8 @@ TEST_F(DebounceTest, OneKeyShort2) { } TEST_F(DebounceTest, OneKeyShort3) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, @@ -58,7 +61,8 @@ TEST_F(DebounceTest, OneKeyShort3) { } TEST_F(DebounceTest, OneKeyShort4) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, @@ -71,7 +75,8 @@ TEST_F(DebounceTest, OneKeyShort4) { } TEST_F(DebounceTest, OneKeyShort5) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, @@ -83,7 +88,8 @@ TEST_F(DebounceTest, OneKeyShort5) { } TEST_F(DebounceTest, OneKeyShort6) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, @@ -95,7 +101,8 @@ TEST_F(DebounceTest, OneKeyShort6) { } TEST_F(DebounceTest, OneKeyBouncing1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, {2, {{0, 1, DOWN}}, {}}, @@ -110,7 +117,8 @@ TEST_F(DebounceTest, OneKeyBouncing1) { } TEST_F(DebounceTest, OneKeyBouncing2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Change twice in the same time period */ {1, {{0, 1, UP}}, {}}, @@ -135,7 +143,8 @@ TEST_F(DebounceTest, OneKeyBouncing2) { } TEST_F(DebounceTest, OneKeyLong) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {25, {{0, 1, UP}}, {{0, 1, UP}}}, @@ -146,7 +155,8 @@ TEST_F(DebounceTest, OneKeyLong) { } TEST_F(DebounceTest, TwoRowsShort) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, {2, {{2, 0, DOWN}}, {{2, 0, DOWN}}}, @@ -167,7 +177,8 @@ TEST_F(DebounceTest, TwoRowsShort) { } TEST_F(DebounceTest, TwoKeysOverlap) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, {1, {{0, 1, UP}}, {}}, /* Press a second key during the first debounce */ @@ -190,7 +201,8 @@ TEST_F(DebounceTest, TwoKeysOverlap) { } TEST_F(DebounceTest, TwoKeysSimultaneous1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}, {0, 2, DOWN}}, {{0, 1, DOWN}, {0, 2, DOWN}}}, {20, {{0, 1, UP}}, {{0, 1, UP}}}, {21, {{0, 2, UP}}, {}}, @@ -202,7 +214,8 @@ TEST_F(DebounceTest, TwoKeysSimultaneous1) { } TEST_F(DebounceTest, TwoKeysSimultaneous2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}, {0, 2, DOWN}}, {{0, 1, DOWN}, {0, 2, DOWN}}}, {20, {{0, 1, UP}, {0, 2, UP}}, {{0, 1, UP}, {0, 2, UP}}}, }); @@ -210,7 +223,8 @@ TEST_F(DebounceTest, TwoKeysSimultaneous2) { } TEST_F(DebounceTest, OneKeyDelayedScan1) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late but the change will now be accepted */ @@ -221,7 +235,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan1) { } TEST_F(DebounceTest, OneKeyDelayedScan2) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late but the change will now be accepted even with a 1 scan delay */ @@ -233,7 +248,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan2) { } TEST_F(DebounceTest, OneKeyDelayedScan3) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late but the change will now be accepted even with a 1ms delay */ @@ -245,7 +261,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan3) { } TEST_F(DebounceTest, OneKeyDelayedScan4) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is a bit late but the change will now be accepted */ @@ -256,7 +273,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan4) { } TEST_F(DebounceTest, OneKeyDelayedScan5) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late but the change will now be accepted even with a 1 scan delay */ @@ -268,7 +286,8 @@ TEST_F(DebounceTest, OneKeyDelayedScan5) { } TEST_F(DebounceTest, OneKeyDelayedScan6) { - addEvents({ /* Time, Inputs, Outputs */ + addEvents({ + /* Time, Inputs, Outputs */ {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, /* Processing is very late but the change will now be accepted even with a 1ms delay */ |