Skip to content

Commit e945ce8

Browse files
committed
Merge branch 'feature/17' into develop
2 parents 108ebe2 + d94b61f commit e945ce8

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

CHANGELOG.md

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

src/gpio/gpiobasic.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ class GpioBasic {
101101
};
102102
#if __has_include(<gmock/gmock.h>)
103103
// GCOVR_EXCL_START
104-
class MockGpioBasic : public SdkWrapper {
104+
class MockGpioBasic : public GpioBasic {
105105
public:
106+
MockGpioBasic(SdkWrapper &sdk)
107+
: GpioBasic(sdk, 0) {}; // 0 is dummy. We don't care.
106108
MOCK_METHOD1(SetDir, void(bool));
107109
MOCK_METHOD1(SetInputEnabled, void(bool));
108110
MOCK_METHOD1(Put, void(bool));

test/test_mockgpiobasic.cpp

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

0 commit comments

Comments
 (0)