Skip to content

Commit

Permalink
fix boundary test case
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdecenzo committed May 17, 2022
1 parent b18243c commit 39f67e1
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,16 @@ void TestUDCClientState(nlTestSuite * inSuite, void * inContext)
char rotatingIdLongString[chip::Dnssd::kMaxRotatingIdLen * 2 + 1];
uint8_t rotatingIdLong[chip::Dnssd::kMaxRotatingIdLen];
size_t rotatingIdLongLen;
strcpy(rotatingIdLongString,
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
GetRotatingDeviceId(GetSpan(rotatingIdLongString), rotatingIdLong, &rotatingIdLongLen);
strcpy(
rotatingIdLongString,
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");

printf(" max length %zu, long length %zu\n", chip::Dnssd::kMaxRotatingIdLen, rotatingIdLongLen);
const ByteSpan & value = GetSpan(rotatingIdLongString);
rotatingIdLongLen = Encoding::HexToBytes(reinterpret_cast<const char *>(value.data()), value.size(), rotatingIdLong,
chip::Dnssd::kMaxRotatingIdLen * 2);

printf("str len=%zu max length %zu, long length %zu\n", strlen(rotatingIdLongString), chip::Dnssd::kMaxRotatingIdLen,
rotatingIdLongLen);
NL_TEST_ASSERT(inSuite, rotatingIdLongLen > chip::Dnssd::kMaxRotatingIdLen);

// test base case
Expand Down

0 comments on commit 39f67e1

Please sign in to comment.