forked from philips-software/amp-embedded-infra-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: generic pairing/bonding classes updated (philips-software#330)
* Generic pairing/bonding classes updated * All functions on GapPairingObserver converted to pure virtual * unit tests for gap pairing implemented * unit tests for gap bonding implemented * two code smells fixed * missing field for pairing error added
- Loading branch information
1 parent
a3f3cb5
commit dbda405
Showing
15 changed files
with
364 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "infra/util/test_helper/MemoryRangeMatcher.hpp" | ||
#include "services/ble/Gap.hpp" | ||
#include "services/ble/test_doubles/GapBondingMock.hpp" | ||
#include "services/ble/test_doubles/GapBondingObserverMock.hpp" | ||
#include "gmock/gmock.h" | ||
|
||
namespace services | ||
{ | ||
namespace | ||
{ | ||
class GapBondingDecoratorTest | ||
: public testing::Test | ||
{ | ||
public: | ||
GapBondingMock gapBonding; | ||
GapBondingDecorator decorator{ gapBonding }; | ||
GapBondingObserverMock gapBondingObserver{ decorator }; | ||
}; | ||
} | ||
|
||
TEST_F(GapBondingDecoratorTest, forward_all_events_to_observers) | ||
{ | ||
EXPECT_CALL(gapBondingObserver, NumberOfBondsChanged(::testing::Eq(10))); | ||
|
||
gapBonding.NotifyObservers([](GapBondingObserver& obs) | ||
{ | ||
obs.NumberOfBondsChanged(10); | ||
}); | ||
} | ||
|
||
TEST_F(GapBondingDecoratorTest, forward_all_calls_to_subject) | ||
{ | ||
EXPECT_CALL(gapBonding, RemoveAllBonds()); | ||
decorator.RemoveAllBonds(); | ||
|
||
EXPECT_CALL(gapBonding, RemoveOldestBond()); | ||
decorator.RemoveOldestBond(); | ||
|
||
EXPECT_CALL(gapBonding, GetMaxNumberOfBonds()).WillOnce(testing::Return(5)); | ||
EXPECT_EQ(decorator.GetMaxNumberOfBonds(), 5); | ||
|
||
EXPECT_CALL(gapBonding, GetNumberOfBonds()).WillOnce(testing::Return(5)); | ||
EXPECT_EQ(decorator.GetNumberOfBonds(), 5); | ||
} | ||
} |
Oops, something went wrong.