forked from ChicoState/UnitTestPractice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPracticeTest.cpp
More file actions
156 lines (125 loc) · 2.51 KB
/
PracticeTest.cpp
File metadata and controls
156 lines (125 loc) · 2.51 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/**
* Unit Tests for Practice class
**/
#include <gtest/gtest.h>
#include "Practice.h"
class PracticeTest : public ::testing::Test
{
protected:
PracticeTest(){} //constructor runs before each test
virtual ~PracticeTest(){} //destructor cleans up after tests
virtual void SetUp(){} //sets up before each test (after constructor)
virtual void TearDown(){} //clean up after each test, (before destructor)
};
/*
void sortDescending(int & first, int & second, int & third);
bool isPalindrome(string input);
int count_starting_repeats(string word);
*/
TEST(PracticeTest, smoke_test)
{
ASSERT_TRUE(true);
}
TEST(PracticeTest, zzz_repetition)
{
Practice obj;
ASSERT_EQ(obj.count_starting_repeats("zzz"), 2);
//ASSERT_EQ(obj.count_starting_repeats("zzazzz"), 2);
}
TEST(PracticeTest, zzazzz_repetition)
{
Practice obj;
ASSERT_EQ(obj.count_starting_repeats("zzazzz"), 1);
}
TEST(PracticeTest, ZZzzazzz_repetition)
{
Practice obj;
ASSERT_EQ(obj.count_starting_repeats("ZZzzazzz"), 1);
}
TEST(PracticeTest, Zz_repetition)
{
Practice obj;
ASSERT_EQ(obj.count_starting_repeats("Zz"), 0);
}
TEST(PracticeTest, blank_repetition)
{
Practice obj;
ASSERT_EQ(obj.count_starting_repeats(""), 0);
}
TEST(PracticeTest, zzzzzzAzzzz_repetition)
{
Practice obj;
ASSERT_EQ(obj.count_starting_repeats("AzzzzzzAzzzz"), 0);
}
TEST(PracticeTest, azzz_repetition)
{
Practice obj;
ASSERT_EQ(obj.count_starting_repeats("azzz"), 0);
}
TEST(PracticeTest, hannah_palindrome)
{
Practice obj;
ASSERT_EQ(obj.isPalindrome("hannah"), true);
}
TEST(PracticeTest, abab_palindrome)
{
Practice obj;
ASSERT_EQ(obj.isPalindrome("abab"), false);
}
TEST(PracticeTest, AbBA_palindrome)
{
Practice obj;
ASSERT_EQ(obj.isPalindrome("abBA"), true);
}
TEST(PracticeTest, 123_sort)
{
Practice obj;
int a = 1;
int b = 2;
int c = 3;
obj.sortDescending(a,b,c);
ASSERT_EQ(a,3);
ASSERT_EQ(b,2);
ASSERT_EQ(c,1);
}
TEST(PracticeTest, 333_sort)
{
Practice obj;
int a = 3;
int b = 3;
int c = 3;
obj.sortDescending(a,b,c);
ASSERT_EQ(a,3);
ASSERT_EQ(b,3);
ASSERT_EQ(c,3);
}
TEST(PracticeTest, 321_sort)
{
Practice obj;
int a = 3;
int b = 2;
int c = 1;
obj.sortDescending(a,b,c);
ASSERT_EQ(a,3);
ASSERT_EQ(b,2);
ASSERT_EQ(c,1);
}
TEST(PracticeTest, 213_sort)
{
Practice obj;
int a = 2;
int b = 1;
int c = 3;
obj.sortDescending(a,b,c);
ASSERT_EQ(a,3);
ASSERT_EQ(b,2);
ASSERT_EQ(c,1);
}
/*
TEST(PracticeTest, 0_nighter)
{
Practice obj;
int nights [7] = {0,0,0,0,0,0,0}
ASSERT_EQ(obj.allnighter(nights), )
}
*/