moved special float tests into separate test
authorStefan Behnel <scoder@users.berlios.de>
Fri, 25 Apr 2008 15:54:35 +0000 (17:54 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 25 Apr 2008 15:54:35 +0000 (17:54 +0200)
--HG--
rename : tests/run/ct_DEF.pyx => tests/run/specialfloat.pyx

tests/run/ct_DEF.pyx
tests/run/specialfloat.pyx [new file with mode: 0644]

index 1d92cc87cbda0c201744984739aa9a41b14cef6e..d85cfb0668a5fb637f6717a7a1309cdd92cfffc3 100644 (file)
@@ -11,12 +11,6 @@ __doc__ = """
     666
     >>> f()
     12.5
-    >>> nan()
-    nan
-    >>> infp()
-    inf
-    >>> infn()
-    -inf
     >>> s()
     'spam'
     >>> two()
@@ -38,9 +32,6 @@ DEF INT2 = 0x42
 DEF INT3 = 042
 DEF LONG = 666L
 DEF FLOAT = 12.5
-DEF FLOAT_NAN = float('nan')
-DEF FLOAT_INFP = float('+inf')
-DEF FLOAT_INFN = float('-inf')
 DEF STR = "spam"
 DEF TWO = TUPLE[1]
 DEF FIVE = TWO + 3
@@ -77,21 +68,6 @@ def f():
     f = FLOAT
     return f
 
-def nan():
-    cdef float f
-    f = FLOAT_NAN
-    return f
-
-def infp():
-    cdef float f
-    f = FLOAT_INFP
-    return f
-
-def infn():
-    cdef float f
-    f = FLOAT_INFN
-    return f
-
 def s():
     cdef char *s
     s = STR
diff --git a/tests/run/specialfloat.pyx b/tests/run/specialfloat.pyx
new file mode 100644 (file)
index 0000000..0fe41bf
--- /dev/null
@@ -0,0 +1,68 @@
+__doc__ = """
+    >>> f()
+    12.5
+
+    >>> nan1()
+    nan
+    >>> nan2()
+    nan
+
+    >>> infp1()
+    inf
+    >>> infp1() == float('inf')
+    True
+    >>> infp2()
+    inf
+    >>> infp2() == float('inf')
+    True
+
+    >>> infn1()
+    -inf
+    >>> infn1() == float('-inf')
+    True
+    >>> infn2()
+    -inf
+    >>> infn2() == float('-inf')
+    True
+"""
+
+DEF FLOAT = 12.5
+DEF FLOAT_NAN = float('nan')
+DEF FLOAT_INFP = float('+inf')
+DEF FLOAT_INFN = float('-inf')
+
+def f():
+    cdef float f
+    f = FLOAT
+    return f
+
+def nan1():
+    cdef double f
+    f = FLOAT_NAN
+    return f
+
+def nan2():
+    cdef double f
+    f = float('nan')
+    return f
+
+def infp1():
+    cdef double f
+    f = FLOAT_INFP
+    return f
+
+def infp2():
+    cdef double f
+    f = float('+inf')
+    return f
+
+def infn1():
+    cdef double f
+    f = FLOAT_INFN
+    return f
+
+def infn2():
+    cdef double f
+    f = float('-inf')
+    return f
+