89 template<
class CONF>
struct Maybe;
92 template<>
struct Maybe<Conf1> :
Indeed {
enum{ CODE = 10 }; };
93 template<>
struct Maybe<Conf3> :
Indeed {
enum{ CODE = 30 }; };
98 typedef Yes_t is_defined;
100 enum{ CODE = 20 + Fl };
106 #define PRINT_DELIMITER(TITLE) \ 107 cout << "__________________________\n" \ 108 "__________________________ " \ 109 << STRINGIFY(TITLE) << "\n"; 126 virtual void run(Arg)
130 check_instantiation ();
133 check_ConfigSelector ();
137 void check_testdata ()
152 PRINT_DELIMITER (check_flags());
159 Flags1::Flags flags1 = Flags2::Tuple();
160 Flags2::Tuple flags2 = flags1;
161 CHECK (1==
sizeof(flags1));
162 CHECK (1==
sizeof(flags2));
165 DISPLAY (SimpleConfig_defined_by_Typelist);
167 typedef DefineConfigByFlags<AllFlags>::Config AnotherConfig_defined_by_Typelist;
168 DISPLAY (AnotherConfig_defined_by_Typelist);
177 #define CAN_INSTANTIATE(NAME) \ 181 << Instantiation<Maybe>::Test<NAME>::value << "\n"; 183 PRINT_DELIMITER (check_instantiation());
185 CAN_INSTANTIATE (Conf0);
186 CAN_INSTANTIATE (Conf1);
187 CAN_INSTANTIATE (Conf2);
188 CAN_INSTANTIATE (Conf3);
189 CAN_INSTANTIATE (Conf4);
192 CAN_INSTANTIATE (Trash);
201 PRINT_DELIMITER (check_filter());
203 DISPLAY (SomeFlagsets);
205 typedef Apply<SomeFlagsets::List, DefineConfigByFlags> Configs_defined_by_Flagsets;
206 DISPLAY (Configs_defined_by_Flagsets);
209 DISPLAY (Filter_possible_Configs);
212 DISPLAY (AllFlagCombinations);
213 typedef Apply<AllFlagCombinations::List, DefineConfigByFlags> ListAllConfigs;
214 DISPLAY (ListAllConfigs);
217 DISPLAY (Filter_all_possible_Configs);
226 TestVisitor() : result (
"TestVisitor application:\n") {}
231 Ret done() {
return result; }
237 result += string (
_Fmt (
"visit(code=%u) -->%s\n")
238 % code % Printer<CONF>::print() );
248 PRINT_DELIMITER (check_FlagInfo());
254 typedef Apply<SomeFlagsets::List, DefineConfigByFlags> SomeConfigs;
255 DISPLAY (SomeConfigs);
259 cout << FlagInfo<SomeConfigs::List>::accept (visitor);
266 uint operator() () {
return offset_ + Maybe<CONF>::CODE; }
280 PRINT_DELIMITER (check_ConfigSelector());
282 typedef Apply<AllFlagCombinations::List, DefineConfigByFlags> ListAllConfigs;
284 DISPLAY (Possible_Configs);
290 > TestFactorySelector;
292 const long offset = 1000;
293 TestFactorySelector testConfigSelector (Possible_Configs::List(), offset);
296 #define INVOKE_CONFIG_SELECTOR(CODE) \ 297 cout << " Flag-code = " << CODE \ 298 << " ConfigSelector() ---> " \ 299 << testConfigSelector[CODE] () << "\n"; 301 INVOKE_CONFIG_SELECTOR (2);
302 INVOKE_CONFIG_SELECTOR (12);
303 INVOKE_CONFIG_SELECTOR (20);
304 INVOKE_CONFIG_SELECTOR (4);
305 INVOKE_CONFIG_SELECTOR (8);
309 INVOKE_CONFIG_SELECTOR (23);
314 cout << err.what() <<
"\n";
Helper template for semi-automatic detection if instantiation is possible.
factory::MultiFact< Num(int), prodID, factory::BuildRefcountPtr > TestFactory
the factory instantiation used for this test
Under some circumstances it is necessary to assemble functionality out of elementary building blocks...
Helpers for working with lib::meta::Types (i.e.
A front-end for using printf-style formatting.
Implementation namespace for support and library code.
Derived specific exceptions within Lumiera's exception hierarchy.
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
lumiera_err lumiera_error(void)
Get and clear current error state.
Helper for fabricating ProcNode Wiring configurations.
Support for writing metaprogramming unit-tests dealing with typelists and flags.
Metaprogramming: Helpers for manipulating lists-of-types.
Sometimes we need to choose a different implementation for dealing with some special cases...