Utils: Fix long small string

We used only 6 bit to save the short size but for SmallString with a size
over 64 it is not enough. So we have now to use a uint16 instead of a
uint8 if the size if over 64.

Change-Id: I53558e492b6cb40b739b23a8af83d192a2e11bd2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2017-01-31 12:18:08 +01:00
parent 729c535376
commit a0c69c517c
7 changed files with 61 additions and 19 deletions

View File

@@ -33,6 +33,7 @@
using namespace ::testing;
using Utils::PathString;
using Utils::SmallString;
using Utils::SmallStringLiteral;
using Utils::SmallStringView;
@@ -445,6 +446,15 @@ TEST(SmallString, SizeShortSmallString)
ASSERT_THAT(size, 4);
}
TEST(SmallString, SizeShortPathString)
{
SmallString shortPath("very very very very very very very very very very very long path which fits in the short memory");
auto size = shortPath.size();
ASSERT_THAT(size, 95);
}
TEST(SmallString, SizeLongSmallString)
{
auto longText = SmallString::fromUtf8("very very very very very very very very very very very long string");