X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=test%2Fpyunit.h;h=9ca6c6a0b7532b37cb3f8405c0127cb9b47c3ba6;hb=7af51d108fe596be66dccdf79ea13f44bfcf655a;hp=c2523d516dbe66e2c63d944a8d2a5fa9bf73647a;hpb=89471fa0ae4ddc54bd49511af6e3f3b43761f153;p=vlc diff --git a/test/pyunit.h b/test/pyunit.h index c2523d516d..9ca6c6a0b7 100644 --- a/test/pyunit.h +++ b/test/pyunit.h @@ -1,16 +1,18 @@ #include -#define ASSERT( a, message ) if( !(a) ) { PyErr_SetString( PyExc_AssertionError, message " - " #a ); return NULL; } +extern int asserts; + +#define ASSERT( a, message ) asserts++;if( !(a) ) { fprintf( stderr, "Assert failed at %s:%i\n", __FILE__, __LINE__); PyErr_SetString( PyExc_AssertionError, message " - " #a ); return NULL; } #define DECLARE_MODULE( module ) PyMODINIT_FUNC init##module( void ) { \ Py_InitModule( #module, module##_methods ); \ } -#define ASSERT_NOEXCEPTION if( libvlc_exception_raised( &exception ) ) { \ +#define ASSERT_NOEXCEPTION asserts++; if( libvlc_exception_raised( &exception ) ) { \ if( libvlc_exception_get_message( &exception ) ) PyErr_SetString( PyExc_AssertionError, libvlc_exception_get_message( &exception ) ); \ else PyErr_SetString( PyExc_AssertionError, "Exception raised" ); return NULL; } -#define ASSERT_EXCEPTION if( !libvlc_exception_raised( &exception ) ) { \ +#define ASSERT_EXCEPTION asserts ++; if( !libvlc_exception_raised( &exception ) ) { \ if( libvlc_exception_get_message( &exception ) ) PyErr_SetString( PyExc_AssertionError, libvlc_exception_get_message( &exception ) ); \ else PyErr_SetString( PyExc_AssertionError, "Exception not raised" ); return NULL; }