extended test case to also cover ticket #6
authorStefan Behnel <scoder@users.berlios.de>
Sun, 8 Mar 2009 12:42:46 +0000 (13:42 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sun, 8 Mar 2009 12:42:46 +0000 (13:42 +0100)
tests/run/specialfloat.pyx

index dfbe04bb74705223a7ec08a31e701ecf1e94e03b..af96fa2ae4c8b3fd6acc96c088170a70c4874cfd 100644 (file)
@@ -44,6 +44,11 @@ __doc__ = u"""
     -inf
     >>> float_infn == float('-inf')
     True
+
+    >>> global_floats()[1:] == (float('+inf'), float('-inf'))
+    True
+    >>> global_floats()[0]
+    nan
 """
 
 DEF FLOAT = 12.5
@@ -51,6 +56,10 @@ DEF FLOAT_NAN = float('nan')
 DEF FLOAT_INFP = float('+inf')
 DEF FLOAT_INFN = float('-inf')
 
+cdef double cdef_float_nan = float('nan')
+cdef double cdef_float_infp = float('+inf')
+cdef double cdef_float_infn = float('-inf')
+
 float_nan = FLOAT_NAN
 float_infp = FLOAT_INFP
 float_infn = FLOAT_INFN
@@ -105,3 +114,5 @@ def infn3():
     f = FLOAT_INFN
     return f
 
+def global_floats():
+    return (cdef_float_nan, cdef_float_infp, cdef_float_infn)