Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
b02c0b09
Commit
b02c0b09
authored
Mar 11, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More indexing tests
parent
43521474
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
2 deletions
+48
-2
tests/run/dictintindex.pyx
tests/run/dictintindex.pyx
+2
-2
tests/run/index.pyx
tests/run/index.pyx
+46
-0
No files found.
tests/run/dictintindex.pyx
View file @
b02c0b09
...
...
@@ -42,9 +42,9 @@ KeyError: 0
>>> test_del_int()
Traceback (most recent call last):
KeyError: 0
>>> test_del_uint()
>>> test_del_uint()
#doctest: +ELLIPSIS
Traceback (most recent call last):
KeyError: 0
KeyError: 0
...
>>> test_del_longlong() #doctest: +ELLIPSIS
Traceback (most recent call last):
KeyError: 0...
...
...
tests/run/index.pyx
View file @
b02c0b09
...
...
@@ -42,6 +42,10 @@ IndexError: string index out of range
Traceback (most recent call last):
...
TypeError: 'int' object is unsubscriptable
>>> test_unsigned_long()
>>> test_unsigned_short()
>>> test_long_long()
"""
...
...
@@ -53,3 +57,45 @@ def index_list(list L, int i):
def
index_object
(
object
o
,
int
i
):
return
o
[
i
]
# These make sure that our fast indexing works with large and unsigned types.
def
test_unsigned_long
():
cdef
int
i
cdef
unsigned
long
ix
cdef
D
=
{}
for
i
from
0
<=
i
<
sizeof
(
unsigned
long
)
*
8
:
ix
=
(
<
unsigned
long
>
1
)
<<
i
D
[
ix
]
=
True
for
i
from
0
<=
i
<
sizeof
(
unsigned
long
)
*
8
:
ix
=
(
<
unsigned
long
>
1
)
<<
i
assert
D
[
ix
]
is
True
del
D
[
ix
]
assert
len
(
D
)
==
0
def
test_unsigned_short
():
cdef
int
i
cdef
unsigned
short
ix
cdef
D
=
{}
for
i
from
0
<=
i
<
sizeof
(
unsigned
short
)
*
8
:
ix
=
(
<
unsigned
short
>
1
)
<<
i
D
[
ix
]
=
True
for
i
from
0
<=
i
<
sizeof
(
unsigned
short
)
*
8
:
ix
=
(
<
unsigned
short
>
1
)
<<
i
assert
D
[
ix
]
is
True
del
D
[
ix
]
assert
len
(
D
)
==
0
def
test_long_long
():
cdef
int
i
cdef
long
long
ix
cdef
D
=
{}
for
i
from
0
<=
i
<
sizeof
(
long
long
)
*
8
:
ix
=
(
<
long
long
>
1
)
<<
i
D
[
ix
]
=
True
for
i
from
0
<=
i
<
sizeof
(
long
long
)
*
8
:
ix
=
(
<
long
long
>
1
)
<<
i
assert
D
[
ix
]
is
True
del
D
[
ix
]
assert
len
(
D
)
==
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment