diff options
author | Stefan Kerkmann <karlk90@pm.me> | 2022-07-07 10:00:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 10:00:40 +0200 |
commit | 8224f62806b66f0825b68fd8c00436ee57a28e9a (patch) | |
tree | 33e16a84a05073fd439e6a86f09631132a546794 /quantum/debounce/tests | |
parent | cca5d3532128a9d1aa2ab39405d935fc132c752d (diff) |
Make debounce() signal changes in the cooked matrix as return value (#17554)
Diffstat (limited to 'quantum/debounce/tests')
-rw-r--r-- | quantum/debounce/tests/debounce_test_common.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/quantum/debounce/tests/debounce_test_common.cpp b/quantum/debounce/tests/debounce_test_common.cpp index 0d5a7bb766..bd98e32955 100644 --- a/quantum/debounce/tests/debounce_test_common.cpp +++ b/quantum/debounce/tests/debounce_test_common.cpp @@ -125,11 +125,15 @@ void DebounceTest::runDebounce(bool changed) { std::copy(std::begin(input_matrix_), std::end(input_matrix_), std::begin(raw_matrix_)); std::copy(std::begin(output_matrix_), std::end(output_matrix_), std::begin(cooked_matrix_)); - debounce(raw_matrix_, cooked_matrix_, MATRIX_ROWS, changed); + bool cooked_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_); } + + if (std::equal(std::begin(output_matrix_), std::end(output_matrix_), std::begin(cooked_matrix_)) && cooked_changed) { + FAIL() << "Fatal error: debounce() did detect a wrong cooked matrix change at " << strTime() << "\noutput_matrix: cooked_changed=" << cooked_changed << "\n" << strMatrix(output_matrix_) << "\ncooked_matrix:\n" << strMatrix(cooked_matrix_); + } } void DebounceTest::checkCookedMatrix(bool changed, const std::string &error_message) { |