-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyTests.h
More file actions
59 lines (52 loc) · 1.45 KB
/
Copy pathMyTests.h
File metadata and controls
59 lines (52 loc) · 1.45 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
//
// Created by Admin on 24.02.2016.
//
#ifndef THREADS_TESTSUIT_H
#define THREADS_TESTSUIT_H
#include <cxxtest-4.3/cxxtest/TestSuite.h>
#include "stack.h"
class MyTests :: CxxTest::TestSuite
{
public:
//Тест обхода в глубину, результаты обработки теста должны соответствовать массиву значений , полученным при обходе в ширину
void test1()
{
nodeptr root = NULL;
nodeptr parent = NULL;
bstree tree;
for(int i = 0; i < 100000; i++) {
tree.insert(i, root,parent);
}
map<int,int> modelmap;
map<int,int> testmap;
wideTreeTraversal(root,modelmap);
depthTreeTraversal(root,testmap);
TS_ASSERT_EQUALS(modelmap,testmap);
/*if(modelmap == testmap)
{
cout << "test1 success" << endl;
} else {
cout << "test1 failed" << endl;
}
modelmap.clear();
testmap.clear();*/
}
//Тест на проверку вставки в map
void test2()
{
map<int,int> testmap;
int key = 1;
int value = 3;
insertToMap(key,value,testmap);
if(testmap.find(1)->second == 3)
{
cout << "test2 success" << endl;
}
else
{
cout << "test2 failed" << endl;
}
testmap.clear();
}
};
#endif //THREADS_TESTSUIT_H