i18n fixes (part 2)
[vlc.git] / test / pyunit.h
blob9ca6c6a0b7532b37cb3f8405c0127cb9b47c3ba6
1 #include <Python.h>
3 extern int asserts;
5 #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; }
7 #define DECLARE_MODULE( module ) PyMODINIT_FUNC init##module( void ) { \
8 Py_InitModule( #module, module##_methods ); \
11 #define ASSERT_NOEXCEPTION asserts++; if( libvlc_exception_raised( &exception ) ) { \
12 if( libvlc_exception_get_message( &exception ) ) PyErr_SetString( PyExc_AssertionError, libvlc_exception_get_message( &exception ) ); \
13 else PyErr_SetString( PyExc_AssertionError, "Exception raised" ); return NULL; }
15 #define ASSERT_EXCEPTION asserts ++; if( !libvlc_exception_raised( &exception ) ) { \
16 if( libvlc_exception_get_message( &exception ) ) PyErr_SetString( PyExc_AssertionError, libvlc_exception_get_message( &exception ) ); \
17 else PyErr_SetString( PyExc_AssertionError, "Exception not raised" ); return NULL; }
20 #define DEF_METHOD( method, desc ) { #method, method, METH_VARARGS, desc},