diff options
author | Stefan Kerkmann <karlk90@pm.me> | 2021-11-22 22:15:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-23 08:15:04 +1100 |
commit | b6054c0206609f3755f71d819643644d250288b0 (patch) | |
tree | 4f6f33040bb5184d47144090058eb089d2782b6c /tests/test_common/keyboard_report_util.cpp | |
parent | f4966a19d69a7f3bbefeea0537071d7d7c2abbdd (diff) |
[Tests] Increase QMK test coverage (#13789)
* Add per-test keymaps
* Add better trace and info logs for failed unit-tests
* Add layer state assertion with tracing message
* Use individual test binaries configuration options
* Add basic qmk functionality tests
* Add tap hold configurations tests
* Add auto shift tests
* `qmk format-c
* Fix tests
Co-authored-by: Nick Brassel <nick@tzarc.org>
Diffstat (limited to 'tests/test_common/keyboard_report_util.cpp')
-rw-r--r-- | tests/test_common/keyboard_report_util.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/test_common/keyboard_report_util.cpp b/tests/test_common/keyboard_report_util.cpp index f73cf239e0..e148c76beb 100644 --- a/tests/test_common/keyboard_report_util.cpp +++ b/tests/test_common/keyboard_report_util.cpp @@ -44,16 +44,21 @@ bool operator==(const report_keyboard_t& lhs, const report_keyboard_t& rhs) { return lhs.mods == rhs.mods && lhskeys == rhskeys; } -std::ostream& operator<<(std::ostream& stream, const report_keyboard_t& value) { - stream << "Keyboard report:" << std::endl; - stream << "Mods: " << (uint32_t)value.mods << std::endl; - stream << "Keys: "; +std::ostream& operator<<(std::ostream& stream, const report_keyboard_t& report) { + auto keys = get_keys(report); + // TODO: This should probably print friendly names for the keys - for (uint32_t k : get_keys(value)) { - stream << k << " "; + stream << "Keyboard Report: Mods (" << (uint32_t)report.mods << ") Keys ("; + + for (auto key = keys.cbegin(); key != keys.cend();) { + stream << +(*key); + key++; + if (key != keys.cend()) { + stream << ","; + } } - stream << std::endl; - return stream; + + return stream << ")" << std::endl; } KeyboardReportMatcher::KeyboardReportMatcher(const std::vector<uint8_t>& keys) { |