Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
2a1efab1
Commit
2a1efab1
authored
Jan 11, 2016
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing long attributes compared with CPython and also with tests
parent
d6f595db
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
260 additions
and
109 deletions
+260
-109
src/runtime/long.cpp
src/runtime/long.cpp
+218
-107
src/runtime/long.h
src/runtime/long.h
+2
-2
test/tests/long.py
test/tests/long.py
+40
-0
No files found.
src/runtime/long.cpp
View file @
2a1efab1
This diff is collapsed.
Click to expand it.
src/runtime/long.h
View file @
2a1efab1
...
...
@@ -51,8 +51,8 @@ Box* longSub(BoxedLong* lhs, Box* rhs);
Box
*
longMul
(
BoxedLong
*
lhs
,
Box
*
rhs
);
Box
*
longDiv
(
BoxedLong
*
lhs
,
Box
*
rhs
);
Box
*
longPow
(
BoxedLong
*
lhs
,
Box
*
rhs
,
Box
*
mod
=
None
);
Box
*
longL
shift
(
BoxedLong
*
lhs
,
Box
*
rhs
);
Box
*
longR
shift
(
BoxedLong
*
lhs
,
Box
*
rhs
);
Box
*
longL
ShiftLong
(
BoxedLong
*
lhs
,
Box
*
_
rhs
);
Box
*
longR
ShiftLong
(
BoxedLong
*
lhs
,
Box
*
_
rhs
);
Box
*
longHex
(
BoxedLong
*
v
);
Box
*
longOct
(
BoxedLong
*
v
);
...
...
test/tests/long.py
View file @
2a1efab1
...
...
@@ -162,3 +162,43 @@ for i in range(-10, 10):
for
i
in
xrange
(
100
):
for
j
in
xrange
(
100
):
print
i
,
j
,
hash
((
1
<<
i
)
-
(
1
<<
j
))
pow_test_data
=
[
42L
,
3
,
4.5
,
"x"
,
0
,
-
42
,
None
]
for
rhs
in
pow_test_data
:
for
lhs
in
pow_test_data
:
for
mod
in
pow_test_data
:
try
:
print
(
long
.
__rpow__
(
rhs
,
lhs
,
mod
))
except
Exception
as
e
:
print
(
e
.
message
)
unary_test_data
=
[
-
42
,
-
0
,
0
,
42
]
for
i
in
unary_test_data
:
print
(
int
.
__abs__
(
i
))
print
(
int
.
__long__
(
i
))
data
=
[
"-1L"
,
"0L"
,
"1L"
,
"42L"
,
"-42L"
,
"42.0"
,
"5"
,
"0"
,
"5+5j"
,
"0.0"
,
"
\
"
42
\
"
"
,
"None"
,
]
operations
=
[
"__rpow__"
,
"__rshift__"
,
"__lshift__"
,
"__rrshift__"
,
"__rlshift__"
,
"__coerce__"
,
]
for
x
in
data
:
for
y
in
data
:
for
operation
in
operations
:
try
:
print
(
eval
(
"long.{op}({arg1}, {arg2})"
.
format
(
op
=
operation
,
arg1
=
x
,
arg2
=
y
)))
except
Exception
as
e
:
print
(
e
.
message
)
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