53 operator string()
const {
return "hey Joe!"; }
71 operator string()
const 73 return _Fmt(
"Nr.%02d(%3.1f)") % id_ % d_;
76 uint AutoCounter::cnt = 0;
106 Reticent closeLipped;
107 UnReticent chatterer;
109 CHECK (
toString (closeLipped) ==
"«Reticent»"_expect);
110 CHECK (
toString (chatterer) ==
"hey Joe!"_expect);
112 CHECK (
toString (&chatterer) ==
"↗hey Joe!"_expect);
113 CHECK (
toString (
nullptr) ==
"↯"_expect);
115 CHECK (
toString (
true) ==
"true"_expect);
116 CHECK (
toString (2+2 == 5) ==
"false"_expect);
117 CHECK (
toString (12.34e55) ==
"1.234e+56"_expect);
122 +
toString (
'8') ==
"12345678"_expect);
137 CHECK (
"1.11" == *ss);
139 CHECK (
"2.11" == *ss);
145 CHECK (res ==
"..2.113.114.115.116.117.118.119.1110.11"_expect);
148 using VecS = vector<string>;
151 VecS vals =
stringify (
short(12), 345L,
"67",
'8');
152 CHECK (vals == VecS({
"12",
"345",
"67",
"8"}));
156 auto nn = snapshot (
eachNum (5, 10));
193 vector<double> dubious;
194 for (uint i=0; i<10; ++i)
195 dubious.push_back(1.1*i);
197 std::function<AutoCounter(double)> justCount = [](
double d){
return AutoCounter(d); };
200 CHECK (
join (dubious,
"--+--")
221 "Nr.10(19.8)"_expect);
229 string abcdef{
"abcdef"};
238 CHECK (
endsWith (abcdef,
"abcdef"));
249 CHECK (not
startsWith (
string{
"abc"},
"abcd"));
253 CHECK (not
endsWith (
string{
"abc"},
" abc"));
254 CHECK (not
endsWith (
string{
"a"},
"ä"));
255 CHECK (not
endsWith (
string{
"ä"},
"a"));
257 string abc{
"abcdef"};
258 removePrefix(abc,
"ab");
259 CHECK (
"cdef" == abc);
260 removeSuffix(abc,
"ef");
264 removePrefix(abc,
"ab");
265 CHECK (
"bcdef" == abc);
266 removeSuffix(abc,
"abcdef");
267 CHECK (
"bcdef" == abc);
268 removeSuffix(abc,
"bcdef");
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.
Simplistic 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...
NumIter< INT > eachNum(INT start=std::numeric_limits< INT >::min(), INT end=std::numeric_limits< INT >::max())
convenience function to iterate "each number"