38 #include <boost/lexical_cast.hpp> 40 using boost::lexical_cast;
50 using LERR_(LIFECYCLE);
62 static void setCountParam (uint c) { Interface::cnt = c; }
64 virtual string identify() {
return "Interface"; }
73 int Interface::cnt = 0;
76 class Impl :
public Interface
79 virtual string identify() {
return "Implementation"; }
104 uint num= isnil(arg)? 1 : lexical_cast<uint>(arg[1]);
106 cout <<
_Fmt(
"using the Singleton should create TargetObj(%d)...\n") % num;
108 Interface::setCountParam(num);
118 Interface& t1 = instance();
119 Interface& t2 = instance();
121 CHECK (isSameObject (t1, t2),
"not a Singleton, got two different instances." );
123 CHECK (
"Implementation" == t2.identify());
125 cout <<
"calling a non-static method on the Singleton-" 126 << t1.identify() << endl
129 verify_error_detection ();
135 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...
Simple 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, bypassing any custom comparison operators.