From 521a5ac755c455f3368213910f706c44296a19c0 Mon Sep 17 00:00:00 2001 From: t0mpr1c3 Date: Wed, 13 Sep 2023 08:11:39 -0400 Subject: [PATCH] fix tests --- test/test_boards.cpp | 2 +- test/test_com.cpp | 6 ------ test/test_tester.cpp | 9 +-------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/test/test_boards.cpp b/test/test_boards.cpp index a79a376b1..bd6926844 100644 --- a/test/test_boards.cpp +++ b/test/test_boards.cpp @@ -55,5 +55,5 @@ KnitterInterface *GlobalKnitter::m_instance = knitter; int main(int argc, char *argv[]) { ::testing::InitGoogleMock(&argc, argv); - return RUN_ALL_TESTS(); + return RUN_ALL_TESTS(); } diff --git a/test/test_com.cpp b/test/test_com.cpp index 699086a79..1c741ea73 100644 --- a/test/test_com.cpp +++ b/test/test_com.cpp @@ -27,7 +27,6 @@ #include #include -#include #include using ::testing::_; @@ -37,7 +36,6 @@ using ::testing::Return; extern Com *com; -extern BeeperMock *beeper; extern FsmMock *fsm; extern KnitterMock *knitter; @@ -48,14 +46,12 @@ class ComTest : public ::testing::Test { serialMock = serialMockInstance(); // pointer to global instance - beeperMock = beeper; fsmMock = fsm; knitterMock = knitter; // The global instance does not get destroyed at the end of each test. // Ordinarily the mock instance would be local and such behaviour would // cause a memory leak. We must notify the test that this is not the case. - Mock::AllowLeak(beeperMock); Mock::AllowLeak(fsmMock); Mock::AllowLeak(knitterMock); @@ -69,7 +65,6 @@ class ComTest : public ::testing::Test { } ArduinoMock *arduinoMock; - BeeperMock *beeperMock; FsmMock *fsmMock; KnitterMock *knitterMock; SerialMock *serialMock; @@ -211,7 +206,6 @@ TEST_F(ComTest, test_sendCmd) { TEST_F(ComTest, test_beepCmd) { uint8_t buffer[] = {beepCmd_msgid}; - EXPECT_CALL(*beeperMock, ready()).Times(1); EXPECT_CALL(*arduinoMock, analogWrite(PIEZO_PIN, _)).Times(AtLeast(1)); expected_write_onPacketReceived(buffer, sizeof(buffer), true); } diff --git a/test/test_tester.cpp b/test/test_tester.cpp index fce2b5110..c8013f750 100644 --- a/test/test_tester.cpp +++ b/test/test_tester.cpp @@ -23,10 +23,8 @@ #include -#include #include -#include #include #include @@ -38,7 +36,6 @@ using ::testing::Return; extern Tester *tester; -extern BeeperMock *beeper; extern FsmMock *fsm; extern KnitterMock *knitter; @@ -50,14 +47,12 @@ class TesterTest : public ::testing::Test { // serialCommandMock = serialCommandMockInstance(); // pointers to global instances - beeperMock = beeper; fsmMock = fsm; knitterMock = knitter; // The global instances do not get destroyed at the end of each test. // Ordinarily the mock instance would be local and such behaviour would // cause a memory leak. We must notify the test that this is not the case. - Mock::AllowLeak(beeperMock); Mock::AllowLeak(fsmMock); Mock::AllowLeak(knitterMock); } @@ -68,10 +63,9 @@ class TesterTest : public ::testing::Test { } ArduinoMock *arduinoMock; - SerialMock *serialMock; - BeeperMock *beeperMock; FsmMock *fsmMock; KnitterMock *knitterMock; + SerialMock *serialMock; void expect_startTest(unsigned long t) { EXPECT_CALL(*fsmMock, getState).WillOnce(Return(OpState::ready)); @@ -123,7 +117,6 @@ TEST_F(TesterTest, test_sendCmd) { TEST_F(TesterTest, test_beepCmd) { expect_write(true); - EXPECT_CALL(*beeperMock, ready()).Times(1); EXPECT_CALL(*arduinoMock, analogWrite(PIEZO_PIN, _)).Times(AtLeast(1)); tester->beepCmd(); }