Skip to content

Commit 12dfc1c

Browse files
committed
Merge branch 'feature/18' into develop
2 parents e945ce8 + 0954790 commit 12dfc1c

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The issue #16 changes its public member function. But it is referred internally
1515
### Fixed
1616
- [Issue #11](https://github.com/suikan4github/rpp_driver/issues/11) Fails to compile in MSVC.
1717
- [Issue #17](https://github.com/suikan4github/rpp_driver/issues/17) The mock of the GpioBasic has the wrong definition.
18+
- [Issue #18](https://github.com/suikan4github/rpp_driver/issues/18) The constructor of the MockI2sSlaveDuplex.hpp is missing.
1819
### Security
1920
### Known Issue
2021

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)