Back to index

python3.2  3.2.2
Public Member Functions
ctypes.test.test_libc.LibTest Class Reference

List of all members.

Public Member Functions

def test_sqrt
def test_qsort

Detailed Description

Definition at line 12 of file test_libc.py.


Member Function Documentation

Definition at line 20 of file test_libc.py.

00020 
00021     def test_qsort(self):
00022         comparefunc = CFUNCTYPE(c_int, POINTER(c_char), POINTER(c_char))
00023         lib.my_qsort.argtypes = c_void_p, c_size_t, c_size_t, comparefunc
00024         lib.my_qsort.restype = None
00025 
00026         def sort(a, b):
00027             return three_way_cmp(a[0], b[0])
00028 
00029         chars = create_string_buffer(b"spam, spam, and spam")
00030         lib.my_qsort(chars, len(chars)-1, sizeof(c_char), comparefunc(sort))
00031         self.assertEqual(chars.raw, b"   ,,aaaadmmmnpppsss\x00")

Here is the call graph for this function:

Definition at line 13 of file test_libc.py.

00013 
00014     def test_sqrt(self):
00015         lib.my_sqrt.argtypes = c_double,
00016         lib.my_sqrt.restype = c_double
00017         self.assertEqual(lib.my_sqrt(4.0), 2.0)
00018         import math
00019         self.assertEqual(lib.my_sqrt(2.0), math.sqrt(2.0))

Here is the call graph for this function:


The documentation for this class was generated from the following file: