Unit test for NodeFamilyDefiner.
34 {
35
36 std::array<int, 5> intArray = { { 1, 5, 3, 4, 2} };
37 std::array<int, 5> intArray2 = { { 0, 3, 4, 6, 7} };
38 std::array<int, 5> intArray3 = { { 99, 101, 103, 104, 105} };
39 std::array<int, 3> intArray4 = { { 100, 101, 102} };
42 EXPECT_EQ(0, intNetwork.
size());
43
44
45 for (unsigned int index = 1 ; index < 5; index++) {
46
47 intNetwork.
addNode(intArray.at(index - 1), intArray.at(index - 1));
48 intNetwork.
addNode(intArray.at(index), intArray.at(index));
49
50 intNetwork.
linkNodes(intArray.at(index - 1), intArray.at(index));
51 }
52
53 for (unsigned int index = 1 ; index < 5; index++) {
54 intNetwork.
addNode(intArray2.at(index - 1), intArray2.at(index - 1));
55 intNetwork.
addNode(intArray2.at(index), intArray2.at(index));
56
57 intNetwork.
linkNodes(intArray2.at(index - 1), intArray2.at(index));
58 }
59
60 for (unsigned int index = 1 ; index < 5; index++) {
61 intNetwork.
addNode(intArray3.at(index - 1), intArray3.at(index - 1));
62 intNetwork.
addNode(intArray3.at(index), intArray3.at(index));
63
64 intNetwork.
linkNodes(intArray3.at(index - 1), intArray3.at(index));
65 }
66
67 for (unsigned int index = 1 ; index < 3; index++) {
68 intNetwork.
addNode(intArray4.at(index - 1), intArray4.at(index - 1));
69 intNetwork.
addNode(intArray4.at(index), intArray4.at(index));
70
71 intNetwork.
linkNodes(intArray4.at(index - 1), intArray4.at(index));
72 }
73
74
75 EXPECT_EQ(15, intNetwork.
size());
76
80 std::vector<DirectedNode<int, CACell>* >> familyDefiner;
81
82 short nFamilies = familyDefiner.defineFamilies(intNetwork);
83
84 EXPECT_EQ(2, nFamilies);
85 }
Network of directed nodes of the type EntryType.
unsigned int size() const
Returns number of nodes to be found in the network.
bool linkNodes(NodeID outerNodeID, NodeID innerNodeID)
takes two entry IDs and weaves them into the network
bool addNode(NodeID nodeID, EntryType &newEntry)
************************* PUBLIC MEMBER FUNCTIONS *************************
This class assigns a common family identifier to all CACells in the network that are connected.