Back to index

python3.2  3.2.2
Public Member Functions | Static Private Attributes
ctypes.test.test_cfuncs.CFunctions Class Reference
Inheritance diagram for ctypes.test.test_cfuncs.CFunctions:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def S
def U
def test_byte
def test_byte_plus
def test_ubyte
def test_ubyte_plus
def test_short
def test_short_plus
def test_ushort
def test_ushort_plus
def test_int
def test_int_plus
def test_uint
def test_uint_plus
def test_long
def test_long_plus
def test_ulong
def test_ulong_plus
def test_longlong
def test_longlong_plus
def test_ulonglong
def test_ulonglong_plus
def test_float
def test_float_plus
def test_double
def test_double_plus
def test_longdouble
def test_longdouble_plus
def test_callwithresult
def test_void

Static Private Attributes

tuple _dll = CDLL(_ctypes_test.__file__)

Detailed Description

Definition at line 9 of file test_cfuncs.py.


Member Function Documentation

Definition at line 12 of file test_cfuncs.py.

00012 
00013     def S(self):
        return c_longlong.in_dll(self._dll, "last_tf_arg_s").value

Here is the caller graph for this function:

Definition at line 17 of file test_cfuncs.py.

00017 
00018     def test_byte(self):
00019         self._dll.tf_b.restype = c_byte
00020         self._dll.tf_b.argtypes = (c_byte,)
00021         self.assertEqual(self._dll.tf_b(-126), -42)
00022         self.assertEqual(self.S(), -126)

Here is the call graph for this function:

Definition at line 23 of file test_cfuncs.py.

00023 
00024     def test_byte_plus(self):
00025         self._dll.tf_bb.restype = c_byte
00026         self._dll.tf_bb.argtypes = (c_byte, c_byte)
00027         self.assertEqual(self._dll.tf_bb(0, -126), -42)
00028         self.assertEqual(self.S(), -126)

Here is the call graph for this function:

Definition at line 173 of file test_cfuncs.py.

00173 
00174     def test_callwithresult(self):
00175         def process_result(result):
00176             return result * 2
00177         self._dll.tf_i.restype = process_result
00178         self._dll.tf_i.argtypes = (c_int,)
00179         self.assertEqual(self._dll.tf_i(42), 28)
00180         self.assertEqual(self.S(), 42)
00181         self.assertEqual(self._dll.tf_i(-42), -28)
00182         self.assertEqual(self.S(), -42)

Here is the call graph for this function:

Definition at line 149 of file test_cfuncs.py.

00149 
00150     def test_double(self):
00151         self._dll.tf_d.restype = c_double
00152         self._dll.tf_d.argtypes = (c_double,)
00153         self.assertEqual(self._dll.tf_d(42.), 14.)
00154         self.assertEqual(self.S(), 42)

Here is the call graph for this function:

Definition at line 155 of file test_cfuncs.py.

00155 
00156     def test_double_plus(self):
00157         self._dll.tf_bd.restype = c_double
00158         self._dll.tf_bd.argtypes = (c_byte, c_double)
00159         self.assertEqual(self._dll.tf_bd(0, 42.), 14.)
00160         self.assertEqual(self.S(), 42)

Here is the call graph for this function:

Definition at line 137 of file test_cfuncs.py.

00137 
00138     def test_float(self):
00139         self._dll.tf_f.restype = c_float
00140         self._dll.tf_f.argtypes = (c_float,)
00141         self.assertEqual(self._dll.tf_f(-42.), -14.)
00142         self.assertEqual(self.S(), -42)

Here is the call graph for this function:

Definition at line 143 of file test_cfuncs.py.

00143 
00144     def test_float_plus(self):
00145         self._dll.tf_bf.restype = c_float
00146         self._dll.tf_bf.argtypes = (c_byte, c_float)
00147         self.assertEqual(self._dll.tf_bf(0, -42.), -14.)
00148         self.assertEqual(self.S(), -42)

Here is the call graph for this function:

Definition at line 65 of file test_cfuncs.py.

00065 
00066     def test_int(self):
00067         self._dll.tf_i.restype = c_int
00068         self._dll.tf_i.argtypes = (c_int,)
00069         self.assertEqual(self._dll.tf_i(-2147483646), -715827882)
00070         self.assertEqual(self.S(), -2147483646)

Here is the call graph for this function:

