summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDrashna Jael're <drashna@live.com>2021-10-11 20:36:47 -0700
committerDrashna Jael're <drashna@live.com>2021-10-11 20:36:47 -0700
commitb34675555cbd9a71a797a7ebc2148cbf2e8f0efc (patch)
tree2d701310ccd3fc2c603d63536ab4a3c1d9b9381b /tests
parentbcddde8738dbba48c548f1e3f12a10bbf60a65d8 (diff)
parentd9e077468ab3446cbd7306a453a73dad2c1403e8 (diff)
Merge commit 'd9e077468ab3446cbd7306a453a73dad2c1403e8' into firmware_21
Diffstat (limited to 'tests')
-rw-r--r--tests/test_common/keyboard_report_util.cpp2
-rw-r--r--tests/test_common/main.cpp32
-rw-r--r--tests/test_common/test_fixture.cpp8
3 files changed, 39 insertions, 3 deletions
diff --git a/tests/test_common/keyboard_report_util.cpp b/tests/test_common/keyboard_report_util.cpp
index cb044c92b3..f73cf239e0 100644
--- a/tests/test_common/keyboard_report_util.cpp
+++ b/tests/test_common/keyboard_report_util.cpp
@@ -24,7 +24,7 @@ std::vector<uint8_t> get_keys(const report_keyboard_t& report) {
std::vector<uint8_t> result;
#if defined(NKRO_ENABLE)
# error NKRO support not implemented yet
-#elif defined(USB_6KRO_ENABLE)
+#elif defined(RING_BUFFERED_6KRO_REPORT_ENABLE)
# error 6KRO support not implemented yet
#else
for (size_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
diff --git a/tests/test_common/main.cpp b/tests/test_common/main.cpp
new file mode 100644
index 0000000000..3e4b4c0f95
--- /dev/null
+++ b/tests/test_common/main.cpp
@@ -0,0 +1,32 @@
+#include "gtest/gtest.h"
+
+extern "C" {
+#include "stdio.h"
+#include "debug.h"
+
+int8_t sendchar(uint8_t c) {
+ fprintf(stderr, "%c", c);
+ return 0;
+}
+
+__attribute__((weak)) debug_config_t debug_config = {0};
+
+void init_logging(void) {
+ print_set_sendchar(sendchar);
+
+ // Customise these values to desired behaviour
+ // debug_enable = true;
+ // debug_matrix = true;
+ // debug_keyboard = true;
+ // debug_mouse = true;
+ debug_config.raw = 0xFF;
+}
+}
+
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+
+ init_logging();
+
+ return RUN_ALL_TESTS();
+} \ No newline at end of file
diff --git a/tests/test_common/test_fixture.cpp b/tests/test_common/test_fixture.cpp
index 20ed838eb6..e041df7128 100644
--- a/tests/test_common/test_fixture.cpp
+++ b/tests/test_common/test_fixture.cpp
@@ -7,10 +7,10 @@
#include "action_tapping.h"
extern "C" {
+#include "debug.h"
+#include "eeconfig.h"
#include "action_layer.h"
-}
-extern "C" {
void set_time(uint32_t t);
void advance_time(uint32_t ms);
}
@@ -21,6 +21,10 @@ using testing::Between;
using testing::Return;
void TestFixture::SetUpTestCase() {
+ // The following is enough to bootstrap the values set in main
+ eeconfig_init_quantum();
+ eeconfig_update_debug(debug_config.raw);
+
TestDriver driver;
EXPECT_CALL(driver, send_keyboard_mock(_));
keyboard_init();