-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestNeighbors.cpp
More file actions
52 lines (43 loc) · 1.37 KB
/
Copy pathtestNeighbors.cpp
File metadata and controls
52 lines (43 loc) · 1.37 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
#include <iostream>
#include <vector>
#include "computeNeighbors.hpp"
void textExpectedVector(int node, int numberNodes, std::vector<int> expected) {
std::cout << "expected out-neighbors of " << node << " : ";
printNeighbors(expected);
std::cout << "computed out-neighbors are ";
printNeighbors(computeOutNeighbors(node, numberNodes));
std::cout << std::endl;
}
void textExpected(int node, int expectedPredecessor) {
std::cout << "expected predecessor of " << node << " : "
<< expectedPredecessor << std::endl;
std::cout << "computed predecessor is " << computePredecessor(node)
<< std::endl
<< std::endl;
}
int main(int argc, char *argv[]) {
std::cout << "Testing some predecessors" << std::endl;
textExpected(0, 0);
textExpected(1, 0);
textExpected(3, 1);
textExpected(15, 7);
textExpected(8, 0);
std::cout << "Testing some out-neighbors" << std::endl;
std::vector<int> expected;
expected.push_back(1);
expected.push_back(2);
expected.push_back(4);
expected.push_back(8);
textExpectedVector(0, 16, expected);
expected.clear();
expected.push_back(3);
expected.push_back(5);
expected.push_back(9);
textExpectedVector(1, 16, expected);
expected.clear();
expected.push_back(7);
expected.push_back(11);
textExpectedVector(3, 16, expected);
expected.clear();
textExpectedVector(8, 16, expected);
}