X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=test%2Fpyunit.h;h=9ca6c6a0b7532b37cb3f8405c0127cb9b47c3ba6;hb=fea85dea108170c42f126e7937821c074384c8b5;hp=f1284e0ef7e58a720d24f9a6b49efe9dc26a7ad8;hpb=e0003bec24b8241621d4bb6ce0fe5160835d84d0;p=vlc diff --git a/test/pyunit.h b/test/pyunit.h index f1284e0ef7..9ca6c6a0b7 100644 --- a/test/pyunit.h +++ b/test/pyunit.h @@ -1,19 +1,20 @@ #include -#define ASSERT( a, message ) if( !(a) ) { fprintf( stderr, "ASSERTION FAILED\n" ); PyErr_SetString( PyExc_AssertionError, message ); 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; } - #define DEF_METHOD( method, desc ) { #method, method, METH_VARARGS, desc},