mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-21 03:55:00 +00:00
Some basic unit tests for string truncation
This commit is contained in:
parent
a373c2516a
commit
5a09fcc35e
8
unit.cpp
8
unit.cpp
@ -10,3 +10,11 @@ TEST_CASE("UTF-8 enforcement", "[utf8]") {
|
|||||||
REQUIRE(check_utf8("👋🌏") == std::string(""));
|
REQUIRE(check_utf8("👋🌏") == std::string(""));
|
||||||
REQUIRE(check_utf8("Hola m\xF3n") == std::string("\"Hola m\xF3n\" is not valid UTF-8 (0xF3 0x6E)"));
|
REQUIRE(check_utf8("Hola m\xF3n") == std::string("\"Hola m\xF3n\" is not valid UTF-8 (0xF3 0x6E)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("UTF-8 truncation", "[trunc]") {
|
||||||
|
REQUIRE(truncate16("0123456789abcdefghi", 16) == std::string("0123456789abcdef"));
|
||||||
|
REQUIRE(truncate16("0123456789éîôüéîôüç", 16) == std::string("0123456789éîôüéî"));
|
||||||
|
REQUIRE(truncate16("0123456789😀😬😁😂😃😄😅😆", 16) == std::string("0123456789😀😬😁"));
|
||||||
|
REQUIRE(truncate16("0123456789😀😬😁😂😃😄😅😆", 17) == std::string("0123456789😀😬😁"));
|
||||||
|
REQUIRE(truncate16("0123456789あいうえおかきくけこさ", 16) == std::string("0123456789あいうえおか"));
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user