diff options
author | David Kalnischkies <david@kalnischkies.de> | 2020-12-03 10:35:29 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2021-02-03 17:36:45 +0100 |
commit | 1b3ad3891465f8b72bcedfb4edd513cb74eec7f3 (patch) | |
tree | 0d89ec30abdf7d4075bad5b35645bd204f5def3c /test/libapt/strutil_test.cc | |
parent | bb553c3884f811792a1d8021ea8396cbe1ec0b23 (diff) |
Add a simple test for APT::String::DisplayLength
References: 2497198e9599a6a8d4d0ad08627bcfc7ea49c644
Gbp-Dch: Ignore
Diffstat (limited to 'test/libapt/strutil_test.cc')
-rw-r--r-- | test/libapt/strutil_test.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index b7132c35f..349946b5f 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -361,3 +361,20 @@ TEST(StrUtilTest, LookupTag) EXPECT_EQ("Value4", LookupTag(msg, "Field4", "")); EXPECT_EQ("Value5", LookupTag(msg, "Field5", "")); } + +TEST(StrUtilTest, DisplayLength) +{ + EXPECT_EQ(0, APT::String::DisplayLength("")); + EXPECT_EQ(1, APT::String::DisplayLength("a")); + EXPECT_EQ(3, APT::String::DisplayLength("apt")); + EXPECT_EQ(1, APT::String::DisplayLength("@")); + EXPECT_EQ(3, APT::String::DisplayLength("き")); + + EXPECT_EQ(1, APT::String::DisplayLength("$")); + EXPECT_EQ(2, APT::String::DisplayLength("¢")); + EXPECT_EQ(3, APT::String::DisplayLength("ह")); + EXPECT_EQ(3, APT::String::DisplayLength("€")); + EXPECT_EQ(3, APT::String::DisplayLength("한")); + EXPECT_EQ(4, APT::String::DisplayLength("𐍈")); + EXPECT_EQ(16, APT::String::DisplayLength("𐍈한€ह¢$")); +} |