From b617ba3b71330d43d3ddbc90d73754bdbb82c82b Mon Sep 17 00:00:00 2001 From: Li Cao Date: Fri, 22 Nov 2024 03:00:13 +0800 Subject: [PATCH] [spinel] fix spinel_prop_codec unit test (#10950) 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. --- tests/unit/test_spinel_prop_codec.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/test_spinel_prop_codec.cpp b/tests/unit/test_spinel_prop_codec.cpp index 19f76526a..2506f9438 100644 --- a/tests/unit/test_spinel_prop_codec.cpp +++ b/tests/unit/test_spinel_prop_codec.cpp @@ -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 @@ -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(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); @@ -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(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, @@ -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(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);