-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcheck_whitespace_test.cpp
48 lines (36 loc) · 1015 Bytes
/
check_whitespace_test.cpp
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
#include <gtest/gtest.h>
#include "check_whitespace.h"
TEST(strip, EmptyString) {
ASSERT_STREQ("", strip(""));
}
TEST(strip, NoWhitespace) {
ASSERT_STREQ("frog", strip("frog"));
}
TEST(strip, WhitespaceOnFront) {
ASSERT_STREQ("frog", strip(" frog"));
}
TEST(strip, WhitespaceOnBack) {
ASSERT_STREQ("frog", strip("frog "));
}
TEST(strip, WhitespaceOnBothEnds) {
ASSERT_STREQ("frog", strip(" frog "));
}
TEST(is_clean, EmptyString) {
ASSERT_TRUE(is_clean(""));
}
TEST(is_clean, NoWhitespace) {
ASSERT_TRUE(is_clean("University of Minnesota Morris"));
}
TEST(is_clean, WhitespaceOnFront) {
ASSERT_FALSE(is_clean(" University of Minnesota Morris"));
}
TEST(is_clean, WhitespaceOnBack) {
ASSERT_FALSE(is_clean("University of Minnesota Morris "));
}
TEST(is_clean, WhitespaceOnBothEnds) {
ASSERT_FALSE(is_clean(" University of Minnesota Morris" ));
}
int main(int argc, char *argv[]) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}