27 #include <boost/lexical_cast.hpp> 36 using boost::lexical_cast;
44 #define TEST_ITER(_CTOR_, _ARG_) \ 45 cout << STRINGIFY(_CTOR_) ;\ 46 pullOut (_CTOR_ _ARG_) ;\ 50 #define PRINT_FUNC(_F_NAME_, _F_TYPE_) \ 51 cout << "-----"<<STRINGIFY(_F_NAME_)<<"---" << util::typeStr<_F_TYPE_>() << endl; 84 NUM_ELMS = firstVal (arg, 10);
86 checkDistinctValIter();
88 iterateMapKeyVal (getTestMap_int<MapII> (NUM_ELMS));
89 iterateMapKeyVal (getTestMap_int<HMapII> (NUM_ELMS));
91 iterateMapKeyVal (getTestMultiMap_int<MMapII> (NUM_ELMS));
92 iterateMapKeyVal (getTestMultiMap_int<HMMapII> (NUM_ELMS));
94 iterateValues4Key (getTestMultiMap_int<MMapII> (NUM_ELMS));
95 iterateValues4Key (getTestMultiMap_int<HMMapII> (NUM_ELMS));
97 checkIteratorSnapshot();
103 iterateMapKeyVal (MAP
const& map)
108 TEST_ITER (iter::eachKey, (map.begin(), map.end()));
110 TEST_ITER (iter::eachVal, (map.begin(), map.end()));
111 TEST_ITER (iter::eachDistinctKey, (map));
117 iterateValues4Key (MMAP
const& mumap)
121 TEST_ITER (iter::eachValForKey, (mumap, 0));
124 CHECK (! iter::eachValForKey (mumap, NUM_ELMS));
129 checkDistinctValIter()
157 checkIteratorSnapshot()
159 typedef VecI::iterator Iter;
163 VecI vec = getTestSeq_int<VecI> (NUM_ELMS);
164 Snapshot capture1 (vec.begin(), vec.end());
166 Range range_of_all (vec.begin(), vec.end());
167 Snapshot capture2 = iter::snapshot(range_of_all);
168 CHECK (range_of_all);
171 CHECK (vec.begin() == range_of_all.getPos());
172 CHECK (vec.end() == range_of_all.getEnd());
173 CHECK (!isnil (vec));
178 CHECK (vec.end() != range_of_all.getEnd());
182 CHECK (capture1 == capture2);
186 Snapshot capture3 (vec.begin(), vec.end());
188 CHECK (capture3 != capture1);
189 CHECK (capture3 != capture2);
192 uint sum_should_be = (NUM_ELMS-1)*NUM_ELMS/2;
194 CHECK (sum_should_be == sumAll (capture1));
198 CHECK (capture1 != capture2);
200 CHECK (sum_should_be == sumAll (capture2));
204 CHECK (capture1 == capture2);
206 CHECK (22+44 == sumAll (capture3));
210 CHECK (capture1 == capture2);
211 CHECK (capture3 == capture1);
212 CHECK (capture3 == capture2);
bool filter(Placement< DummyMO > const &candidate)
a filter predicate to pick some objects from a resultset.
#define PRINT_FUNC(_F_NAME_, _F_TYPE_)
print descriptive separator to STDOUT
Implementation namespace for support and library code.
Simplistic test class runner.
some bits of unit test helper code to fabricate collections with test data
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
#define TEST_ITER(_CTOR_, _ARG_)
test an iterator: create it by calling a constructor function and then pull out all contents and prin...
Accessing a STL element range through a Lumiera forward iterator, An instance of this iterator adapte...
materialised iterator contents.
Preconfigured adapters for some STL container standard usage situations.