10 Commits

Author SHA1 Message Date
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
Michael Richters
e5d67efd58 Format codebase with clang-format
Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
2022-03-28 12:41:38 -05:00
Michael Richters
29ebffe099 Add function for verification of expected mouse reports
Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
2022-03-03 17:45:53 -06:00
Michael Richters
0670113b66 Move checking of keyboard reports to a separate function
Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
2022-03-03 17:45:42 -06:00
Michael Richters
72c2e0fe27 Rename *Report functions to *KeyboardReport
In preparation for validation of report types other than just Keyboard, rename
these keyboard-specific functions (and variables) to have appropriately
keyboard-specific names.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
2022-03-03 17:44:56 -06:00
Michael Richters
3160edfd8c Improve report verification in testing
This replaces the `CHECK_EXPECTED_REPORTS()` macro with a new `CheckReports()`
method. The new method verifies both the content and timestamps of expected
keyboard reports, and provides more output on failures (including details of any
unexpected reports).

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
2020-11-12 14:36:12 -06:00
Jesse Vincent
d8b674f4dc Small error in my cherry-picking. 2020-11-09 21:08:33 -08:00
Jesse Vincent
eebf8e639b Add a variant of ExpectReport that takes an explicit list of keycodes
Signed-off-by: Jesse Vincent <jesse@keyboard.io>
2020-11-09 20:39:15 -08:00
Michael Richters
78e9ec4291 Add event queue functions to testing infrastructure
This change adds a set of functions to the `VirtualDeviceTest` class to make it
possible to write simpler testcases involving timed keyswitch press and release
events along with corresponding keyboard HID reports.

Other outputs (Consumer & System Control HID reports, LEDs, et cetera) are
not yet included.
2020-11-09 20:33:36 -08:00
Eric Paniagua
fad1b7e051 Add a googletest-based test harness & tests
This adds a googletest-based test harness (with googletest pulled into
`testing/googletest`, so we have a fixed state of it), and a few test
cases that demonstrate its use.

Original work by Eric Paniagua in #898, with minor cleanups by Gergely
Nagy.

Signed-off-by: Eric Paniagua <epaniagua@google.com>
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
2020-09-25 22:19:01 +02:00