36 #include <boost/lexical_cast.hpp> 45 using boost::lexical_cast;
53 #define TEST_ITER(_CTOR_, _ARG_) \ 54 cout << STRINGIFY(_CTOR_) ;\ 55 pullOut (_CTOR_ _ARG_) ;\ 59 #define PRINT_FUNC(_F_NAME_, _F_TYPE_) \ 60 cout << "-----"<<STRINGIFY(_F_NAME_)<<"---" << util::typeStr<_F_TYPE_>() << endl; 97 if (0 < arg.size()) NUM_ELMS = lexical_cast<uint> (arg[1]);
99 checkDistinctValIter();
101 iterateMapKeyVal (getTestMap_int<MapII> (NUM_ELMS));
102 iterateMapKeyVal (getTestMap_int<HMapII> (NUM_ELMS));
104 iterateMapKeyVal (getTestMultiMap_int<MMapII> (NUM_ELMS));
105 iterateMapKeyVal (getTestMultiMap_int<HMMapII> (NUM_ELMS));
107 iterateValues4Key (getTestMultiMap_int<MMapII> (NUM_ELMS));
108 iterateValues4Key (getTestMultiMap_int<HMMapII> (NUM_ELMS));
110 checkIteratorSnapshot();
116 iterateMapKeyVal (MAP
const& map)
121 TEST_ITER (iter::eachKey, (map.begin(), map.end()));
123 TEST_ITER (iter::eachVal, (map.begin(), map.end()));
124 TEST_ITER (iter::eachDistinctKey, (map));
130 iterateValues4Key (MMAP
const& mumap)
134 TEST_ITER (iter::eachValForKey, (mumap, 0));
137 CHECK (! iter::eachValForKey (mumap, NUM_ELMS));
142 checkDistinctValIter()
170 checkIteratorSnapshot()
172 typedef VecI::iterator Iter;
176 VecI vec = getTestSeq_int<VecI> (NUM_ELMS);
177 Snapshot capture1 (vec.begin(), vec.end());
179 Range range_of_all (vec.begin(), vec.end());
180 Snapshot capture2 = iter::snapshot(range_of_all);
181 CHECK (range_of_all);
184 CHECK (vec.begin() == range_of_all.getPos());
185 CHECK (vec.end() == range_of_all.getEnd());
186 CHECK (!isnil (vec));
191 CHECK (vec.end() != range_of_all.getEnd());
195 CHECK (capture1 == capture2);
199 Snapshot capture3 (vec.begin(), vec.end());
201 CHECK (capture3 != capture1);
202 CHECK (capture3 != capture2);
205 uint sum_should_be = (NUM_ELMS-1)*NUM_ELMS/2;
207 CHECK (sum_should_be == sumAll (capture1));
211 CHECK (capture1 != capture2);
213 CHECK (sum_should_be == sumAll (capture2));
217 CHECK (capture1 == capture2);
219 CHECK (22+44 == sumAll (capture3));
223 CHECK (capture1 == capture2);
224 CHECK (capture3 == capture1);
225 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.
Simple 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.