mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
add unit test for NP v0 advertisement parsing
PiperOrigin-RevId: 523153029
This commit is contained in:
committed by
Copybara-Service
parent
665a334d0d
commit
574b88d7ef
@@ -242,6 +242,22 @@ TEST(AdvertisementDecoder, DecodeBaseNpWithTxActionField) {
|
||||
DataElement(DataElement(ActionBit::kNearbyShareAction))));
|
||||
}
|
||||
|
||||
TEST(AdvertisementDecoder, DecodeBaseNpV0PublicIdentityWithTxAndActionField) {
|
||||
AdvertisementDecoder decoder(GetScanRequest());
|
||||
|
||||
auto result = decoder.DecodeAdvertisement(
|
||||
// v0 public identity, power and action, action value 8 for active unlock.
|
||||
absl::HexStringToBytes("000336FF0080"));
|
||||
|
||||
EXPECT_OK(result);
|
||||
EXPECT_THAT(result->data_elements,
|
||||
UnorderedElementsAre(
|
||||
DataElement(DataElement::kPublicIdentityFieldType, ""),
|
||||
DataElement(DataElement::kTxPowerFieldType,
|
||||
absl::HexStringToBytes("ff")),
|
||||
DataElement(DataElement(ActionBit::kActiveUnlockAction))));
|
||||
}
|
||||
|
||||
TEST(AdvertisementDecoder,
|
||||
ScanForEncryptedIdentityIgnoresPublicIdentityAdvertisement) {
|
||||
AdvertisementDecoder decoder(
|
||||
|
||||
Reference in New Issue
Block a user