Definition at line 71 of file test_cfuncs.py.

00071 
00072     def test_int_plus(self):
00073         self._dll.tf_bi.restype = c_int
00074         self._dll.tf_bi.argtypes = (c_byte, c_int)
00075         self.assertEqual(self._dll.tf_bi(0, -2147483646), -715827882)
00076         self.assertEqual(self.S(), -2147483646)

Here is the call graph for this function:

Definition at line 89 of file test_cfuncs.py.

00089 
00090     def test_long(self):
00091         self._dll.tf_l.restype = c_long
00092         self._dll.tf_l.argtypes = (c_long,)
00093         self.assertEqual(self._dll.tf_l(-2147483646), -715827882)
00094         self.assertEqual(self.S(), -2147483646)

Here is the call graph for this function:

Definition at line 95 of file test_cfuncs.py.

00095 
00096     def test_long_plus(self):
00097         self._dll.tf_bl.restype = c_long
00098         self._dll.tf_bl.argtypes = (c_byte, c_long)
00099         self.assertEqual(self._dll.tf_bl(0, -2147483646), -715827882)
00100         self.assertEqual(self.S(), -2147483646)

Here is the call graph for this function:

Definition at line 161 of file test_cfuncs.py.

00161 
00162     def test_longdouble(self):
00163         self._dll.tf_D.restype = c_longdouble
00164         self._dll.tf_D.argtypes = (c_longdouble,)
00165         self.assertEqual(self._dll.tf_D(42.), 14.)
00166         self.assertEqual(self.S(), 42)

Here is the call graph for this function:

Definition at line 167 of file test_cfuncs.py.

00167 
00168     def test_longdouble_plus(self):
00169         self._dll.tf_bD.restype = c_longdouble
00170         self._dll.tf_bD.argtypes = (c_byte, c_longdouble)
00171         self.assertEqual(self._dll.tf_bD(0, 42.), 14.)
00172         self.assertEqual(self.S(), 42)

Here is the call graph for this function:

Definition at line 113 of file test_cfuncs.py.

00113 
00114     def test_longlong(self):
00115         self._dll.tf_q.restype = c_longlong
00116         self._dll.tf_q.argtypes = (c_longlong, )
00117         self.assertEqual(self._dll.tf_q(-9223372036854775806), -3074457345618258602)
00118         self.assertEqual(self.S(), -9223372036854775806)

Here is the call graph for this function:

Definition at line 119 of file test_cfuncs.py.

00119 
00120     def test_longlong_plus(self):
00121         self._dll.tf_bq.restype = c_longlong
00122         self._dll.tf_bq.argtypes = (c_byte, c_longlong)
00123         self.assertEqual(self._dll.tf_bq(0, -9223372036854775806), -3074457345618258602)
00124         self.assertEqual(self.S(), -9223372036854775806)

Here is the call graph for this function:

Definition at line 41 of file test_cfuncs.py.

00041 
00042     def test_short(self):
00043         self._dll.tf_h.restype = c_short
00044         self._dll.tf_h.argtypes = (c_short,)
00045         self.assertEqual(self._dll.tf_h(-32766), -10922)
00046         self.assertEqual(self.S(), -32766)

Here is the call graph for this function:

Definition at line 47 of file test_cfuncs.py.

00047 
00048     def test_short_plus(self):
00049         self._dll.tf_bh.restype = c_short
00050         self._dll.tf_bh.argtypes = (c_byte, c_short)
00051         self.assertEqual(self._dll.tf_bh(0, -32766), -10922)
00052         self.assertEqual(self.S(), -32766)

Here is the call graph for this function:

Definition at line 29 of file test_cfuncs.py.

00029 
00030     def test_ubyte(self):
00031         self._dll.tf_B.restype = c_ubyte
00032         self._dll.tf_B.argtypes = (c_ubyte,)
00033         self.assertEqual(self._dll.tf_B(255), 85)
00034         self.assertEqual(self.U(), 255)

Here is the call graph for this function:

Definition at line 35 of file test_cfuncs.py.

00035 
00036     def test_ubyte_plus(self):
00037         self._dll.tf_bB.restype = c_ubyte
00038         self._dll.tf_bB.argtypes = (c_byte, c_ubyte)
00039         self.assertEqual(self._dll.tf_bB(0, 255), 85)
00040         self.assertEqual(self.U(), 255)

Here is the call graph for this function:

