]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
implemented STUB_RETVAL_NOP
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 8 Aug 2012 12:14:34 +0000 (14:14 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 8 Aug 2012 12:14:34 +0000 (14:14 +0200)
Converted stub_tools to stup API.

src/tests/STUB.h
src/tests/stub_tools.cc

index 67c433b9c707df1aa477906de86764332fd75d69..368bdb5db24e613406f72bd494464b57dba54e58 100644 (file)
 /// Intended for registration pattern APIs where the function result does not matter to the test
 #define STUB_NOP { std::cerr<<"SKIP: "<<STUB_API<<" "<<__FUNCTION__<<" (not implemented).\n"; }
 
-/** macro to stub a function with return value.
- *  Aborts unit tests requiring its definition with a message about the missing linkage
- */
+/// macro to stub a function with return value.
+/// Aborts unit tests requiring its definition with a message about the missing linkage
 #define STUB_RETVAL(x) { stub_fatal(STUB_API " required"); return x; }
 
+/// macro to stub a void function without a fatal message and with a return value
+/// Intended for registration pattern APIs where the function result does not matter to the test
+#define STUB_RETVAL_NOP(x) { std::cerr<<"SKIP: "<<STUB_API<<" "<<__FUNCTION__<<" (not implemented).\n"; return x; }
+
+
 /** macro to stub a function which returns a reference to dynamic
  *  Aborts unit tests requiring its definition with a message about the missing linkage
  *  This macro uses 'new x' to construct a stack vailable for the reference, may leak.
index 422c95b2bd9aab75adcd02130edc355c891fa1ca..50f7292fd1691e758ee59672e872fa30a367d934 100644 (file)
@@ -49,30 +49,13 @@ IamWorkerProcess()
     return true;
 }
 
-bool
-IamDiskProcess()
-{
-    std::cerr << STUB_API << " IamDiskProcess() Not implemented\n";
-    return false;
-}
-
-bool
-InDaemonMode()
-{
-    std::cerr << STUB_API << " InDaemonMode() Not implemented\n";
-    return false;
-}
-
-bool
-UsingSmp()
-{
-    std::cerr << STUB_API << " UsingSnmp() Not implemented\n";
-    return false;
-}
-
+bool IamDiskProcess() STUB_RETVAL_NOP(false)
+bool InDaemonMode() STUB_RETVAL_NOP(false)
+bool UsingSmp() STUB_RETVAL_NOP(false)
 bool IamCoordinatorProcess() STUB_RETVAL(false)
 bool IamPrimaryProcess() STUB_RETVAL(false)
 int NumberOfKids() STUB_RETVAL(0)
+
 //not yet needed in the Stub, causes dependency on String
 //String ProcessRoles() STUB_RETVAL(String())
 void writePidFile(void) STUB