String routines to complement <string> && <cstring>:
Macros | Functions
uUnit.h File Reference

[u]Micro module for [Unit] program testing. More...

#include <iostream>

Go to the source code of this file.

Macros

#define assertTrue(cond)   uUnit_testThis(!!(cond), #cond, __FILE__,__LINE__ )
 (cond ? () : cout << "cond" ) More...
 
#define assertFalse(cond)   uUnit_testThis( !(cond),"!(" #cond ")", __FILE__,__LINE__ )
 (!(cond) ? () : cout << "!" << (cond)" ) More...
 

Functions

template<class T >
const T * remove_dir_name (const T *str)
 "C:/DIR/SubDir/file_name.ext" ==> "file_name.ext" More...
 
template<>
const char * remove_dir_name< char > (const char *str)
 "C:/DIR/SubDir/file_name.ext" ==> "file_name.ext" More...
 
template<class T >
void uUnit_testThis (bool cond, const T *label, const T *fname, long lineno)
 
template<>
void uUnit_testThis< char > (bool cond, const char *label, const char *fname, long lineno)
 

Detailed Description

[u]Micro module for [Unit] program testing.

Author
Adolfo Di Mare adolf.nosp@m.o@di.nosp@m.-mare.nosp@m..com
Date
2011,2019
See also
http://www.di-mare.com/adolfo/p/BUnitXP.htm
#include "uUnit.h" // assertTrue() && assertFalse()
// Example
int main( int argc , const char* argv[] ) {
std::cout << "TestCase [uUnit.h] yesYES" << std::endl;
assertTrue( 1==2 ); // ok?
assertFalse( 1==2 ); // ok!
return test_myImp(argc , argv);
}

Definition in file uUnit.h.

Macro Definition Documentation

◆ assertTrue

#define assertTrue (   cond)    uUnit_testThis(!!(cond), #cond, __FILE__,__LINE__ )

(cond ? () : cout << "cond" )

Definition at line 93 of file uUnit.h.

◆ assertFalse

#define assertFalse (   cond)    uUnit_testThis( !(cond),"!(" #cond ")", __FILE__,__LINE__ )

(!(cond) ? () : cout << "!" << (cond)" )

Definition at line 95 of file uUnit.h.

Function Documentation

◆ remove_dir_name()

template<class T >
const T* remove_dir_name ( const T *  str)

"C:/DIR/SubDir/file_name.ext" ==> "file_name.ext"

◆ remove_dir_name< char >()

template<>
const char* remove_dir_name< char > ( const char *  str)

"C:/DIR/SubDir/file_name.ext" ==> "file_name.ext"

Definition at line 39 of file uUnit.h.

◆ uUnit_testThis()

template<class T >
void uUnit_testThis ( bool  cond,
const T *  label,
const T *  fname,
long  lineno 
)
inline

◆ uUnit_testThis< char >()

template<>
void uUnit_testThis< char > ( bool  cond,
const char *  label,
const char *  fname,
long  lineno 
)
inline

Definition at line 66 of file uUnit.h.

assertTrue
#define assertTrue(cond)
(cond ? () : cout << "cond" )
Definition: uUnit.h:93
assertFalse
#define assertFalse(cond)
(!(cond) ? () : cout << "!" << (cond)" )
Definition: uUnit.h:95
uUnit.h
[u]Micro module for [Unit] program testing.
main
int main(const int argc, const char *argv[])
Test program.
Definition: strnum_test.cpp:17