summaryrefslogtreecommitdiff
path: root/tests/run/powop.pyx
diff options
context:
space:
mode:
authorStefan Behnel <scoder@users.berlios.de>2008-01-02 12:52:32 +0100
committerStefan Behnel <scoder@users.berlios.de>2008-01-02 12:52:32 +0100
commitb4c9ca285315b4700c25e740078766f9dbf2ce98 (patch)
tree4044f4e23c40d07c9e1b21804f333935dd55b6aa /tests/run/powop.pyx
parent9a8c817dcc709a7fc9630865610626dcc787e9f1 (diff)
downloadcython-b4c9ca285315b4700c25e740078766f9dbf2ce98.tar.gz
tests for '**' operator
Diffstat (limited to 'tests/run/powop.pyx')
-rw-r--r--tests/run/powop.pyx26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/run/powop.pyx b/tests/run/powop.pyx
new file mode 100644
index 000000000..c8633eada
--- /dev/null
+++ b/tests/run/powop.pyx
@@ -0,0 +1,26 @@
+__doc__ = """
+ >>> f(1.0, 2.95)[0] == f(1.0, 2.95)[1]
+ True
+
+ >>> constant_py()
+ 1024L
+
+ >>> constant_long() == 2L ** 36
+ True
+"""
+
+def f(obj2, obj3):
+ cdef float flt1, flt2, flt3
+ flt2, flt3 = obj2, obj3
+
+ flt1 = flt2 ** flt3
+ obj1 = obj2 ** obj3
+ return flt1, obj1
+
+def constant_py():
+ result = 2L ** 10
+ return result
+
+def constant_long():
+ result = 2L ** 36
+ return result