Skip to content

Commit 0ad8103

Browse files
committed
Issue #18 : The constructor of the MockI2sSlaveDuplex.hpp is missing.
Added consturctor and tested by new test case MockI2sSlaveDuplexTest.Constructor.
1 parent e945ce8 commit 0ad8103

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/i2s/i2sslaveduplex.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ class I2sSlaveDuplex {
153153
// GCOVR_EXCL_START
154154
class MockI2sSlaveDuplex : public I2sSlaveDuplex {
155155
public:
156+
MockI2sSlaveDuplex(SdkWrapper &sdk)
157+
: I2sSlaveDuplex(sdk, 0, 0) {} // // 0 is dummy. We don't care.
156158
MOCK_METHOD0(GetStateMachine, uint32_t(void));
157159
MOCK_METHOD0(Start, void(void));
158160
MOCK_METHOD0(Stop, void(void));

test/test_mocki2sslaveduplex.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Test the MockI2sSlaveDuplex class.
3+
* Only constructor is tested.
4+
*/
5+
6+
#include <gmock/gmock.h>
7+
#include <gtest/gtest.h>
8+
9+
#include "i2sslaveduplex.hpp"
10+
#include "sdkwrapper.hpp"
11+
12+
class MockI2sSlaveDuplexTest : public ::testing::Test {
13+
protected:
14+
virtual void SetUp() { i2s = new rpp_driver::MockI2sSlaveDuplex(sdk_); }
15+
16+
virtual void TearDown() { delete i2s; }
17+
18+
::rpp_driver::MockSdkWrapper sdk_;
19+
::rpp_driver::MockI2sSlaveDuplex *i2s;
20+
}; // MockI2sSlaveDuplexTest
21+
22+
/*
23+
* In this test case, we test teh MockI2sSlaveDuplex is surely able to
24+
* compile. So, none of the other methods are tested.
25+
*/
26+
TEST_F(MockI2sSlaveDuplexTest, Constructor) {}

0 commit comments

Comments
 (0)