Files
kaleidoscope-mirror/testing/ExpectedKeyboardReport.cpp
Michael Richters 9b04d6663c Run IWYU (with the new tools) on test simulator code
This mixes some manual work (IWYU pragmas, a better solution to the Arduino
preprocessor macros problem) with automated running of the tools.  At this
point, it would be too much work to separate these into distinct commits, and
there isn't that much value to doing so.

There are still some things we could do to make things more robust, as some of
the headers need to be in a certain order, which happens to be in the same sort
order used by IWYU (`testing/*` files need to come after certain headers than
include `Arduino.h`), but it's probably not worth the clutter of adding an `#if
1` just to stop IWYU from re-ordering them.

I tried to get `#pragma push_macro("max")/pop_macro("max")` to work, but ended
up getting completely nonsensical compilation errors, so I gave up on it.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
2022-05-08 12:48:59 -05:00

47 lines
1.4 KiB
C++

/* -*- mode: c++ -*-
* Copyright (C) 2020 Keyboard.io, Inc
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "testing/ExpectedKeyboardReport.h"
#include <cstdint> // for uint8_t, uint32_t
#include <set> // for set
namespace kaleidoscope {
namespace testing {
ExpectedKeyboardReport::ExpectedKeyboardReport(uint32_t timestamp,
const std::set<uint8_t> &keycodes,
std::string message) {
timestamp_ = timestamp;
keycodes_ = std::set<uint8_t>(keycodes);
failure_message_ = message;
}
const std::set<uint8_t> &ExpectedKeyboardReport::Keycodes() const {
return keycodes_;
}
uint32_t ExpectedKeyboardReport::Timestamp() const {
return timestamp_;
}
const std::string &ExpectedKeyboardReport::Message() const {
return failure_message_;
}
} // namespace testing
} // namespace kaleidoscope