mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Add tests for StringRef::numberOfCharacters
This commit is contained in:
parent
1b2fa601c6
commit
3b6fda3c1b
@ -36,7 +36,7 @@ namespace Catch {
|
||||
}
|
||||
} // namespace Catch
|
||||
|
||||
TEST_CASE( "StringRef", "[Strings]" ) {
|
||||
TEST_CASE( "StringRef", "[Strings][StringRef]" ) {
|
||||
|
||||
using Catch::StringRef;
|
||||
|
||||
@ -164,9 +164,21 @@ TEST_CASE( "StringRef", "[Strings]" ) {
|
||||
REQUIRE( stdStr.size() == sr.size() );
|
||||
}
|
||||
}
|
||||
|
||||
SECTION( "Counting utf-8 codepoints" ) {
|
||||
StringRef ascii = "just a plain old boring ascii string...";
|
||||
REQUIRE(ascii.numberOfCharacters() == ascii.size());
|
||||
|
||||
StringRef simpleu8 = u8"Trocha češtiny nikoho nezabila";
|
||||
REQUIRE(simpleu8.numberOfCharacters() == 30);
|
||||
|
||||
StringRef emojis = u8"Here be 👾";
|
||||
REQUIRE(emojis.numberOfCharacters() == 9);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE( "replaceInPlace" ) {
|
||||
TEST_CASE( "replaceInPlace", "[Strings][StringManip]" ) {
|
||||
std::string letters = "abcdefcg";
|
||||
SECTION( "replace single char" ) {
|
||||
CHECK( Catch::replaceInPlace( letters, "b", "z" ) );
|
||||
|
Loading…
Reference in New Issue
Block a user