Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
89 lines (73 loc) · 2.68 KB

File metadata and controls

89 lines (73 loc) · 2.68 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include "catch.hpp"
#include "test_config.hpp"
#include "svbb/trim.hpp"
#include "svbb/util.hpp"
#include "svbb/literals.hpp"
namespace {
using namespace SVBB_NAMESPACE;
using namespace SVBB_NAMESPACE::literals;
TEST_CASE("trim_left single character")
{
REQUIRE(trim_left(""_sv, ' ') == "");
REQUIRE(trim_left(" "_sv, ' ') == "");
REQUIRE(trim_left(" a"_sv, ' ') == "a");
REQUIRE(trim_left(" a"_sv, ' ') == "a");
REQUIRE(trim_left(" a "_sv, ' ') == "a ");
REQUIRE(trim_left(" "_sv, 'a') == " ");
REQUIRE(trim_left("a"_sv, 'a') == "");
REQUIRE(trim_left(" ab c "_sv, ' ') == "ab c ");
REQUIRE(trim_left(" ab c "_sv, ' ') == "ab c ");
REQUIRE(trim_left(" ab c "_sv, 'a') == " ab c ");
REQUIRE(trim_left("ab c "_sv, 'a') == "b c ");
}
TEST_CASE("trim_left multiple characters")
{
REQUIRE(trim_left(""_sv, ""_sv) == "");
REQUIRE(trim_left(" \t abcd "_sv, ""_sv) == " \t abcd ");
REQUIRE(trim_left(" \t abcd "_sv, " \t"_sv) == "abcd ");
REQUIRE(trim_left(" \t abcd "_sv, " \tabcd"_sv) == "");
}
TEST_CASE("trim_right single character")
{
REQUIRE(trim_right(""_sv, ' ') == "");
REQUIRE(trim_right(" "_sv, ' ') == "");
REQUIRE(trim_right("a "_sv, ' ') == "a");
REQUIRE(trim_right("a "_sv, ' ') == "a");
REQUIRE(trim_right(" a "_sv, ' ') == " a");
REQUIRE(trim_right(" "_sv, 'a') == " ");
REQUIRE(trim_right("a"_sv, 'a') == "");
REQUIRE(trim_right(" ab c "_sv, ' ') == " ab c");
REQUIRE(trim_right(" ab c "_sv, ' ') == " ab c");
REQUIRE(trim_right(" ab c "_sv, 'c') == " ab c ");
REQUIRE(trim_right(" ab c"_sv, 'c') == " ab ");
}
TEST_CASE("trim_right multiple characters")
{
REQUIRE(trim_right(""_sv, ""_sv) == "");
REQUIRE(trim_right(" \t abcd "_sv, ""_sv) == " \t abcd ");
REQUIRE(trim_right(" \t abcd \t"_sv, " \t"_sv) == " \t abcd");
REQUIRE(trim_right(" \t abcd "_sv, " \tabcd"_sv) == "");
}
TEST_CASE("trim single character")
{
REQUIRE(trim(""_sv, ' ') == "");
REQUIRE(trim(" "_sv, ' ') == "");
REQUIRE(trim("a "_sv, ' ') == "a");
REQUIRE(trim("a "_sv, ' ') == "a");
REQUIRE(trim(" a "_sv, ' ') == "a");
REQUIRE(trim(" "_sv, 'a') == " ");
REQUIRE(trim("a"_sv, 'a') == "");
REQUIRE(trim(" ab c "_sv, ' ') == "ab c");
REQUIRE(trim(" ab c "_sv, ' ') == "ab c");
REQUIRE(trim(" ab c "_sv, 'c') == " ab c ");
REQUIRE(trim(" ab c"_sv, 'c') == " ab ");
REQUIRE(trim("cab c"_sv, 'c') == "ab ");
}
TEST_CASE("trim multiple characters")
{
REQUIRE(trim(""_sv, ""_sv) == "");
REQUIRE(trim(" \t abcd "_sv, ""_sv) == " \t abcd ");
REQUIRE(trim(" \t abcd \t"_sv, " \t"_sv) == "abcd");
REQUIRE(trim(" \t abcd "_sv, " \tabcd"_sv) == "");
}
} // namespace
Morty Proxy This is a proxified and sanitized view of the page, visit original site.