[test] cover src match handling (#11258)

This commit adds tests to cover the handling of Src Match entries,
including adding, removing and clearing of short addr entries and
extended addr entries.
This commit is contained in:
Yakun Xu
2025-02-19 19:18:25 -08:00
committed by GitHub
parent 36a8f71d06
commit 6fac4078b6
3 changed files with 173 additions and 7 deletions
+31 -7
View File
@@ -51,6 +51,11 @@
using namespace ot;
bool operator<(const otExtAddress &aLeft, const otExtAddress &aRight)
{
return memcmp(&aLeft, &aRight, sizeof(aLeft)) < 0;
}
namespace ot {
FakePlatform *FakePlatform::sPlatform = nullptr;
@@ -396,19 +401,38 @@ otRadioCaps otPlatRadioGetCaps(otInstance *) { return OT_RADIO_CAPS_NONE; }
bool otPlatRadioGetPromiscuous(otInstance *) { return false; }
void otPlatRadioEnableSrcMatch(otInstance *, bool) {}
void otPlatRadioEnableSrcMatch(otInstance *, bool aEnabled)
{
FakePlatform::CurrentPlatform().SrcMatchEnable(aEnabled);
}
otError otPlatRadioAddSrcMatchShortEntry(otInstance *, uint16_t) { return OT_ERROR_NONE; }
otError otPlatRadioAddSrcMatchShortEntry(otInstance *, uint16_t aShortAddr)
{
FakePlatform::CurrentPlatform().SrcMatchAddShortEntry(aShortAddr);
return OT_ERROR_NONE;
}
otError otPlatRadioAddSrcMatchExtEntry(otInstance *, const otExtAddress *) { return OT_ERROR_NONE; }
otError otPlatRadioAddSrcMatchExtEntry(otInstance *, const otExtAddress *aExtAddr)
{
FakePlatform::CurrentPlatform().SrcMatchAddExtEntry(*aExtAddr);
return OT_ERROR_NONE;
}
otError otPlatRadioClearSrcMatchShortEntry(otInstance *, uint16_t) { return OT_ERROR_NONE; }
otError otPlatRadioClearSrcMatchShortEntry(otInstance *, uint16_t aShortAddr)
{
FakePlatform::CurrentPlatform().SrcMatchClearShortEntry(aShortAddr);
return OT_ERROR_NONE;
}
otError otPlatRadioClearSrcMatchExtEntry(otInstance *, const otExtAddress *) { return OT_ERROR_NONE; }
otError otPlatRadioClearSrcMatchExtEntry(otInstance *, const otExtAddress *aExtAddr)
{
FakePlatform::CurrentPlatform().SrcMatchClearExtEntry(*aExtAddr);
return OT_ERROR_NONE;
}
void otPlatRadioClearSrcMatchShortEntries(otInstance *) {}
void otPlatRadioClearSrcMatchShortEntries(otInstance *) { FakePlatform::CurrentPlatform().SrcMatchClearShortEntries(); }
void otPlatRadioClearSrcMatchExtEntries(otInstance *) {}
void otPlatRadioClearSrcMatchExtEntries(otInstance *) { FakePlatform::CurrentPlatform().SrcMatchClearExtEntries(); }
otError otPlatRadioEnergyScan(otInstance *, uint8_t, uint16_t) { return OT_ERROR_NOT_IMPLEMENTED; }