62 operator string()
const {
return "hey Joe!"; }
80 operator string()
const 82 return _Fmt(
"Nr.%02d(%3.1f)") % id_ % d_;
85 uint AutoCounter::cnt = 0;
115 Reticent closeLipped;
116 UnReticent chatterer;
118 CHECK (
toString (closeLipped) ==
"«Reticent»"_expect);
119 CHECK (
toString (chatterer) ==
"hey Joe!"_expect);
121 CHECK (
toString (&chatterer) ==
"↗hey Joe!"_expect);
122 CHECK (
toString (
nullptr) ==
"↯"_expect);
124 CHECK (
toString (
true) ==
"true"_expect);
125 CHECK (
toString (2+2 == 5) ==
"false"_expect);
126 CHECK (
toString (12.34e55) ==
"1.234e+56"_expect);
131 +
toString (
'8') ==
"12345678"_expect);
146 CHECK (
"1.11" == *ss);
148 CHECK (
"2.11" == *ss);
154 CHECK (res ==
"..2.113.114.115.116.117.118.119.1110.11"_expect);
157 using VecS = vector<string>;
160 VecS vals =
stringify (
short(12), 345L,
"67",
'8');
161 CHECK (vals == VecS({
"12",
"345",
"67",
"8"}));
165 auto nn = snapshot (
eachNum (5, 10));
202 vector<double> dubious;
203 for (uint i=0; i<10; ++i)
204 dubious.push_back(1.1*i);
206 std::function<AutoCounter(double)> justCount = [](
double d){
return AutoCounter(d); };
209 CHECK (
join (dubious,
"--+--")
230 "Nr.10(19.8)"_expect);
238 string abcdef{
"abcdef"};
247 CHECK (
endsWith (abcdef,
"abcdef"));
258 CHECK (not
startsWith (
string{
"abc"},
"abcd"));
262 CHECK (not
endsWith (
string{
"abc"},
" abc"));
263 CHECK (not
endsWith (
string{
"a"},
"ä"));
264 CHECK (not
endsWith (
string{
"ä"},
"a"));
266 string abc{
"abcdef"};
267 removePrefix(abc,
"ab");
268 CHECK (
"cdef" == abc);
269 removeSuffix(abc,
"ef");
273 removePrefix(abc,
"ab");
274 CHECK (
"bcdef" == abc);
275 removeSuffix(abc,
"abcdef");
276 CHECK (
"bcdef" == abc);
277 removeSuffix(abc,
"bcdef");
NumIter< INT > eachNum(INT start, INT end)
convenience function to iterate "each number"
bool startsWith(string const &str, string const &prefix)
check if string starts with a given prefix
iter_stl::IterSnapshot< VAL > snapshot(std::initializer_list< VAL > const &&ili)
Take a snapshot of the given std::initializer_list.
A front-end for using printf-style formatting.
Simple test class runner.
A collection of frequently used helper functions to support unit testing.
_SeqT< CON >::Range eachElm(CON &coll)
Lumiera error handling (C++ interface).
bool endsWith(string const &str, string const &suffix)
check if string ends with the given suffix
Preconfigured adapters for some STL container standard usage situations.
auto transformIterator(IT const &src, FUN processingFunc)
Build a TransformIter: convenience free function shortcut, picking up the involved types automaticall...