1
mirror of https://code.videolan.org/videolan/vlc synced 2024-07-21 07:24:15 +02:00
vlc/test/pyunit.h
Clément Stenac 0fbf13c309 * Tests for previous commit
* Improve test output
2006-08-19 16:19:56 +00:00

21 lines
1.0 KiB
C

#include <Python.h>
extern int asserts;
#define ASSERT( a, message ) asserts++;if( !(a) ) { 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 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 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},