mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Remove the ill-considered StringRef::numberOfCharacters
It never counted characters, only codepoints. If you think these are interchangeable, you should not touch non-ascii text.
This commit is contained in:
		| @@ -1045,9 +1045,6 @@ String.tests.cpp:<line number>: passed: stdStr == "a stringref" for: "a stringre | ||||
| String.tests.cpp:<line number>: passed: stdStr.size() == sr.size() for: 11 == 11 | ||||
| String.tests.cpp:<line number>: passed: stdStr == "a stringref" for: "a stringref" == "a stringref" | ||||
| String.tests.cpp:<line number>: passed: stdStr.size() == sr.size() for: 11 == 11 | ||||
| String.tests.cpp:<line number>: passed: ascii.numberOfCharacters() == ascii.size() for: 39 == 39 | ||||
| String.tests.cpp:<line number>: passed: simpleu8.numberOfCharacters() == 30 for: 30 == 30 | ||||
| String.tests.cpp:<line number>: passed: emojis.numberOfCharacters() == 9 for: 9 == 9 | ||||
| ToStringChrono.tests.cpp:<line number>: passed: minute == seconds for: 1 m == 60 s | ||||
| ToStringChrono.tests.cpp:<line number>: passed: hour != seconds for: 1 h != 60 s | ||||
| ToStringChrono.tests.cpp:<line number>: passed: micro != milli for: 1 us != 1 ms | ||||
|   | ||||
| @@ -1381,5 +1381,5 @@ due to unexpected exception with message: | ||||
|  | ||||
| =============================================================================== | ||||
| test cases:  300 |  226 passed |  70 failed |  4 failed as expected | ||||
| assertions: 1562 | 1410 passed | 131 failed | 21 failed as expected | ||||
| assertions: 1559 | 1407 passed | 131 failed | 21 failed as expected | ||||
|  | ||||
|   | ||||
| @@ -7837,28 +7837,6 @@ String.tests.cpp:<line number>: PASSED: | ||||
| with expansion: | ||||
|   11 == 11 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| StringRef | ||||
|   Counting utf-8 codepoints | ||||
| ------------------------------------------------------------------------------- | ||||
| String.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| String.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( ascii.numberOfCharacters() == ascii.size() ) | ||||
| with expansion: | ||||
|   39 == 39 | ||||
|  | ||||
| String.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( simpleu8.numberOfCharacters() == 30 ) | ||||
| with expansion: | ||||
|   30 == 30 | ||||
|  | ||||
| String.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( emojis.numberOfCharacters() == 9 ) | ||||
| with expansion: | ||||
|   9 == 9 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Stringifying std::chrono::duration helpers | ||||
| ------------------------------------------------------------------------------- | ||||
| @@ -12484,5 +12462,5 @@ Misc.tests.cpp:<line number>: PASSED: | ||||
|  | ||||
| =============================================================================== | ||||
| test cases:  300 |  210 passed |  86 failed |  4 failed as expected | ||||
| assertions: 1579 | 1410 passed | 148 failed | 21 failed as expected | ||||
| assertions: 1576 | 1407 passed | 148 failed | 21 failed as expected | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <testsuitesloose text artifact | ||||
| > | ||||
|   <testsuite name="<exe-name>" errors="17" failures="132" tests="1580" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> | ||||
|   <testsuite name="<exe-name>" errors="17" failures="132" tests="1577" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> | ||||
|     <properties> | ||||
|       <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/> | ||||
|       <property name="random-seed" value="1"/> | ||||
| @@ -729,7 +729,6 @@ Matchers.tests.cpp:<line number> | ||||
|     <testcase classname="<exe-name>.global" name="StringRef/to std::string/implicitly constructed" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="StringRef/to std::string/explicitly constructed" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="StringRef/to std::string/assigned" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="StringRef/Counting utf-8 codepoints" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Stringifying std::chrono::duration helpers" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Stringifying std::chrono::duration with weird ratios" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Stringifying std::chrono::time_point<system_clock>" time="{duration}"/> | ||||
|   | ||||
| @@ -9667,33 +9667,6 @@ Message from section two | ||||
|         </Section> | ||||
|         <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||
|       </Section> | ||||
|       <Section name="Counting utf-8 codepoints" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" > | ||||
|         <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" > | ||||
|           <Original> | ||||
|             ascii.numberOfCharacters() == ascii.size() | ||||
|           </Original> | ||||
|           <Expanded> | ||||
|             39 == 39 | ||||
|           </Expanded> | ||||
|         </Expression> | ||||
|         <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" > | ||||
|           <Original> | ||||
|             simpleu8.numberOfCharacters() == 30 | ||||
|           </Original> | ||||
|           <Expanded> | ||||
|             30 == 30 | ||||
|           </Expanded> | ||||
|         </Expression> | ||||
|         <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" > | ||||
|           <Original> | ||||
|             emojis.numberOfCharacters() == 9 | ||||
|           </Original> | ||||
|           <Expanded> | ||||
|             9 == 9 | ||||
|           </Expanded> | ||||
|         </Expression> | ||||
|         <OverallResults successes="3" failures="0" expectedFailures="0"/> | ||||
|       </Section> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="Stringifying std::chrono::duration helpers" tags="[chrono][toString]" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > | ||||
| @@ -14861,7 +14834,7 @@ loose text artifact | ||||
|       </Section> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <OverallResults successes="1410" failures="149" expectedFailures="21"/> | ||||
|     <OverallResults successes="1407" failures="149" expectedFailures="21"/> | ||||
|   </Group> | ||||
|   <OverallResults successes="1410" failures="148" expectedFailures="21"/> | ||||
|   <OverallResults successes="1407" failures="148" expectedFailures="21"/> | ||||
| </Catch> | ||||
|   | ||||
| @@ -159,18 +159,6 @@ TEST_CASE( "StringRef", "[Strings][StringRef]" ) { | ||||
|             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", "[Strings][StringManip]" ) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský