[ctypes-commit] ctypes/unittests test_prototypes.py,1.6,1.6.6.1 test_pointers.py,1.16.6.1,1.16.6.2
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2005-07-29 18:00:50
|
Update of /cvsroot/ctypes/ctypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21838 Modified Files: Tag: branch_1_0 test_prototypes.py test_pointers.py Log Message: Patches from Mike Fletcher. Index: test_pointers.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/unittests/test_pointers.py,v retrieving revision 1.16.6.1 retrieving revision 1.16.6.2 diff -C2 -d -r1.16.6.1 -r1.16.6.2 *** test_pointers.py 14 Apr 2005 18:17:56 -0000 1.16.6.1 --- test_pointers.py 29 Jul 2005 18:00:41 -0000 1.16.6.2 *************** *** 24,27 **** --- 24,28 ---- dll = CDLL(find_test_dll()) func = dll._testfunc_p_p + func.restype = c_long i = c_int(12345678) *************** *** 148,151 **** --- 149,165 ---- c = c.next[0] self.failUnlessEqual(result, [42] * 8) + + def test_charpp( self ): + """Test that a character pointer-to-pointer is correctly passed""" + dll = CDLL(find_test_dll()) + func = dll._testfunc_c_p_p + func.restype = c_char_p + argv = (c_char_p * 2)() + argc = c_int( 2 ) + argv[0] = 'hello' + argv[1] = 'world' + result = func( byref(argc), argv ) + assert result == 'world', result + if __name__ == '__main__': Index: test_prototypes.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/unittests/test_prototypes.py,v retrieving revision 1.6 retrieving revision 1.6.6.1 diff -C2 -d -r1.6 -r1.6.6.1 *** test_prototypes.py 14 Oct 2004 13:16:13 -0000 1.6 --- test_prototypes.py 29 Jul 2005 18:00:41 -0000 1.6.6.1 *************** *** 33,41 **** def setUp(self): func = testdll._testfunc_p_p ! func.restype = c_int func.argtypes = None def test_int_pointer_arg(self): func = testdll._testfunc_p_p self.failUnlessEqual(0, func(0)) --- 33,42 ---- def setUp(self): func = testdll._testfunc_p_p ! func.restype = c_long func.argtypes = None def test_int_pointer_arg(self): func = testdll._testfunc_p_p + func.restype = c_long self.failUnlessEqual(0, func(0)) |