File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ The issue #16 changes its public member function. But it is referred internally
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.
1818- [ Issue #18 ] ( https://github.com/suikan4github/rpp_driver/issues/18 ) The constructor of the MockI2sSlaveDuplex.hpp is missing.
19- ### Security
19+ - [ Issue #19 ] ( https://github.com/suikan4github/rpp_driver/issues/19 ) The Mock of the rpp_driver::Adau1361 is missing.
20+ ### Security
2021### Known Issue
2122
2223## [ v1.0.0] 2024-10-03
Original file line number Diff line number Diff line change @@ -159,6 +159,24 @@ class Adau1361 {
159159 bool line_output_mute_;
160160 bool hp_output_mute_; // headphone
161161};
162+
163+ #if __has_include(<gmock/gmock.h>)
164+ // GCOVR_EXCL_START
165+ class MockAdau1361 : public Adau1361 {
166+ public:
167+ MockAdau1361 (Adau1361Lower& adau1361_lower)
168+ : Adau1361(48'000 , 12'000'000 , adau1361_lower) {
169+ } // with dummy fs and dummy mclock
170+
171+ MOCK_METHOD0 (Start, void (void ));
172+ MOCK_METHOD3 (SetGain,
173+ void (CodecChannel channel, float left_gain, float right_gain));
174+ MOCK_METHOD2 (Mute, void (CodecChannel channel, bool mute));
175+ MOCK_METHOD1 (Mute, void (CodecChannel channel));
176+ };
177+ // GCOVR_EXCL_STOP
178+ #endif // __has_include(<gmock/gmock.h>)
179+
162180} // namespace rpp_driver
163181
164182#endif /* PICO_DRIVER_SRC_CODEC_ADAU1361_HPP_ */
Original file line number Diff line number Diff line change @@ -154,15 +154,15 @@ class I2sSlaveDuplex {
154154class MockI2sSlaveDuplex : public I2sSlaveDuplex {
155155 public:
156156 MockI2sSlaveDuplex (SdkWrapper &sdk)
157- : I2sSlaveDuplex(sdk, 0 , 0 ) {} // // 0 is dummy. We don't care.
157+ : I2sSlaveDuplex(sdk, 0 , 0 ) {} // 0 is dummy. We don't care.
158158 MOCK_METHOD0 (GetStateMachine, uint32_t (void ));
159159 MOCK_METHOD0 (Start, void (void ));
160160 MOCK_METHOD0 (Stop, void (void ));
161161 MOCK_METHOD1 (PutFifoBlocking, void (int32_t value));
162162 MOCK_METHOD0 (GetFifoBlocking, int32_t ());
163163};
164- #endif // __has_include(<gmock/gmock.h>)
165164// GCOVR_EXCL_STOP
165+ #endif // __has_include(<gmock/gmock.h>)
166166} // namespace rpp_driver
167167
168168#endif // PICO_DRIVER_SRC_I2S_DUPLEXSLAVEI2S_HPP_
Original file line number Diff line number Diff line change 1+ /*
2+ * Test the MockAdau1361 class.
3+ * Only constructor is tested.
4+ */
5+
6+ #include < gmock/gmock.h>
7+ #include < gtest/gtest.h>
8+
9+ #include " adau1361.hpp"
10+ #include " sdkwrapper.hpp"
11+
12+ using ::testing::_;
13+ class MockAdau1361Test : public ::testing::Test {
14+ protected:
15+ virtual void SetUp () {
16+ codec_lower_ = new ::rpp_driver::MockAdau1361Lower (i2c_);
17+ codec_ = new ::rpp_driver::MockAdau1361 (*codec_lower_);
18+ }
19+
20+ virtual void TearDown () {
21+ delete codec_;
22+ delete codec_lower_;
23+ }
24+
25+ ::rpp_driver::MockI2cMasterInterface i2c_;
26+ ::rpp_driver::MockAdau1361Lower *codec_lower_;
27+ ::rpp_driver::Adau1361 *codec_;
28+ }; // MockAdau1361Test
29+
30+ /*
31+ * In this test case, we test teh MockAdau1361 is surely able to
32+ * compile. So, none of the other methods are tested.
33+ */
34+ TEST_F (MockAdau1361Test, Constructor) {}
You can’t perform that action at this time.
0 commit comments