29 #include <boost/lexical_cast.hpp> 31 using boost::lexical_cast;
41 using LERR_(LIFECYCLE);
53 static void setCountParam (uint c) { Interface::cnt = c; }
55 virtual string identify() {
return "Interface"; }
64 int Interface::cnt = 0;
67 class Impl :
public Interface
70 virtual string identify() {
return "Implementation"; }
95 uint num{firstVal (arg)};
96 cout <<
_Fmt(
"using the Singleton should create TargetObj(%d)...\n") % num;
98 Interface::setCountParam(num);
108 Interface& t1 = instance();
109 Interface& t2 = instance();
111 CHECK (isSameObject (t1, t2),
"not a Singleton, got two different instances." );
113 CHECK (
"Implementation" == t2.identify());
115 cout <<
"calling a non-static method on the Singleton-" 116 << t1.identify() << endl
119 verify_error_detection ();
125 verify_error_detection ()
Dummy target object to be created by factory for unit tests Used to verify sane memory management and...
#define INSTANCEOF(CLASS, EXPR)
shortcut for subclass test, intended for assertions only.
Per type specific configuration of instances created as service dependencies.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
A front-end for using printf-style formatting.
Access point to singletons and other kinds of dependencies designated by type.
Implementation namespace for support and library code.
Target object to be created by Test-Factories or as Singleton.
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
Target object to be instantiated as Singleton Allocates a variable amount of additional heap memory a...
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
A collection of frequently used helper functions to support unit testing.
Singleton services and Dependency Injection.
Helper to abstract creation and lifecycle of a dependency.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities. ...