Belle II Software development
NodeFamilyTests Namespace Reference

These tests cover the functionality of the classes: DirectedNode, DirectedNodeNetwork. More...

Functions

 TEST (NodeFamilyDefinerTest, TestNodeFamiliesUsingDirectedNodeNetworkInt)
 Unit test for NodeFamilyDefiner.
 

Detailed Description

These tests cover the functionality of the classes: DirectedNode, DirectedNodeNetwork.

TODO

Function Documentation

◆ TEST()

TEST ( NodeFamilyDefinerTest  ,
TestNodeFamiliesUsingDirectedNodeNetworkInt   
)

Unit test for NodeFamilyDefiner.

< A array of integers for test

< these entries are independent of the first intArray-entries

< entry 2 crosses intArray, entry 3 crosses intArray2

< another array for tests

Definition at line 33 of file NodeFamilyDefiner.cc.

34 {
35 // just some input for testing (same as in DirectedNodeNetwork-tests):
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 // filling network:
45 for (unsigned int index = 1 ; index < 5; index++) {
46 // correct order: outerEntry, innerEntry:
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 // filling network - end.
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 *************************
The Node-Class.
Definition: DirectedNode.h:31
This class assigns a common family identifier to all CACells in the network that are connected.