Add a test in XStringW.

This commit is contained in:
Jief L 2020-04-09 18:12:48 +03:00
parent 97d1d23eb0
commit da5dc56504
2 changed files with 12 additions and 1 deletions

View File

@ -183,7 +183,8 @@ void XObjArrayNC<TYPE>::CheckSize(xsize nNewSize, xsize nGrowBy)
nNewSize += nGrowBy + 1;
_Data = (XObjArrayEntry<TYPE> *)realloc((void *)_Data, sizeof(XObjArrayEntry<TYPE>) * nNewSize, sizeof(XObjArrayEntry<TYPE>) * m_allocatedSize);
if ( !_Data ) {
XObjArray_DBG("XObjArrayNC<TYPE>::CheckSize(nNewSize=%llu, nGrowBy=%llu) : Xrealloc(%llu, %llu, %" PRIuPTR ") returned NULL. System halted\n", nNewSize, nGrowBy, m_allocatedSize, sizeof(XObjArrayEntry<TYPE>) * nNewSize, (uintptr_t)_Data);
DebugLog(2, "XObjArrayNC<TYPE>::CheckSize(nNewSize=%llu, nGrowBy=%llu) : Xrealloc(%llu, %llu, %" PRIuPTR ") returned NULL. System halted\n", nNewSize, nGrowBy, m_allocatedSize, sizeof(XObjArrayEntry<TYPE>) * nNewSize, (uintptr_t)_Data);
panic();
}
// memset(&_Data[m_allocatedSize], 0, (nNewSize-m_allocatedSize) * sizeof(XObjArrayEntry<TYPE>));
m_allocatedSize = nNewSize;

View File

@ -162,6 +162,16 @@ int XStringW_tests()
#endif
#endif
{
XStringW utf16;
utf16.takeValueFrom(L"Выход из подменю, обновление главного меню\n");
for ( size_t i = 0 ; i < utf16.length() ; i++ ) {
if ( utf16[i] != utf16.wc_str()[i] ) {
return 100;
}
}
}
// XStringW CommonName(L"EFI\\CLOVER\\misc\\screenshot");
// for (UINTN Index = 0; Index < 20; Index++) {
// XStringW Name = CommonName + SPrintf("%lld", Index) + L".png";