Sync with Xcode

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman
2025-03-12 11:14:19 +01:00
parent bfd8aaff65
commit 2694f59d79
3 changed files with 144 additions and 66 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
SPDX-License-Identifier: MIT
Copyright © 2023-2025 Amebis
*/
@@ -60,13 +60,15 @@ namespace UnitTests
{
wchar_t buf[8];
Assert::IsTrue(stdex::snprintf(buf, _countof(buf), L"This is %ls.", locale, L"a test") == 8);
Assert::IsTrue(stdex::strncmp(L"This is a test.", buf, _countof(buf)) == 0);
size_t n = stdex::snprintf(buf, _countof(buf), L"This is %ls.", locale, L"a test");
Assert::IsTrue(n <= _countof(buf));
Assert::IsTrue(stdex::strncmp(L"This is a test.", buf, n) == 0);
}
{
char buf[8];
Assert::IsTrue(stdex::snprintf(buf, _countof(buf), "This is %s.", locale, "a test") == 8);
Assert::IsTrue(stdex::strncmp("This is a test.", buf, _countof(buf)) == 0);
size_t n = stdex::snprintf(buf, _countof(buf), "This is %s.", locale, "a test");
Assert::IsTrue(n <= _countof(buf));
Assert::IsTrue(stdex::strncmp("This is a test.", buf, n) == 0);
}
}
}