Enhance UTF-8 sanitization logic and add delays in test setup for reliable timing

This commit is contained in:
Ben Meadors
2026-04-25 15:04:58 -05:00
parent 554188e90e
commit 7800dc3c8d
2 changed files with 6 additions and 2 deletions

View File

@@ -124,10 +124,10 @@ bool sanitizeUtf8(char *buf, size_t bufSize)
if (!buf || bufSize == 0)
return false;
// Ensure null-terminated within buffer
// Ensure null-terminated within buffer; report if we had to enforce it
bool replaced = (buf[bufSize - 1] != '\0');
buf[bufSize - 1] = '\0';
bool replaced = false;
size_t i = 0;
size_t len = strlen(buf);

View File

@@ -303,6 +303,10 @@ void setup()
{
initializeTestEnvironment();
// Wait for portduino's millis() clock to start ticking before tests run
testDelay(10);
testDelay(2000);
UNITY_BEGIN();
RUN_TEST(test_setLastSentToMesh_stores_millis);