-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_main.cpp
50 lines (40 loc) · 1.42 KB
/
test_main.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
49
50
#include <fstream>
#include <gtest/gtest.h>
#include "work.h"
std::string input_name;
TEST(Work_in_computers_club, Test_1_ALL_RUN) {
std::ifstream real("google_test/test_real");
std::ifstream check("google_test/check.txt");
work_in_club(input_name.c_str());
std::string work_r, work;
while (std::getline(real, work_r) && std::getline(check, work)) {
ASSERT_EQ(work_r, work);
}
}
TEST(Work_in_computers_club, Test_2_ALL_RUN) {
std::ifstream real("google_test/test_real2.txt");
std::ifstream check("google_test/check.txt");
work_in_club("google_test/test2.txt");
std::string work_r, work;
while (std::getline(real, work_r) && std::getline(check, work)) {
ASSERT_EQ(work_r, work);
}
}
TEST(Work_in_computers_club, Test_3_WRONG_INPUT_DATA_ID_1) {
ASSERT_DEATH({work_in_club("google_test/test3.txt");}, "06:00 1 cliEnt&");
}
TEST(Work_in_computers_club, Test_4_WRONG_INPUT_DATA_ID_2) {
ASSERT_DEATH({work_in_club("google_test/test4.txt");}, "06:00 2 client");
}
TEST(Work_in_computers_club, Test_5_WRONG_INPUT_DATA_ID_3) {
ASSERT_DEATH({work_in_club("google_test/test5.txt");}, "06:3 3 client3");
}
TEST(Work_in_computers_club, Test_6_WRONG_INPUT_DATA_ID_4) {
ASSERT_DEATH({work_in_club("google_test/test6.txt");}, "06:00 4 client 2");
}
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
input_name = argv[1];
return RUN_ALL_TESTS();
}