* @brief Tests the correctness of the string class comparison methods, such as `compare` and `operator==`. */
| 2244 | * @brief Tests the correctness of the string class comparison methods, such as `compare` and `operator==`. |
| 2245 | */ |
| 2246 | void test_comparisons() { |
| 2247 | // Comparing relative order of the strings |
| 2248 | assert("a"_sv.compare("a") == 0); |
| 2249 | assert("a"_sv.compare("ab") == -1); |
| 2250 | assert("ab"_sv.compare("a") == 1); |
| 2251 | assert("a"_sv.compare("a\0"_sv) == -1); |
| 2252 | assert("a\0"_sv.compare("a") == 1); |
| 2253 | assert("a\0"_sv.compare("a\0"_sv) == 0); |
| 2254 | assert("a"_sv == "a"_sv); |
| 2255 | assert("a"_sv != "a\0"_sv); |
| 2256 | assert("a\0"_sv == "a\0"_sv); |
| 2257 | } |
| 2258 | |
| 2259 | /** |
| 2260 | * @brief Tests the correctness of the string class search methods, such as `find` and `find_first_of`. |