Skip to content

Commit

Permalink
[spinel] fix spinel_prop_codec unit test (openthread#10950)
Browse files Browse the repository at this point in the history
This commit fixes an issue in spinel_prop_codec unit test.

We cannot use Spinel::Decoder::ReadUintPacked with a spinel_prop_key_t
type. This will cause build errors on arm platforms.
  • Loading branch information
Irving-cl authored Nov 21, 2024
1 parent 9ae7de5 commit b617ba3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/unit/test_spinel_prop_codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void TestDnssd(void)
Spinel::Decoder decoder;
uint8_t header;
unsigned int command;
spinel_prop_key_t propKey;
unsigned int propKey;
otError error = OT_ERROR_NONE;

// Test DnssdHost encoding and decoding
Expand Down Expand Up @@ -80,7 +80,7 @@ void TestDnssd(void)
SuccessOrQuit(error = decoder.ReadUintPacked(command));
VerifyOrQuit(command == SPINEL_CMD_PROP_VALUE_INSERTED);
SuccessOrQuit(error = decoder.ReadUintPacked(propKey));
VerifyOrQuit(propKey == SPINEL_PROP_DNSSD_HOST);
VerifyOrQuit(static_cast<spinel_prop_key_t>(propKey) == SPINEL_PROP_DNSSD_HOST);
SuccessOrQuit(error = DecodeDnssdHost(decoder, dnssdHostDecode, requestId, callbackData, callbackDataLen));
VerifyOrQuit(strcmp(dnssdHostDecode.mHostName, dnssdHostEncode.mHostName) == 0);
VerifyOrQuit(dnssdHostDecode.mAddressesLength == dnssdHostEncode.mAddressesLength);
Expand Down Expand Up @@ -121,7 +121,7 @@ void TestDnssd(void)
SuccessOrQuit(error = decoder.ReadUintPacked(command));
VerifyOrQuit(command == SPINEL_CMD_PROP_VALUE_INSERTED);
SuccessOrQuit(error = decoder.ReadUintPacked(propKey));
VerifyOrQuit(propKey == SPINEL_PROP_DNSSD_SERVICE);
VerifyOrQuit(static_cast<spinel_prop_key_t>(propKey) == SPINEL_PROP_DNSSD_SERVICE);
const char *dnssdSubTypeDecode[] = {nullptr, nullptr, nullptr};
uint16_t dnssdSubTypeCount = sizeof(dnssdSubTypeDecode) / sizeof(dnssdSubTypeDecode[0]);
SuccessOrQuit(error = DecodeDnssdService(decoder, dnssdServiceDecode, dnssdSubTypeDecode, dnssdSubTypeCount,
Expand Down Expand Up @@ -167,7 +167,7 @@ void TestDnssd(void)
SuccessOrQuit(error = decoder.ReadUintPacked(command));
VerifyOrQuit(command == SPINEL_CMD_PROP_VALUE_INSERTED);
SuccessOrQuit(error = decoder.ReadUintPacked(propKey));
VerifyOrQuit(propKey == SPINEL_PROP_DNSSD_KEY_RECORD);
VerifyOrQuit(static_cast<spinel_prop_key_t>(propKey) == SPINEL_PROP_DNSSD_KEY_RECORD);
SuccessOrQuit(error = DecodeDnssdKey(decoder, dnssdKeyDecode, requestId, callbackData, callbackDataLen));
VerifyOrQuit(strcmp(dnssdKeyDecode.mName, dnssdKeyEncode.mName) == 0);
VerifyOrQuit(dnssdKeyDecode.mServiceType == dnssdKeyEncode.mServiceType);
Expand Down

0 comments on commit b617ba3

Please sign in to comment.