Commit 10e3f947 authored by Dāvis Mosāns's avatar Dāvis Mosāns Committed by Brad King
Browse files

ConsoleBuf: Fix test to compare all bytes of wide character strings

std::wstring<>::size() returns characters, not bytes.

Change-Id: Iced3d7246d022e3eea582dbd880ff2c71a145f5d
parent c49ddccb
......@@ -591,14 +591,16 @@ static int testConsole()
}
std::wstring wideTestString = kwsys::Encoding::ToWide(encodedTestString);
std::wstring wideInputTestString = kwsys::Encoding::ToWide(encodedInputTestString);
if (memcmp(outputBuffer, wideTestString.c_str(), wideTestString.size()) == 0 &&
if (memcmp(outputBuffer, wideTestString.c_str(),
wideTestString.size() * sizeof(wchar_t)) == 0 &&
memcmp(outputBuffer + screenBufferInfo.dwSize.X * 1,
wideTestString.c_str(), wideTestString.size()) == 0 &&
wideTestString.c_str(), wideTestString.size() * sizeof(wchar_t)) == 0 &&
memcmp(outputBuffer + screenBufferInfo.dwSize.X * 2,
UnicodeInputTestString, sizeof(UnicodeInputTestString) -
sizeof(WCHAR)) == 0 &&
memcmp(outputBuffer + screenBufferInfo.dwSize.X * 3,
wideInputTestString.c_str(), wideInputTestString.size() - 1) == 0
wideInputTestString.c_str(),
(wideInputTestString.size() - 1) * sizeof(wchar_t)) == 0
) {
didFail = 0;
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment