new tests for 'in' operator
authorStefan Behnel <scoder@users.berlios.de>
Sat, 16 Feb 2008 18:21:50 +0000 (19:21 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 16 Feb 2008 18:21:50 +0000 (19:21 +0100)
tests/run/inop.pyx [new file with mode: 0644]
tests/run/notinop.pyx [new file with mode: 0644]

diff --git a/tests/run/inop.pyx b/tests/run/inop.pyx
new file mode 100644 (file)
index 0000000..ae5a027
--- /dev/null
@@ -0,0 +1,43 @@
+__doc__ = """
+    >>> f(1,[1,2,3])
+    True
+    >>> f(5,[1,2,3])
+    False
+    >>> f(2,(1,2,3))
+    True
+
+    >>> g(1,[1,2,3])
+    1
+    >>> g(5,[1,2,3])
+    0
+    >>> g(2,(1,2,3))
+    1
+
+    >>> h([1,2,3,4])
+    True
+    >>> h([1,3,4])
+    False
+
+    >>> j([1,2,3,4])
+    1
+    >>> j([1,3,4])
+    0
+"""
+
+def f(a,b):
+    result = a in b
+    return result
+
+def g(a,b):
+    cdef int result
+    result = a in b
+    return result
+
+def h(b):
+    result = 2 in b
+    return result
+
+def j(b):
+    cdef int result
+    result = 2 in b
+    return result
diff --git a/tests/run/notinop.pyx b/tests/run/notinop.pyx
new file mode 100644 (file)
index 0000000..f4aae7a
--- /dev/null
@@ -0,0 +1,43 @@
+__doc__ = """
+    >>> f(1,[1,2,3])
+    False
+    >>> f(5,[1,2,3])
+    True
+    >>> f(2,(1,2,3))
+    False
+
+    >>> g(1,[1,2,3])
+    0
+    >>> g(5,[1,2,3])
+    1
+    >>> g(2,(1,2,3))
+    0
+
+    >>> h([1,2,3,4])
+    False
+    >>> h([1,3,4])
+    True
+
+    >>> j([1,2,3,4])
+    0
+    >>> j([1,3,4])
+    1
+"""
+
+def f(a,b):
+    result = a not in b
+    return result
+
+def g(a,b):
+    cdef int result
+    result = a not in b
+    return result
+
+def h(b):
+    result = 2 not in b
+    return result
+
+def j(b):
+    cdef int result
+    result = 2 not in b
+    return result