blob: ee9c7c5d0f70e54f276c11391c8027563558c8a3 (
plain)
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
|
#include <StringTools/StringTools.h>
#include "Catch2.h"
using namespace Leonetienne::StringTools;
// Tests that lowering an empty string returns an empty string
TEST_CASE(__FILE__"/EmptyString", "[Strings][Lower]")
{
// Setup
const std::string in = "";
// Exercise
const std::string out = StringTools::Lower(in);
// Verify
REQUIRE(out == "");
return;
}
// Tests that lowering a string without any letters returns itself
TEST_CASE(__FILE__"/Symbols", "[Strings][Lower]")
{
// Setup
const std::string in = "66! _-\n*";
// Exercise
const std::string out = StringTools::Lower(in);
// Verify
REQUIRE(out == "66! _-\n*");
return;
}
// Tests that lowering a string of lowercase letters returns itself
TEST_CASE(__FILE__"/AlreadyLowered", "[Strings][Lower]")
{
// Setup
const std::string in = "ughareyouserious";
// Exercise
const std::string out = StringTools::Lower(in);
// Verify
REQUIRE(out == "ughareyouserious");
return;
}
// Tests that lowering a string of uppercase letters returns the lowercase version
TEST_CASE(__FILE__"/Uppercase", "[Strings][Lower]")
{
// Setup
const std::string in = "UGHAREYOUSERIOUS";
// Exercise
const std::string out = StringTools::Lower(in);
// Verify
REQUIRE(out == "ughareyouserious");
return;
}
// Tests that lowering a string of uppercase, lowercase letters and symbols returns the lowercase version
TEST_CASE(__FILE__"/Mixed", "[Strings][Lower]")
{
// Setup
const std::string in = "Ugh, Are You Serious?! DON'T DO THAT!!!";
// Exercise
const std::string out = StringTools::Lower(in);
// Verify
REQUIRE(out == "ugh, are you serious?! don't do that!!!");
return;
}
|