forked from mecchmatProjects/CppCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
87 lines (69 loc) · 1.47 KB
/
main.cpp
File metadata and controls
87 lines (69 loc) · 1.47 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
#define TESTS_NUM 6
#include "./headers/trukhan_cpp_project_plant.h"
#include <exception>
#include <iostream>
void test_person()
{
cout << "Start" << endl;
Person TEST_UNIT_1;
TEST_UNIT_1.set_name("Ernest");
cout << TEST_UNIT_1.get_name() << endl;
string INPUT_NAME;
cout << "Input your name" << endl;
cin >> INPUT_NAME;
Person TEST_UNIT_2(INPUT_NAME);
cout << TEST_UNIT_2.get_name() << endl;
Person TEST_UNIT_3;
cin >> TEST_UNIT_3;
cout << TEST_UNIT_3;
}
void test_employee()
{
cout << "Start" << endl;
}
void test_manager()
{
cout << "Start" << endl;
}
void test_product()
{
cout << "Start" << endl;
}
void test_equipment()
{
cout << "Start" << endl;
}
void test_profession()
{
cout << "Start" << endl;
}
void (*tests[TESTS_NUM])() = {
test_person,
test_employee,
test_manager,
test_product,
test_equipment,
test_profession
};
int main()
{
unsigned v;
try
{
cout << "Tests for ... \n"
"1 - class Person \n"
"2 - class Employee \n"
"3 - class Manager \n"
"4 - class Product \n"
"5 - class Equipment \n"
"6 - class Profession \n";
cin >> v;
if(!cin || (v > TESTS_NUM) || !v)
throw runtime_error("Invalid input\n");
tests[v-1]();
}
catch (runtime_error e)
{
cerr << e.what();
}
}