98 template<
class CONF>
struct Maybe;
107 typedef Yes_t is_defined;
109 enum{ CODE = 20 + Fl };
115 #define PRINT_DELIMITER(TITLE) \ 116 cout << "__________________________\n" \ 117 "__________________________ " \ 118 << STRINGIFY(TITLE) << "\n"; 135 virtual void run(Arg)
139 check_instantiation ();
142 check_ConfigSelector ();
146 void check_testdata ()
161 PRINT_DELIMITER (check_flags());
168 Flags1::Flags flags1 = Flags2::Tuple();
169 Flags2::Tuple flags2 = flags1;
170 CHECK (1==
sizeof(flags1));
171 CHECK (1==
sizeof(flags2));
174 DISPLAY (SimpleConfig_defined_by_Typelist);
176 typedef DefineConfigByFlags<AllFlags>::Config AnotherConfig_defined_by_Typelist;
177 DISPLAY (AnotherConfig_defined_by_Typelist);
186 #define CAN_INSTANTIATE(NAME) \ 190 << Instantiation<Maybe>::Test<NAME>::value << "\n"; 192 PRINT_DELIMITER (check_instantiation());
194 CAN_INSTANTIATE (Conf0);
195 CAN_INSTANTIATE (Conf1);
196 CAN_INSTANTIATE (Conf2);
197 CAN_INSTANTIATE (Conf3);
198 CAN_INSTANTIATE (Conf4);
201 CAN_INSTANTIATE (Trash);
210 PRINT_DELIMITER (check_filter());
212 DISPLAY (SomeFlagsets);
214 typedef Apply<SomeFlagsets::List, DefineConfigByFlags> Configs_defined_by_Flagsets;
215 DISPLAY (Configs_defined_by_Flagsets);
218 DISPLAY (Filter_possible_Configs);
221 DISPLAY (AllFlagCombinations);
222 typedef Apply<AllFlagCombinations::List, DefineConfigByFlags> ListAllConfigs;
223 DISPLAY (ListAllConfigs);
226 DISPLAY (Filter_all_possible_Configs);
235 TestVisitor() : result (
"TestVisitor application:\n") {}
240 Ret done() {
return result; }
246 result += string (
_Fmt (
"visit(code=%u) -->%s\n")
247 % code % Printer<CONF>::print() );
257 PRINT_DELIMITER (check_FlagInfo());
263 typedef Apply<SomeFlagsets::List, DefineConfigByFlags> SomeConfigs;
264 DISPLAY (SomeConfigs);
268 cout << FlagInfo<SomeConfigs::List>::accept (visitor);
275 uint operator() () {
return offset_ + Maybe<CONF>::CODE; }
289 PRINT_DELIMITER (check_ConfigSelector());
291 typedef Apply<AllFlagCombinations::List, DefineConfigByFlags> ListAllConfigs;
293 DISPLAY (Possible_Configs);
299 > TestFactorySelector;
301 const long offset = 1000;
302 TestFactorySelector testConfigSelector (Possible_Configs::List(), offset);
305 #define INVOKE_CONFIG_SELECTOR(CODE) \ 306 cout << " Flag-code = " << CODE \ 307 << " ConfigSelector() ---> " \ 308 << testConfigSelector[CODE] () << "\n"; 310 INVOKE_CONFIG_SELECTOR (2);
311 INVOKE_CONFIG_SELECTOR (12);
312 INVOKE_CONFIG_SELECTOR (20);
313 INVOKE_CONFIG_SELECTOR (4);
314 INVOKE_CONFIG_SELECTOR (8);
318 INVOKE_CONFIG_SELECTOR (23);
323 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.
Simple 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...