#include <iostream>
Go to the source code of this file.
◆ STUB
◆ stub_fatal
#define stub_fatal |
( |
|
m | ) |
{ std::cerr<<"FATAL: "<<(m)<<" for use of "<<__FUNCTION__<<"\n"; exit(EXIT_FAILURE); } |
\group STUB
A set of useful macros to create stub_* files.
Intended for use building unit tests, if a stubbed function is called by any code it is linked to it will abort with a message indicating which API file is missing from the linked dependencies.
Usage: at the top of your intended stub file define STUB_API to be the name of the .cc file or library you are providing a stub of then include this STUB.h header.
#define STUB_API "foo/libexample.la" #include "tests/STUB.h"
Definition at line 30 of file STUB.h.
◆ STUB_NOP
#define STUB_NOP { std::cerr<<"SKIP: "<<STUB_API<<" "<<__FUNCTION__<<" (not implemented).\n"; } |
macro to stub a void function without a fatal message Intended for registration pattern APIs where the function result does not matter to the test
Definition at line 37 of file STUB.h.
◆ STUB_RETREF
macro to stub a function which returns a reference to dynamic Aborts unit tests requiring its definition with a message about the missing linkage
- Parameters
-
x | underlying or "referred to" type |
Definition at line 51 of file STUB.h.
◆ STUB_RETSTATREF
◆ STUB_RETVAL
macro to stub a function with return value. Aborts unit tests requiring its definition with a message about the missing linkage
Definition at line 41 of file STUB.h.
◆ STUB_RETVAL_NOP
#define STUB_RETVAL_NOP |
( |
|
x | ) |
{ std::cerr<<"SKIP: "<<STUB_API<<" "<<__FUNCTION__<<" (not implemented).\n"; 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
Definition at line 45 of file STUB.h.