summaryrefslogtreecommitdiff
path: root/tests/run/powop.pyx
diff options
context:
space:
mode:
authorRobert Bradshaw <robertwb@math.washington.edu>2009-03-14 22:13:11 -0700
committerRobert Bradshaw <robertwb@math.washington.edu>2009-03-14 22:13:11 -0700
commit6e54e1e623ee37db980a89abc47aeea33b9b4dd6 (patch)
treea466bd0671bc7772506659a0099ad854ef025c64 /tests/run/powop.pyx
parent64724e68eec9eed97e60a5cfc494fe9085a4f825 (diff)
downloadcython-6e54e1e623ee37db980a89abc47aeea33b9b4dd6.tar.gz
int powering tests
Diffstat (limited to 'tests/run/powop.pyx')
-rw-r--r--tests/run/powop.pyx26
1 files changed, 20 insertions, 6 deletions
diff --git a/tests/run/powop.pyx b/tests/run/powop.pyx
index 3d8c9b0fe..cbc291dd7 100644
--- a/tests/run/powop.pyx
+++ b/tests/run/powop.pyx
@@ -8,17 +8,25 @@ __doc__ = u"""
>>> h(4)
625
- >>> constant_py() == 2L ** 10
+ >>> constant_py() == 2 ** 10
True
- >>> constant_long() == 2L ** 36
+ >>> constant_long() == 2 ** 36
True
+
+ >>> small_int_pow(3)
+ (1, 3, 9, 27, 81)
+ >>> small_int_pow(-5)
+ (1, -5, 25, -125, 625)
+
+ >>> int_pow(7, 2)
+ 49
+ >>> int_pow(5, 3)
+ 125
+ >>> int_pow(2, 10)
+ 1024
"""
-import sys
-if sys.version_info[0] >= 3:
- __doc__ = __doc__.replace(u"2L", u"2")
-
def f(obj2, obj3):
cdef float flt1, flt2, flt3
flt2, flt3 = obj2, obj3
@@ -40,3 +48,9 @@ def constant_py():
def constant_long():
result = (<object>2L) ** 36
return result
+
+def small_int_pow(long s):
+ return s**0, s**1, s**2, s**3, s**4
+
+def int_pow(short a, short b):
+ return a**b