25 const string myname =
"test_TpcData: ";
27 cout << myname <<
"NDEBUG must be off." <<
endl;
30 string line = myname +
"-----------------------------";
32 cout << myname <<
"Checking empty data." <<
endl;
39 cout << myname <<
"Add sub1" <<
endl;
41 assert( pdat1 !=
nullptr );
46 assert( pdat->getTpcData(
"sub1") == pdat1 );
47 assert( pdat->getParent() == nullptr );
49 assert( pdat1c->getParent() == &tpd );
51 cout << myname <<
"Add sub11" <<
endl;
52 assert( tpd.
getTpcData(
"sub1/sub11") == nullptr );
54 assert( pdat11 !=
nullptr );
56 assert( tpd.
addTpcData(
"sub1/sub11") == nullptr );
58 assert( tpd.
getTpcData(
"sub1/sub11") == pdat11 );
59 assert( pdat11->getParent() == pdat1 );
60 const TpcData* pdat11c = pdat11;
61 assert( pdat11c->getParent() == pdat1 );
63 cout << myname <<
"Add sub12" <<
endl;
64 assert( tpd.
getTpcData(
"sub1/sub12") == nullptr );
66 assert( pdat12 !=
nullptr );
67 assert( pdat12 != pdat11 );
69 assert( tpd.
addTpcData(
"sub1/sub12") == nullptr );
71 assert( tpd.
getTpcData(
"sub1/sub12") == pdat12 );
72 assert( pdat12->getParent() == pdat1 );
73 const TpcData* pdat12c = pdat12;
74 assert( pdat12c->getParent() == pdat1 );
77 cout << myname <<
"Add ADC data." <<
endl;
80 assert( pdat11->getAdcData().size() == 0 );
87 assert( pacm1 != pacm0 );
91 assert( pdat11->getAdcData().size() == 0 );
92 assert( pdat1c->getAdcData().size() == 0 );
93 assert( pdat11c->getAdcData().size() == 0 );
96 cout << myname <<
"Check TPC data retrieval." <<
endl;
101 assert(tpd.
getTpcData(
"sub1/sub13") == nullptr );
102 assert(tpd.
getTpcData(
"sub1/sub11") == pdat11 );
103 assert(tpd.
getTpcData(
"sub1/sub12") == pdat12 );
105 cout << myname <<
"...sub1" <<
endl;
107 assert( dats1.size() == 1 );
108 assert( dats1[0] == pdat1 );
109 cout << myname <<
"...sub1" <<
endl;
111 assert( tpd.
getTpcData(
"sub1/sub11", dats11) == 0 );
112 assert( dats11.size() == 1 );
113 assert( dats11[0] == pdat11 );
114 cout << myname <<
"...sub1/sub12" <<
endl;
116 assert( tpd.
getTpcData(
"sub1/sub12", dats12) == 0 );
117 assert( dats12.size() == 1 );
118 assert( dats12[0] == pdat12 );
119 cout << myname <<
"...sub1/*" <<
endl;
121 assert( tpd.
getTpcData(
"sub1/*", dats1x) == 0 );
122 assert( dats1x.size() == 2 );
123 assert( dats1x[0] == pdat11 );
124 assert( dats1x[1] == pdat12 );
126 cout << line <<
endl;
127 cout << myname <<
"Print object." <<
endl;
130 cout << line <<
endl;
131 cout << myname <<
"All tests passed." <<
endl;
std::ostream & print(Name prefix, Index depth=10) const
std::shared_ptr< AdcChannelDataMap > AdcDataPtr
TpcData * addTpcData(Name nam, bool copyAdcData=true)
std::vector< TpcData * > TpcDataVector
AdcDataVector & getAdcData()
TpcData * getTpcData(Name nam)
void line(double t, double *p, double &x, double &y, double &z)
AdcDataPtr createAdcData(bool updateParent=true)
QTextStream & endl(QTextStream &s)