From b624f32f944acdc59dcb130674c09090c5c404cb Mon Sep 17 00:00:00 2001 From: skullY Date: Fri, 30 Aug 2019 11:19:03 -0700 Subject: clang-format changes --- tests/test_common/keyboard_report_util.cpp | 62 +++++++++++++----------------- 1 file changed, 27 insertions(+), 35 deletions(-) (limited to 'tests/test_common/keyboard_report_util.cpp') diff --git a/tests/test_common/keyboard_report_util.cpp b/tests/test_common/keyboard_report_util.cpp index bf728b9a2a..245072c0ea 100644 --- a/tests/test_common/keyboard_report_util.cpp +++ b/tests/test_common/keyboard_report_util.cpp @@ -14,30 +14,29 @@ * along with this program. If not, see . */ - #include "keyboard_report_util.hpp" - #include - #include - using namespace testing; +#include "keyboard_report_util.hpp" +#include +#include +using namespace testing; - namespace - { - std::vector get_keys(const report_keyboard_t& report) { - std::vector result; - #if defined(NKRO_ENABLE) - #error NKRO support not implemented yet - #elif defined(USB_6KRO_ENABLE) - #error 6KRO support not implemented yet - #else - for(size_t i=0; i get_keys(const report_keyboard_t& report) { + std::vector result; +#if defined(NKRO_ENABLE) +# error NKRO support not implemented yet +#elif defined(USB_6KRO_ENABLE) +# error 6KRO support not implemented yet +#else + for (size_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (report.keys[i]) { + result.emplace_back(report.keys[i]); } - #endif - std::sort(result.begin(), result.end()); - return result; - } - } + } +#endif + std::sort(result.begin(), result.end()); + return result; +} +} // namespace bool operator==(const report_keyboard_t& lhs, const report_keyboard_t& rhs) { auto lhskeys = get_keys(lhs); @@ -50,7 +49,7 @@ std::ostream& operator<<(std::ostream& stream, const report_keyboard_t& value) { stream << "Mods: " << (uint32_t)value.mods << std::endl; stream << "Keys: "; // TODO: This should probably print friendly names for the keys - for (uint32_t k: get_keys(value)) { + for (uint32_t k : get_keys(value)) { stream << k << " "; } stream << std::endl; @@ -59,24 +58,17 @@ std::ostream& operator<<(std::ostream& stream, const report_keyboard_t& value) { KeyboardReportMatcher::KeyboardReportMatcher(const std::vector& keys) { memset(m_report.raw, 0, sizeof(m_report.raw)); - for (auto k: keys) { + for (auto k : keys) { if (IS_MOD(k)) { m_report.mods |= MOD_BIT(k); - } - else { + } else { add_key_to_report(&m_report, k); } } } -bool KeyboardReportMatcher::MatchAndExplain(report_keyboard_t& report, MatchResultListener* listener) const { - return m_report == report; -} +bool KeyboardReportMatcher::MatchAndExplain(report_keyboard_t& report, MatchResultListener* listener) const { return m_report == report; } -void KeyboardReportMatcher::DescribeTo(::std::ostream* os) const { - *os << "is equal to " << m_report; -} +void KeyboardReportMatcher::DescribeTo(::std::ostream* os) const { *os << "is equal to " << m_report; } -void KeyboardReportMatcher::DescribeNegationTo(::std::ostream* os) const { - *os << "is not equal to " << m_report; -} \ No newline at end of file +void KeyboardReportMatcher::DescribeNegationTo(::std::ostream* os) const { *os << "is not equal to " << m_report; } \ No newline at end of file -- cgit v1.2.3