1 #include <framework/datastore/SelectSubset.h>
2 #include <framework/datastore/StoreArray.h>
3 #include <framework/datastore/RelationsObject.h>
4 #include <framework/datastore/RelationArray.h>
7 #include <gtest/gtest.h>
14 #include <unordered_map>
23 class SelectSubsetTest :
public ::testing::Test {
27 using KeyElementType = UInt_t;
31 static bool SelectionCriterium(
const KeyElementType a)
35 return (a % 2) != 0 && (a % 3) != 0 && (a % 5) != 0 && (a % 7) != 0 &&
36 (a % 11) != 0 && (a % 13) != 0 && (a % 17) != 0 && (a % 19) != 0 && (a % 23) != 0 &&
37 (a % 29) != 0 && (a % 31) != 0 ;
40 static bool SelectionCriteriumOnElement(
const StoredElement* a)
42 return SelectionCriterium(a->GetUniqueID());
48 using FromTargetElementsToWeight = map< KeyElementType , double >;
61 using FromStringToArrows = unordered_map< string, FromTargetElementsToWeight >;
64 KeyElementType m_fromElement;
65 FromStringToArrows m_allRelations;
70 explicit Relations(
const KeyElementType& from):
75 const FromStringToArrows&
76 getConstSetOfAllRelations()
const
78 return m_allRelations;
81 FromStringToArrows::const_iterator
82 getConstSetOfToRelations(
const string& toSetName)
const
84 return m_allRelations.find(toSetName) ;
88 FromStringToArrows::iterator
89 getSetOfToRelations(
const string& toSetName)
91 return m_allRelations.find(toSetName) ;
94 FromStringToArrows::const_iterator
95 getSetOfToRelations(
const string& toSetName)
const
97 return m_allRelations.find(toSetName) ;
104 cout <<
"From KeyElement " << m_fromElement <<
"to:" << endl;
105 for (
const auto& toSet : m_allRelations) {
106 for (
auto pair : toSet.second)
108 << toSet.first <<
" "
110 <<
" ( " << pair.second <<
" ) " << endl;
112 cout <<
"-----------------------------------------------------------------" << endl;
117 isPresentRelationTo(
const string& toSetName, KeyElementType to)
const
119 auto toRelations = getConstSetOfToRelations(toSetName);
120 if (toRelations == m_allRelations.end())
122 return toRelations->second.find(to) != toRelations->second.end();
126 appendNewRelationTo(
const string& toName, KeyElementType to,
129 auto toRelations = getSetOfToRelations(toName);
130 if (toRelations == m_allRelations.end()) {
132 m_allRelations.insert(pair <string, FromTargetElementsToWeight>
134 FromTargetElementsToWeight({ {to, weight} })));
137 pair< KeyElementType, double > relation(to, weight);
138 toRelations->second.insert(relation);
142 const FromTargetElementsToWeight&
143 getAllRelations(
const string& toOtherSetName)
const
145 static FromTargetElementsToWeight nothing;
146 auto toRelations = getSetOfToRelations(toOtherSetName);
147 if (toRelations == m_allRelations.end()) {
150 return toRelations->second;
156 #if defined(__INTEL_COMPILER)
157 #pragma warning disable 177
170 map< KeyElementType, Relations > m_set;
181 cout <<
"The NamedSet: " << m_name <<
" contains:" << endl ;
182 for (
auto set : m_set) {
183 cout << set.first << endl;
186 cout <<
"~~~~~~~~~~~~~~~~~~~~~~~" << endl;
190 explicit NamedSet(
const string& name =
"") :
191 m_name(name), m_storeArray(name) {}
194 bool operator()(
const NamedSet& a,
const NamedSet& b)
const
196 return a.getName() < b.getName();
200 [[nodiscard]]
const string getName()
const
211 void initializeDatastore()
215 DataStore::Instance().setInitializeActive(
true);
218 array.registerInDataStore();
219 array.registerRelationTo(array);
221 DataStore::Instance().setInitializeActive(
false);
224 void initializeDatastore(
const string& SetName)
230 DataStore::Instance().setInitializeActive(
true);
234 array.registerInDataStore();
235 array.registerRelationTo(otherSet);
236 otherSet.registerRelationTo(array);
239 DataStore::Instance().setInitializeActive(
false);
255 void appendNewElement(KeyElementType element)
257 m_set.insert(pair< KeyElementType, Relations > (element, Relations(element)));
260 void appendNewRelationTo(KeyElementType fromKey,
const string& toName, KeyElementType toKey,
263 auto fromElement = m_set.find(fromKey);
264 if (fromElement == m_set.end()) {
265 cout <<
"??" << endl;
268 fromElement->second.appendNewRelationTo(toName, toKey, weight);
271 [[nodiscard]]
bool isPresentRelationFromTo(
const KeyElementType& fromKey,
const string& otherSetName ,
272 const KeyElementType& toKey)
const
274 auto fromElement = m_set.find(fromKey);
275 if (fromElement != m_set.end()) {
276 return fromElement->second.isPresentRelationTo(otherSetName, toKey);
279 if (i ++ < 999 || (i % 100) == 0) {
280 cout <<
"Error: from: " <<
getName() <<
" id " << fromKey <<
281 " -> " << otherSetName <<
" id " << toKey << endl;
282 for (
const auto& element : m_set)
283 cout << element.first <<
"\t";
285 for (
const auto& element : m_storeArray)
286 cout << element.GetUniqueID() <<
"\t";
288 }
else if (i == 1000) {
289 cout <<
"Skipping 99% of the following errors" << endl;
295 [[nodiscard]]
const FromTargetElementsToWeight& getAllRelations(
const KeyElementType& fromKey,
const string& toOtherSetName)
const
297 auto fromElement = m_set.find(fromKey);
298 return fromElement->second.getAllRelations(toOtherSetName);
301 using StlRelationArray = map< KeyElementType , FromTargetElementsToWeight >;
303 [[nodiscard]] StlRelationArray getRestrictedDomainRelationTo(
const string& toOtherSetName)
const
305 StlRelationArray theInducedRelation;
306 for (
const auto& element : m_set) {
307 if (SelectionCriterium(element.first) &&
308 element.second.getAllRelations(toOtherSetName).size() != 0)
309 theInducedRelation.insert(pair< KeyElementType, FromTargetElementsToWeight>
310 (element.first, element.second.getAllRelations(toOtherSetName)));
312 return theInducedRelation;
315 [[nodiscard]] StlRelationArray getRestrictedCodomainRelationTo(
const string& setName)
const
317 StlRelationArray theInducedRelation;
318 for (
const auto& element : m_set) {
319 if (element.second.getConstSetOfToRelations(setName) ==
320 element.second.getConstSetOfAllRelations().end())
322 for (
auto image : element.second.getConstSetOfToRelations(setName)->second) {
323 if (SelectionCriterium(image.first)) {
324 if (theInducedRelation.find(element.first) == theInducedRelation.end())
325 theInducedRelation.insert(pair< KeyElementType, FromTargetElementsToWeight>
326 (element.first, FromTargetElementsToWeight()));
327 theInducedRelation.find(element.first)->second.
328 insert(FromTargetElementsToWeight::value_type
329 (image.first, image.second));
333 return theInducedRelation;
336 [[nodiscard]] StlRelationArray getRestrictedSelfRelation()
const
338 StlRelationArray theInducedRelation;
339 for (
const auto& element : m_set) {
340 if (! SelectionCriterium(element.first) ||
341 element.second.getAllRelations(m_name).size() == 0)
343 for (
auto image : element.second.getConstSetOfToRelations(m_name)->second) {
344 if (SelectionCriterium(image.first)) {
345 if (theInducedRelation.find(element.first) == theInducedRelation.end())
346 theInducedRelation.insert(pair< KeyElementType, FromTargetElementsToWeight>
347 (element.first, FromTargetElementsToWeight()));
348 theInducedRelation.find(element.first)->second.
349 insert(FromTargetElementsToWeight::value_type
350 (image.first, image.second));
354 return theInducedRelation;
359 class CollectionOfSets {
369 vector< string > m_otherSetsNames;
370 unordered_map< string, NamedSet > m_otherSets;
374 CollectionOfSets(): m_set(
"theSet"),
375 m_subset(
"theSubset"),
376 m_otherSetsNames {string(
"G"), string(
"F"), string(
"E"),
377 string(
"D"), string(
"C"), string(
"B"), string(
"A")
380 m_setName = m_set.getName();
381 m_subsetName = m_subset.getName();
382 for (
const auto& aSetName : m_otherSetsNames)
383 m_otherSets.insert(pair<string, NamedSet> (aSetName, NamedSet(aSetName)));
396 return m_set.storedArray();
407 getSubsetName()
const
409 return m_subsetName ;
415 return m_subset.storedArray();
421 return m_otherSets.size() ;
424 const vector< string >&
425 getOtherSetsNames()
const
427 return m_otherSetsNames ;
431 getOtherSetsNames(
int i)
const
433 return m_otherSetsNames[i] ;
439 auto otherSet = m_otherSets.find(m_otherSetsNames[ i ]);
440 if (otherSet != m_otherSets.end())
441 return otherSet->second.storedArray();
443 cout <<
" ???????????? " << i << endl;
444 return otherSet->second.storedArray();
447 pair< const string, NamedSet>&
448 getOtherNamedSet(
int i)
450 return * m_otherSets.find(m_otherSetsNames[ i ]);
453 unordered_map< string, NamedSet >&
460 initializeDatastore()
464 m_set.initializeDatastore();
466 for (
auto namedSet : m_otherSets)
467 namedSet.second.initializeDatastore(getSetName());
474 unsigned int nElements = 1368;
475 for (
unsigned int i = 0; i < nElements ; i++)
476 appendNewElement(m_set);
480 for (
auto& set : m_otherSets) {
481 unsigned int nOtherElements = nElements - n * 100;
483 for (
unsigned int i = 0; i < nOtherElements ; i++)
484 appendNewElement(set.second);
489 for (
auto& set : m_otherSets) {
492 unsigned int nArrows = nElements * j;
495 for (
unsigned int arrow = 0; arrow < nArrows ; arrow ++) {
496 appendNewRelationToOther(set);
497 appendNewRelationFromOther(set);
503 for (
unsigned int arrow = 0; arrow < 5 * nElements; arrow ++)
504 appendNewSelfRelation();
516 static double counter(0.0);
517 return counter += 1.;
521 flat_random(
unsigned int max)
527 static unsigned int next = 11036;
532 result = (
unsigned int)(next / 65536) % 2048;
537 result ^= (
unsigned int)(next / 65536) % 1024;
542 result ^= (
unsigned int)(next / 65536) % 1024;
549 appendNewElement(NamedSet& namedSet)
553 static int uniqueId(0);
555 namedSet.appendNewElement(uniqueId);
557 set[ i ]->SetUniqueID(uniqueId);
563 appendNewRelationToOther(pair< const string, NamedSet>& set)
566 int from_index = flat_random(getSet().getEntries());
567 KeyElementType from_key = getSet()[from_index]->GetUniqueID();
568 int to_index = flat_random(set.second.storedArray().getEntries());
569 KeyElementType to_key = set.second.storedArray()[to_index]->GetUniqueID();
572 if (getNamedSet().isPresentRelationFromTo(from_key, set.first , to_key))
576 double weight = getWeight();
578 getNamedSet().appendNewRelationTo(from_key, set.first, to_key , weight);
580 RelationArray setToOtherSet(getSet(), set.second.storedArray());
581 setToOtherSet.add(from_index, to_index, weight);
587 appendNewRelationFromOther(pair< const string, NamedSet>& otherSet)
591 unsigned int from_index = flat_random(otherSet.second.storedArray().getEntries());
593 KeyElementType from_key = otherSet.second.storedArray()[from_index]->GetUniqueID();
595 unsigned int to_index = flat_random(getSet().getEntries());
596 KeyElementType to_key = getSet()[to_index]->GetUniqueID();
598 if (otherSet.second.isPresentRelationFromTo(from_key, getSetName(), to_key))
602 double weight = getWeight();
604 otherSet.second.appendNewRelationTo(from_key, getSetName(), to_key , weight);
608 RelationArray otherSetToSet(otherSet.second.storedArray(), getSet());
609 otherSetToSet.add(from_index, to_index, weight);
614 appendNewSelfRelation()
616 unsigned int from_index = flat_random(getSet().getEntries());
617 KeyElementType from_key = getSet()[from_index]->GetUniqueID();
618 unsigned int to_index = flat_random(getSet().getEntries());
619 KeyElementType to_key = getSet()[to_index]->GetUniqueID();
622 if (getNamedSet().isPresentRelationFromTo(from_key, getSetName() , to_key))
625 double weight = getWeight();
627 getNamedSet().appendNewRelationTo(from_key, getSetName(), to_key , weight);
631 setToSet.add(from_index, to_index, weight);
642 CollectionOfSets m_TestBench;
644 void SetUp()
override
649 void TearDown()
override
651 DataStore::Instance().reset();
656 testRelationToOther(pair< const string, NamedSet>& otherSet)
662 otherSet.second.storedArray());
665 NamedSet::StlRelationArray theInducedRelation;
667 for (
int relation = 0 ; relation < subsetToOtherSet.getEntries() ; relation++) {
668 size_t relationSize = subsetToOtherSet[ relation ].getSize();
671 KeyElementType fromElementKey =
subset[from]->GetUniqueID();
672 if (theInducedRelation.find(fromElementKey) == theInducedRelation.end())
673 theInducedRelation.insert(pair< KeyElementType, FromTargetElementsToWeight>
674 (fromElementKey, FromTargetElementsToWeight()));
676 for (
unsigned int to_index = 0 ; to_index < relationSize ; to_index++) {
678 double weight = subsetToOtherSet[ relation ].getWeight(to_index);
679 KeyElementType toElementKey = otherSet.second.storedArray()[to]->GetUniqueID();
681 theInducedRelation.find(fromElementKey)->second.insert(pair< KeyElementType, double> (toElementKey , weight));
687 NamedSet::StlRelationArray theExpectedRelation = m_TestBench.getNamedSet().
688 getRestrictedDomainRelationTo(otherSet.first) ;
690 bool OKorKO =
equal(theExpectedRelation.begin(), theExpectedRelation.end(), theInducedRelation.begin(),
691 [](
const NamedSet::StlRelationArray::value_type & a,
692 const NamedSet::StlRelationArray::value_type & b) {
694 cout << a.first <<
" vs " << b.first << endl;
696 return a.first == b.first &&
697 equal(a.second.begin(), a.second.end(), b.second.begin(),
698 [](const FromTargetElementsToWeight::value_type & x,
699 const FromTargetElementsToWeight::value_type & y) {
702 << x.first <<
"," << x.second
704 << y.first <<
"," << y.second <<
"\t";
705 cout << (x.first == y.first) <<
" , " << (x.second == y.second) << endl;
707 return x.first == y.first && x.second == y.second;
713 for (
auto relation : theExpectedRelation)
714 for (
auto to : relation.second)
715 cout << relation.first <<
" -> " << to.first <<
" ( " << to.second <<
" )" << endl;
717 for (
auto relation : theInducedRelation)
718 for (
auto to : relation.second)
719 cout << relation.first <<
" --> " << to.first <<
" ( " << to.second <<
" )" << endl;
727 testRelationFromOther(pair< const string, NamedSet>& otherNamedSet)
734 RelationArray subsetFromOtherSet(otherNamedSet.second.storedArray(), subset);
737 NamedSet::StlRelationArray theInducedRelation;
739 for (
int relation = 0 ; relation < subsetFromOtherSet.getEntries() ; relation++) {
740 size_t relationSize = subsetFromOtherSet[ relation ].getSize();
742 KeyElementType fromElementKey = other[from]->GetUniqueID();
743 if (theInducedRelation.find(fromElementKey) == theInducedRelation.end()) {
744 theInducedRelation.insert(pair< KeyElementType, FromTargetElementsToWeight>
745 (fromElementKey, FromTargetElementsToWeight()));
748 for (
unsigned int to_index = 0 ; to_index < relationSize ; to_index++) {
750 subsetFromOtherSet[ relation ].getToIndex(to_index);
751 double weight = subsetFromOtherSet[ relation ].getWeight(to_index);
752 KeyElementType toElementKey =
subset[to]->GetUniqueID();
754 theInducedRelation.find(fromElementKey)->second.insert(pair< KeyElementType, double> (toElementKey , weight));
760 NamedSet::StlRelationArray theExpectedRelation
761 = otherNamedSet.second.getRestrictedCodomainRelationTo(m_TestBench.getSetName());
762 bool OKorKO =
equal(theExpectedRelation.begin(), theExpectedRelation.end(), theInducedRelation.begin(),
763 [](
const NamedSet::StlRelationArray::value_type & a,
764 const NamedSet::StlRelationArray::value_type & b) {
766 cout << a.first <<
" vs " << b.first << endl;
768 return a.first == b.first &&
769 equal(a.second.begin(), a.second.end(), b.second.begin(),
770 [](const FromTargetElementsToWeight::value_type & x,
771 const FromTargetElementsToWeight::value_type & y) {
774 << x.first <<
"," << x.second
776 << y.first <<
"," << y.second <<
"\t";
777 cout << (x.first == y.first) <<
" , " << (x.second == y.second) << endl;
779 return x.first == y.first && x.second == y.second;
785 for (
auto relation : theExpectedRelation)
786 for (
auto to : relation.second)
787 cout << relation.first <<
" -> " << to.first <<
" ( " << to.second <<
" )" << endl;
789 for (
auto relation : theInducedRelation)
790 for (
auto to : relation.second)
791 cout << relation.first <<
" --> " << to.first <<
" ( " << to.second <<
" )" << endl;
807 NamedSet::StlRelationArray theInducedRelation;
809 for (
int relation = 0 ; relation < selfRelation.getEntries() ; relation++) {
810 size_t relationSize = selfRelation[ relation ].getSize();
812 KeyElementType fromElementKey =
subset[from]->GetUniqueID();
813 if (theInducedRelation.find(fromElementKey) == theInducedRelation.end()) {
814 theInducedRelation.insert(pair< KeyElementType, FromTargetElementsToWeight>
815 (fromElementKey, FromTargetElementsToWeight()));
818 for (
unsigned int to_index = 0 ; to_index < relationSize ; to_index++) {
820 selfRelation[ relation ].getToIndex(to_index);
821 double weight = selfRelation[ relation ].getWeight(to_index);
822 KeyElementType toElementKey =
subset[to]->GetUniqueID();
824 theInducedRelation.find(fromElementKey)->second.insert(pair< KeyElementType, double> (toElementKey , weight));
830 NamedSet::StlRelationArray theExpectedRelation = m_TestBench.getNamedSet().
831 getRestrictedSelfRelation();
833 bool OKorKO =
equal(theExpectedRelation.begin(), theExpectedRelation.end(), theInducedRelation.begin(),
834 [](
const NamedSet::StlRelationArray::value_type & a,
835 const NamedSet::StlRelationArray::value_type & b) {
838 cout << a.first <<
" vs " << b.first << endl;
840 return (true || a.first == b.first) &&
841 equal(a.second.begin(), a.second.end(), b.second.begin(),
842 [](const FromTargetElementsToWeight::value_type & x,
843 const FromTargetElementsToWeight::value_type & y) {
846 << x.first <<
"," << x.second
848 << y.first <<
"," << y.second <<
"\t";
849 cout << (x.first == y.first) <<
" , " << (x.second == y.second) << endl;
851 return x.first == y.first && x.second == y.second;
858 cout <<
"We do expect the following set of relations" << endl;
859 for (
auto relation : theExpectedRelation)
860 for (
auto to : relation.second)
861 cout << relation.first <<
" -> " << to.first <<
" ( " << to.second <<
" )" << endl;
863 cout <<
"We found the following ones" << endl;
864 for (
auto relation : theInducedRelation)
865 for (
auto to : relation.second)
866 cout << relation.first <<
" --> " << to.first <<
" ( " << to.second <<
" )" << endl;
879 TEST_F(SelectSubsetTest, ExtensiveTest)
881 m_TestBench.initializeDatastore();
882 m_TestBench.populateDatastore();
887 DataStore::Instance().setInitializeActive(
true);
889 selector.registerSubset(set, m_TestBench.getSubsetName());
891 for (
auto other : m_TestBench.getOtherSets()) {
892 selector.inheritRelationsTo(other.second.storedArray());
893 selector.inheritRelationsFrom(other.second.storedArray());
897 selector.inheritRelationsFrom(set);
899 DataStore::Instance().setInitializeActive(
false);
901 selector.select(SelectionCriteriumOnElement);
905 bool allSubsetElementsAreGood(
true);
910 for (
const auto& element : subset) {
911 if (! SelectionCriteriumOnElement(& element))
912 allSubsetElementsAreGood =
false;
917 EXPECT_TRUE(allSubsetElementsAreGood);
923 for (
const auto& element : set)
924 NSelected += SelectionCriteriumOnElement(&element) ? 1 : 0;
926 EXPECT_TRUE(NSelected ==
subset.getEntries());
930 EXPECT_TRUE(testSelfRelation());
932 for (
int i = 0 ; i < m_TestBench.getNSets(); i++) {
934 auto otherSet = m_TestBench.getOtherNamedSet(i);
935 EXPECT_TRUE(testRelationToOther(otherSet));
936 EXPECT_TRUE(testRelationFromOther(otherSet));
943 return (a->getArrayIndex() % 2) == 1;
946 TEST_F(SelectSubsetTest, TestWithManyRelations)
951 DataStore::Instance().setInitializeActive(
true);
955 arrayMain.registerInDataStore();
956 arrayA.registerInDataStore();
957 arrayB.registerInDataStore();
958 arrayA.registerRelationTo(arrayMain);
959 arrayMain.registerRelationTo(arrayB);
968 DataStore::Instance().setInitializeActive(
false);
971 for (
int i = 0; i < 10; i++) {
972 auto* mainObj = arrayMain.appendNew();
973 for (
int j = 0; j < 2; j++) {
974 auto* aObj = arrayA.appendNew();
975 aObj->addRelationTo(mainObj);
977 for (
int j = 0; j < 10; j++) {
978 auto* bObj = arrayB.appendNew();
979 mainObj->addRelationTo(bObj);
984 selectorMain.
select(hasOddIndex);
988 EXPECT_EQ(10, arrayMain.getEntries());
989 EXPECT_EQ(20, arrayA.getEntries());
990 EXPECT_EQ(100, arrayB.getEntries());
996 EXPECT_EQ(5, arraySubset.getEntries());
1007 EXPECT_TRUE(hasOddIndex(originalObject));
1011 TEST_F(SelectSubsetTest, InheritAll)
1016 DataStore::Instance().setInitializeActive(
true);
1020 arrayMain.registerInDataStore();
1021 arrayA.registerInDataStore();
1022 arrayB.registerInDataStore();
1023 arrayA.registerRelationTo(arrayMain);
1024 arrayMain.registerRelationTo(arrayB);
1032 DataStore::Instance().setInitializeActive(
false);
1040 TEST_F(SelectSubsetTest, TestExistingSetWithManyRelations)
1045 DataStore::Instance().setInitializeActive(
true);
1049 arrayMain.registerInDataStore();
1050 arrayA.registerInDataStore();
1051 arrayB.registerInDataStore();
1052 arrayA.registerRelationTo(arrayMain);
1053 arrayMain.registerRelationTo(arrayB);
1059 DataStore::Instance().setInitializeActive(
false);
1062 for (
int i = 0; i < 10; i++) {
1063 auto* mainObj = arrayMain.appendNew();
1064 for (
int j = 0; j < 2; j++) {
1065 auto* aObj = arrayA.appendNew();
1066 aObj->addRelationTo(mainObj);
1068 for (
int j = 0; j < 10; j++) {
1069 auto* bObj = arrayB.appendNew();
1070 mainObj->addRelationTo(bObj);
1075 EXPECT_EQ(10, arrayMain.getEntries());
1076 EXPECT_EQ(20, arrayA.getEntries());
1077 EXPECT_EQ(100, arrayB.getEntries());
1080 selectorMain.
select(hasOddIndex);
1084 EXPECT_EQ(5, arrayMain.getEntries());
1094 EXPECT_EQ((i / 2 % 2 == 1) ? 1u : 0u, r.getRelationsTo<
RelationsObject>(
"main").size());
1099 TEST_F(SelectSubsetTest, TestEmptyArray)
1104 DataStore::Instance().setInitializeActive(
true);
1108 arrayMain.registerInDataStore();
1109 arrayA.registerInDataStore();
1110 arrayB.registerInDataStore();
1111 arrayA.registerRelationTo(arrayMain);
1112 arrayMain.registerRelationTo(arrayB);
1118 DataStore::Instance().setInitializeActive(
false);
1121 EXPECT_EQ(0, arrayMain.getEntries());
1122 selectorMain.
select(hasOddIndex);
1123 EXPECT_EQ(0, arrayMain.getEntries());
1126 for (
int i = 0; i < 10; i++) {
1127 auto* mainObj = arrayMain.appendNew();
1128 for (
int j = 0; j < 2; j++) {
1129 auto* aObj = arrayA.appendNew();
1130 aObj->addRelationTo(mainObj);
1132 for (
int j = 0; j < 10; j++) {
1133 auto* bObj = arrayB.appendNew();
1134 mainObj->addRelationTo(bObj);
1139 EXPECT_EQ(10, arrayMain.getEntries());
1140 EXPECT_EQ(20, arrayA.getEntries());
1141 EXPECT_EQ(100, arrayB.getEntries());
1145 selectorMain.
select(never);
1149 EXPECT_EQ(0, arrayMain.getEntries());