Cython has moved to github.
cython-devel
view tests/run/dictintindex.pyx @ 1622:4f0327bdebc9
test for temp allocation bug in call
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Sat Jan 17 01:25:34 2009 -0800 (3 years ago) |
| parents | f24f2963a581 |
| children | 1fd2883d0bd8 |
line source
1 __doc__ = u"""
2 >>> test_get_char_neg()
3 0
4 >>> test_get_char_zero()
5 1
6 >>> test_get_char_pos()
7 2
8 >>> test_get_uchar_zero()
9 1
10 >>> test_get_uchar_pos()
11 2
12 >>> test_get_int_neg()
13 0
14 >>> test_get_int_zero()
15 1
16 >>> test_get_int_pos()
17 2
18 >>> test_get_uint_zero()
19 1
20 >>> test_get_uint_pos()
21 2
22 >>> test_get_longlong_neg()
23 0
24 >>> test_get_longlong_zero()
25 1
26 >>> test_get_longlong_pos()
27 2
28 >>> test_get_longlong_big()
29 3
30 >>> test_get_ulonglong_zero()
31 1
32 >>> test_get_ulonglong_pos()
33 2
34 >>> test_get_ulonglong_big()
35 3
36 >>> test_del_char()
37 Traceback (most recent call last):
38 KeyError: 0
39 >>> test_del_uchar()
40 Traceback (most recent call last):
41 KeyError: 0
42 >>> test_del_int()
43 Traceback (most recent call last):
44 KeyError: 0
45 >>> test_del_uint()
46 Traceback (most recent call last):
47 KeyError: 0
48 >>> test_del_longlong() #doctest: +ELLIPSIS
49 Traceback (most recent call last):
50 KeyError: 0...
51 >>> test_del_longlong_big() #doctest: +ELLIPSIS
52 Traceback (most recent call last):
53 KeyError: ...
54 >>> test_del_ulonglong() #doctest: +ELLIPSIS
55 Traceback (most recent call last):
56 KeyError: 0...
57 >>> test_del_ulonglong_big() #doctest: +ELLIPSIS
58 Traceback (most recent call last):
59 KeyError: ...
60 """
62 def test_get_char_neg():
63 cdef char key = -1
64 d = {-1:0}
65 return d[key]
66 def test_get_char_zero():
67 cdef char key = 0
68 d = {0:1}
69 return d[key]
70 def test_get_char_pos():
71 cdef char key = 1
72 d = {1:2}
73 return d[key]
76 def test_get_uchar_zero():
77 cdef unsigned char key = 0
78 d = {0:1}
79 return d[key]
80 def test_get_uchar_pos():
81 cdef unsigned char key = 1
82 d = {1:2}
83 return d[key]
86 def test_get_int_neg():
87 cdef int key = -1
88 d = {-1:0}
89 return d[key]
90 def test_get_int_zero():
91 cdef int key = 0
92 d = {0:1}
93 return d[key]
94 def test_get_int_pos():
95 cdef int key = 1
96 d = {1:2}
97 return d[key]
100 def test_get_uint_zero():
101 cdef unsigned int key = 0
102 d = {0:1}
103 return d[key]
104 def test_get_uint_pos():
105 cdef unsigned int key = 1
106 d = {1:2}
107 return d[key]
110 def test_get_longlong_neg():
111 cdef long long key = -1
112 d = {-1:0}
113 return d[key]
114 def test_get_longlong_zero():
115 cdef long long key = 0
116 d = {0:1}
117 return d[key]
118 def test_get_longlong_pos():
119 cdef long long key = 1
120 d = {1:2}
121 return d[key]
122 def test_get_longlong_big():
123 cdef unsigned int shift = sizeof(long)+2
124 cdef long long big = 1
125 cdef long long key = big<<shift
126 d = {big<<shift:3}
127 return d[key]
129 def test_get_ulonglong_zero():
130 cdef unsigned long long key = 0
131 d = {0:1}
132 return d[key]
133 def test_get_ulonglong_pos():
134 cdef unsigned long long key = 1
135 d = {1:2}
136 return d[key]
137 def test_get_ulonglong_big():
138 cdef unsigned int shift = sizeof(long)+2
139 cdef unsigned long long big = 1
140 cdef unsigned long long key = big<<shift
141 d = {big<<shift:3}
142 return d[key]
145 def test_del_char():
146 cdef char key = 0
147 d = {0:1}
148 del d[key]
149 return d[key]
151 def test_del_uchar():
152 cdef unsigned char key = 0
153 d = {0:1}
154 del d[key]
155 return d[key]
157 def test_del_int():
158 cdef int key = 0
159 d = {0:1}
160 del d[key]
161 return d[key]
163 def test_del_uint():
164 cdef unsigned int key = 0
165 d = {0:1}
166 del d[key]
167 return d[key]
169 def test_del_longlong():
170 cdef long long key = 0
171 d = {0:1}
172 del d[key]
173 return d[key]
175 def test_del_ulonglong():
176 cdef unsigned long long key = 0
177 d = {0:1}
178 del d[key]
179 return d[key]
181 def test_del_longlong_big():
182 cdef int shift = sizeof(long)+2
183 cdef long long big = 1
184 cdef long long key = big<<shift
185 d = {big<<shift:1}
186 del d[key]
187 return d[key]
189 def test_del_ulonglong_big():
190 cdef unsigned int shift = sizeof(long)+2
191 cdef unsigned long long big = 1
192 cdef unsigned long long key = big<<shift
193 d = {big<<shift:1}
194 del d[key]
195 return d[key]
