Unit tests of C functions with Python
Hi,
We have developed a C project and we want to write unit test for it. I used a sample VC++ project with Python using swig (to wrap a ".i" file). My C functions has a return value and formal parameters could be pointers or scalars, I need to pass some of them by reference to get the value back.
Here's an example of a function of mine (functional test OK): S32 CALENDAR_RequestHandlerFunction (U32 U32RequestID, void* pArg1, void* pArg2, void* pArg3);
pArg1 or pArg2 or pArg3 could point to anything and could be IN or OUT.
I imported "ctypes" module in my "test.py" file, but Python complain from "pArg1" saying: "TypeError: in method CALENDAR_RequestHandlerFunction', argument 2 of type 'void *'
Notice that I used the same proto in my ".i" file.
Any help to test C functions using Python and avoid C types problems?
Thank you.
Best regards, AnL.
participants (1)
-
Anouar Lachheb