mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
74961774cc
* Implemented start/stop interface in udpbitdht and bemanager * added Restart of DHT if it fails to get going. * added start / stop functionality to bdnode and bdstore * added cleanup code to rest of bitdht classes. * reworked NetworkSize calc functions. * added thread debugging (prints at start / stop / join). * TESTS: added utest.h header file for automated unit testing (from libretroshare) * TESTS: bdmetric_test started conversion to automated tests * TESTS: udpbitdht_nettest. Added dht start / stop and network reset (thread join) functionality. * TESTS: fresh bdboot.txt git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3678 b45a01b8-16f6-495d-af2f-9b41ad6348cc
24 lines
927 B
C
24 lines
927 B
C
#ifndef _UNIT_TEST_MACROS_H__
|
|
#define _UNIT_TEST_MACROS_H__
|
|
|
|
#include <stdio.h>
|
|
|
|
#define TFAILURE( s ) printf( "FAILURE: " __FILE__ ":%-4d %s\n", __LINE__, s )
|
|
#define TSUCCESS( s ) printf( "SUCCESS: " __FILE__ ":%-4d %s\n", __LINE__, s )
|
|
|
|
/* careful with this line (no protection) */
|
|
#define INITTEST() int ok = 1; int gok = 1;
|
|
|
|
/* declare the variables */
|
|
extern int ok;
|
|
extern int gok;
|
|
|
|
#define CHECK( b ) do { if ( ! (b) ) { ok = 0; TFAILURE( #b ); } } while(0)
|
|
#define FAILED( s ) do { ok = 0; TFAILURE( s ); } while(0)
|
|
#define REPORT( s ) do { if ( ! (ok) ) { ok = 0; TFAILURE( s ); } else { TSUCCESS( s );} gok &= ok; ok = 1; } while(0)
|
|
#define REPORT2( b, s ) do { if ( ! (b) ) { ok = 0; TFAILURE( s ); } else { TSUCCESS( s );} gok &= ok; ok = 1; } while(0)
|
|
#define FINALREPORT( s ) do { gok &= ok; ok = 1; if ( ! (gok) ) { TFAILURE( s ); } else { TSUCCESS( s );} } while(0)
|
|
#define TESTRESULT() (!gok)
|
|
|
|
#endif
|