diff --git a/src/kaleidoscope/Runtime.cpp b/src/kaleidoscope/Runtime.cpp index 59ab3eb8..07ac4d67 100644 --- a/src/kaleidoscope/Runtime.cpp +++ b/src/kaleidoscope/Runtime.cpp @@ -59,26 +59,18 @@ Runtime_::setup(void) { void Runtime_::loop(void) { - std::cout << "epan 2.2.1.1" << std::endl; millis_at_cycle_start_ = millis(); - std::cout << "epan 2.2.1.2" << std::endl; kaleidoscope::Hooks::beforeEachCycle(); - std::cout << "epan 2.2.1.3" << std::endl; device().scanMatrix(); - std::cout << "epan 2.2.1.4" << std::endl; kaleidoscope::Hooks::beforeReportingState(); - std::cout << "epan 2.2.1.5" << std::endl; device().hid().keyboard().sendReport(); - std::cout << "epan 2.2.1.6" << std::endl; device().hid().keyboard().releaseAllKeys(); - std::cout << "epan 2.2.1.7" << std::endl; kaleidoscope::Hooks::afterEachCycle(); - std::cout << "epan 2.2.1.8" << std::endl; } Runtime_ Runtime; diff --git a/testing/common/Simulator.cpp b/testing/common/Simulator.cpp index ece065a5..265e4e3c 100644 --- a/testing/common/Simulator.cpp +++ b/testing/common/Simulator.cpp @@ -1,5 +1,5 @@ /* kailedoscope::sim - Simulator for Unit Testing Kaleidoscope - * Copyright (C) 2020 epan + * Copyright (C) 2020 Eric Paniagua * * 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 @@ -24,9 +24,7 @@ namespace kaleidoscope { namespace testing { void Simulator::RunCycle() { - std::cout << "epan 2.2.1" << std::endl; Kaleidoscope.loop(); - std::cout << "epan 2.2.2" << std::endl; } void Simulator::RunCycles(size_t n) { diff --git a/testing/common/VirtualDeviceTest.cpp b/testing/common/VirtualDeviceTest.cpp index bce40c5e..267ebf7d 100644 --- a/testing/common/VirtualDeviceTest.cpp +++ b/testing/common/VirtualDeviceTest.cpp @@ -20,11 +20,8 @@ namespace kaleidoscope { namespace testing { void VirtualDeviceTest::RunCycle() { - std::cout << "epan 2.1" << std::endl; state_.Clear(); - std::cout << "epan 2.2" << std::endl; sim_.RunCycle(); - std::cout << "epan 2.3" << std::endl; } void VirtualDeviceTest::RunCycles(size_t n) { diff --git a/testing/common/fix-macros.h b/testing/common/fix-macros.h index 2940f996..4ca9bd22 100644 --- a/testing/common/fix-macros.h +++ b/testing/common/fix-macros.h @@ -14,9 +14,9 @@ * this program. If not, see . */ -// We intentionally omit `#pragma once` since we need to set up macros per -// compilation unit. -// #pragma once +#pragma once + +#include "Kaleidoscope.h" #undef min #undef max @@ -27,6 +27,8 @@ #define SETUP_GOOGLETEST() \ void executeTestFunction() { \ setup(); /* setup Kaleidoscope */ \ + /* Turn off virtual_io's input. */ \ + Kaleidoscope.device().keyScanner().setEnableReadMatrix(false); \ testing::InitGoogleTest(); \ RUN_ALL_TESTS(); \ } diff --git a/testing/hello-simulator/Makefile b/testing/hello-simulator/Makefile index 527b7a19..bb6fb3ca 100644 --- a/testing/hello-simulator/Makefile +++ b/testing/hello-simulator/Makefile @@ -11,7 +11,7 @@ TEST_OBJS=$(patsubst %.cpp,${OBJ_DIR}/%.o,$(TEST_FILES)) run: ${BIN_DIR}/${BIN_FILE} @echo "run" - "./${BIN_DIR}/${BIN_FILE}" -t + "./${BIN_DIR}/${BIN_FILE}" -t -q ${BIN_DIR}/${BIN_FILE}: ${TEST_OBJS} FORCE @echo "link" diff --git a/testing/kaleidoscope/Makefile b/testing/kaleidoscope/Makefile index bb991b5d..e94ac7c3 100644 --- a/testing/kaleidoscope/Makefile +++ b/testing/kaleidoscope/Makefile @@ -12,7 +12,7 @@ TEST_OBJS=$(patsubst $(SRC_DIR)/%.cpp,${OBJ_DIR}/%.o,$(TEST_FILES)) run: ${BIN_DIR}/${BIN_FILE} @echo "run" - "./${BIN_DIR}/${BIN_FILE}" -t + "./${BIN_DIR}/${BIN_FILE}" -t -q ${BIN_DIR}/${BIN_FILE}: ${TEST_OBJS} FORCE @echo "link" diff --git a/testing/kaleidoscope/test/simulator_test.cpp b/testing/kaleidoscope/test/simulator_test.cpp index bffbe165..ad7775e8 100644 --- a/testing/kaleidoscope/test/simulator_test.cpp +++ b/testing/kaleidoscope/test/simulator_test.cpp @@ -38,27 +38,21 @@ using ::testing::IsEmpty; class KeyboardReports : public VirtualDeviceTest {}; TEST_F(KeyboardReports, KeysActiveWhenPressed) { - std::cout << "epan 1" << std::endl; sim_.Press(2, 1); // A - std::cout << "epan 2" << std::endl; RunCycle(); - std::cout << "epan 3" << std::endl; EXPECT_EQ(Result().KeyboardReports().size(), 1); - std::cout << "epan 4" << std::endl; EXPECT_THAT( Result().KeyboardReports(0).ActiveKeycodes(), ContainsKey(Key_A)); - std::cout << "epan 5" << std::endl; sim_.Release(2, 1); // A - std::cout << "epan 6" << std::endl; RunCycles(2); - std::cout << "epan 7" << std::endl; - std::cout << "epan 8" << std::endl; - EXPECT_THAT(Result().KeyboardReports(), IsEmpty()); - std::cout << "epan 9" << std::endl; + EXPECT_EQ(Result().KeyboardReports().size(), 1); + EXPECT_THAT( + Result().KeyboardReports(0).ActiveKeycodes(), + IsEmpty()); } } // namespace