mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
String: Fix unit test failure for random seed 0xaccaaad0444426fa
This commit is contained in:
parent
c57041e5bc
commit
77f3073d92
1 changed files with 6 additions and 2 deletions
|
|
@ -2373,7 +2373,8 @@ public:
|
||||||
{
|
{
|
||||||
String s (createRandomWideCharString (r));
|
String s (createRandomWideCharString (r));
|
||||||
|
|
||||||
typename CharPointerType::CharType buffer [300];
|
using CharType = typename CharPointerType::CharType;
|
||||||
|
CharType buffer[300];
|
||||||
|
|
||||||
memset (buffer, 0xff, sizeof (buffer));
|
memset (buffer, 0xff, sizeof (buffer));
|
||||||
CharPointerType (buffer).writeAll (s.toUTF32());
|
CharPointerType (buffer).writeAll (s.toUTF32());
|
||||||
|
|
@ -2387,7 +2388,10 @@ public:
|
||||||
CharPointerType (buffer).writeAll (s.toUTF8());
|
CharPointerType (buffer).writeAll (s.toUTF8());
|
||||||
test.expectEquals (String (CharPointerType (buffer)), s);
|
test.expectEquals (String (CharPointerType (buffer)), s);
|
||||||
|
|
||||||
test.expect (CharPointerType::isValidString (buffer, (int) strlen ((const char*) buffer)));
|
const auto nullTerminator = std::find (buffer, buffer + std::size (buffer), (CharType) 0);
|
||||||
|
const auto numValidBytes = (int) std::distance (buffer, nullTerminator) * (int) sizeof (CharType);
|
||||||
|
|
||||||
|
test.expect (CharPointerType::isValidString (buffer, numValidBytes));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue