Debian Codegraph @

CorsixTH/CppTest/test_th_strings.cpp

raw
1 #include <catch2/catch_test_macros.hpp>
2 #include <catch2/matchers/catch_matchers.hpp>
3 #include <catch2/matchers/catch_matchers_string.hpp>
4 #include <string>
5
6 #include "../Src/th_strings.h"
7
8 TEST_CASE("skip whitespace", "[skip_utf8_whitespace]") {
9 const char* str = " \t \n 1234";
10 const char* end = str + 10;
11
12 skip_utf8_whitespace(str, end);
13
14 REQUIRE_THAT(str, Catch::Matchers::Equals("1234"));
15 }
16
17 TEST_CASE("leave non-whitespace", "[skip_utf8_whitespace]") {
18 const char* str = "1234 ";
19 const char* end = str + 8;
20
21 skip_utf8_whitespace(str, end);
22
23 REQUIRE_THAT(str, Catch::Matchers::Equals("1234 "));
24 }
25
26 TEST_CASE("remove entire string of whitespace", "[skip_utf8_whitespace]") {
27 const char* str = " \t \n ";
28 const char* end = str + 10;
29
30 skip_utf8_whitespace(str, end);
31
32 REQUIRE_THAT(str, Catch::Matchers::Equals(""));
33 }