aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_common/main.cpp32
-rw-r--r--tests/test_common/test_fixture.cpp8
2 files changed, 38 insertions, 2 deletions
diff --git a/tests/test_common/main.cpp b/tests/test_common/main.cpp
new file mode 100644
index 000000000..3e4b4c0f9
--- /dev/null
+++ b/tests/test_common/main.cpp
@@ -0,0 +1,32 @@
1#include "gtest/gtest.h"
2
3extern "C" {
4#include "stdio.h"
5#include "debug.h"
6
7int8_t sendchar(uint8_t c) {
8 fprintf(stderr, "%c", c);
9 return 0;
10}
11
12__attribute__((weak)) debug_config_t debug_config = {0};
13
14void init_logging(void) {
15 print_set_sendchar(sendchar);
16
17 // Customise these values to desired behaviour
18 // debug_enable = true;
19 // debug_matrix = true;
20 // debug_keyboard = true;
21 // debug_mouse = true;
22 debug_config.raw = 0xFF;
23}
24}
25
26int main(int argc, char **argv) {
27 ::testing::InitGoogleTest(&argc, argv);
28
29 init_logging();
30
31 return RUN_ALL_TESTS();
32} \ No newline at end of file
diff --git a/tests/test_common/test_fixture.cpp b/tests/test_common/test_fixture.cpp
index 20ed838eb..e041df712 100644
--- a/tests/test_common/test_fixture.cpp
+++ b/tests/test_common/test_fixture.cpp
@@ -7,10 +7,10 @@
7#include "action_tapping.h" 7#include "action_tapping.h"
8 8
9extern "C" { 9extern "C" {
10#include "debug.h"
11#include "eeconfig.h"
10#include "action_layer.h" 12#include "action_layer.h"
11}
12 13
13extern "C" {
14void set_time(uint32_t t); 14void set_time(uint32_t t);
15void advance_time(uint32_t ms); 15void advance_time(uint32_t ms);
16} 16}
@@ -21,6 +21,10 @@ using testing::Between;
21using testing::Return; 21using testing::Return;
22 22
23void TestFixture::SetUpTestCase() { 23void TestFixture::SetUpTestCase() {
24 // The following is enough to bootstrap the values set in main
25 eeconfig_init_quantum();
26 eeconfig_update_debug(debug_config.raw);
27
24 TestDriver driver; 28 TestDriver driver;
25 EXPECT_CALL(driver, send_keyboard_mock(_)); 29 EXPECT_CALL(driver, send_keyboard_mock(_));
26 keyboard_init(); 30 keyboard_init();