Definition at line 77 of file test_cfuncs.py.

00077 
00078     def test_uint(self):
00079         self._dll.tf_I.restype = c_uint
00080         self._dll.tf_I.argtypes = (c_uint,)
00081         self.assertEqual(self._dll.tf_I(4294967295), 1431655765)
00082         self.assertEqual(self.U(), 4294967295)

Here is the call graph for this function:

Definition at line 83 of file test_cfuncs.py.

00083 
00084     def test_uint_plus(self):
00085         self._dll.tf_bI.restype = c_uint
00086         self._dll.tf_bI.argtypes = (c_byte, c_uint)
00087         self.assertEqual(self._dll.tf_bI(0, 4294967295), 1431655765)
00088         self.assertEqual(self.U(), 4294967295)

Here is the call graph for this function:

Definition at line 101 of file test_cfuncs.py.

00101 
00102     def test_ulong(self):
00103         self._dll.tf_L.restype = c_ulong
00104         self._dll.tf_L.argtypes = (c_ulong,)
00105         self.assertEqual(self._dll.tf_L(4294967295), 1431655765)
00106         self.assertEqual(self.U(), 4294967295)

Here is the call graph for this function:

Definition at line 107 of file test_cfuncs.py.

00107 
00108     def test_ulong_plus(self):
00109         self._dll.tf_bL.restype = c_ulong
00110         self._dll.tf_bL.argtypes = (c_char, c_ulong)
00111         self.assertEqual(self._dll.tf_bL(b' ', 4294967295), 1431655765)
00112         self.assertEqual(self.U(), 4294967295)

Here is the call graph for this function:

Definition at line 125 of file test_cfuncs.py.

00125 
00126     def test_ulonglong(self):
00127         self._dll.tf_Q.restype = c_ulonglong
00128         self._dll.tf_Q.argtypes = (c_ulonglong, )
00129         self.assertEqual(self._dll.tf_Q(18446744073709551615), 6148914691236517205)
00130         self.assertEqual(self.U(), 18446744073709551615)

Here is the call graph for this function:

Definition at line 131 of file test_cfuncs.py.

00131 
00132     def test_ulonglong_plus(self):
00133         self._dll.tf_bQ.restype = c_ulonglong
00134         self._dll.tf_bQ.argtypes = (c_byte, c_ulonglong)
00135         self.assertEqual(self._dll.tf_bQ(0, 18446744073709551615), 6148914691236517205)
00136         self.assertEqual(self.U(), 18446744073709551615)

Here is the call graph for this function:

Definition at line 53 of file test_cfuncs.py.

00053 
00054     def test_ushort(self):
00055         self._dll.tf_H.restype = c_ushort
00056         self._dll.tf_H.argtypes = (c_ushort,)
00057         self.assertEqual(self._dll.tf_H(65535), 21845)
00058         self.assertEqual(self.U(), 65535)

Here is the call graph for this function:

Definition at line 59 of file test_cfuncs.py.

00059 
00060     def test_ushort_plus(self):
00061         self._dll.tf_bH.restype = c_ushort
00062         self._dll.tf_bH.argtypes = (c_byte, c_ushort)
00063         self.assertEqual(self._dll.tf_bH(0, 65535), 21845)
00064         self.assertEqual(self.U(), 65535)

Here is the call graph for this function:

Definition at line 183 of file test_cfuncs.py.

00183 
00184     def test_void(self):
00185         self._dll.tv_i.restype = None
00186         self._dll.tv_i.argtypes = (c_int,)
00187         self.assertEqual(self._dll.tv_i(42), None)
00188         self.assertEqual(self.S(), 42)
00189         self.assertEqual(self._dll.tv_i(-42), None)
00190         self.assertEqual(self.S(), -42)
00191 
00192 # The following repeates the above tests with stdcall functions (where
00193 # they are available)
try:

Here is the call graph for this function:

Definition at line 14 of file test_cfuncs.py.

00014 
00015     def U(self):
00016         return c_ulonglong.in_dll(self._dll, "last_tf_arg_u").value

Here is the caller graph for this function:


Member Data Documentation

tuple ctypes.test.test_cfuncs.CFunctions._dll = CDLL(_ctypes_test.__file__) [static, private]

Reimplemented in ctypes.test.test_cfuncs.stdcallCFunctions.

Definition at line 10 of file test_cfuncs.py.


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