Commit ed8e6972 authored by Stefan Behnel's avatar Stefan Behnel

extend C++ tests to make sure we do not generate warnings (and fix some...

extend C++ tests to make sure we do not generate warnings (and fix some warnings that we did generate)
parent 722d3039
# tag: cpp
# mode: run
# tag: cpp, werror
from libcpp cimport bool
......
# tag: cpp
# mode: run
# tag: cpp, werror
from libcpp.vector cimport vector
......
# mode: run
# tag: cpp, werror
# cython: experimental_cpp_class_def=True
# tag: cpp
from libcpp.vector cimport vector
......
# tag: cpp
# mode: run
# tag: cpp, werror
PYTHON setup.py build_ext --inplace
PYTHON -c "import a; a.test_convert()"
......
# tag: cpp
# mode: run
# tag: cpp, werror
cdef int raise_py_error() except *:
raise TypeError("custom")
......
# tag: cpp
# mode: run
# tag: cpp, werror
cdef int raise_TypeError() except *:
raise TypeError("custom")
......
# tag: cpp
# mode: run
# tag: cpp, werror
from libcpp.vector cimport vector
from cython.operator cimport dereference as deref
......@@ -89,6 +90,6 @@ def test_iteration_in_generator_reassigned():
vint = new vector[int]()
vint.push_back(2)
finally:
del orig_vint
if vint is not orig_vint:
del vint
del orig_vint
# tag: cpp
# mode: run
# tag: cpp, werror
cdef extern from "cpp_namespaces_helper.h" namespace "A":
ctypedef int A_t
......
# tag: cpp
# mode: run
# tag: cpp, werror
from cython.operator cimport dereference as deref
......
# tag: cpp
# mode: run
# tag: cpp, werror
from cython cimport typeof
......
# tag: cpp
# mode: run
# tag: cpp, werror
cdef extern from "vector" namespace "std":
......
# tag: cpp
## Re-enable once our buildbot gcc is upgraded to a less-than-seven year old release.
## distutils: extra_compile_args=-std=c++0x
# mode: run
# tag: cpp, werror
# distutils: extra_compile_args=-std=c++0x
import sys
from libcpp.map cimport map
#from libcpp.unordered_map cimport unordered_map
from libcpp.unordered_map cimport unordered_map
from libcpp.set cimport set as cpp_set
#from libcpp.unordered_set cimport unordered_set
from libcpp.unordered_set cimport unordered_set
from libcpp.string cimport string
from libcpp.pair cimport pair
from libcpp.vector cimport vector
......@@ -162,17 +162,17 @@ def test_set(o):
cdef cpp_set[long] s = o
return s
#def test_unordered_set(o):
# """
# >>> sorted(test_unordered_set([1, 2, 3]))
# [1, 2, 3]
# >>> sorted(test_unordered_set([1, 2, 3, 3]))
# [1, 2, 3]
# >>> type(test_unordered_set([])) is py_set
# True
# """
# cdef unordered_set[long] s = o
# return s
def test_unordered_set(o):
"""
>>> sorted(test_unordered_set([1, 2, 3]))
[1, 2, 3]
>>> sorted(test_unordered_set([1, 2, 3, 3]))
[1, 2, 3]
>>> type(test_unordered_set([])) is py_set
True
"""
cdef unordered_set[long] s = o
return s
def test_map(o):
"""
......@@ -182,13 +182,13 @@ def test_map(o):
cdef map[int, double] m = o
return m
#def test_unordered_map(o):
# """
# >>> test_map({1: 1.0, 2: 0.5, 3: 0.25})
# {1: 1.0, 2: 0.5, 3: 0.25}
# """
# cdef unordered_map[int, double] m = o
# return m
def test_unordered_map(o):
"""
>>> test_map({1: 1.0, 2: 0.5, 3: 0.25})
{1: 1.0, 2: 0.5, 3: 0.25}
"""
cdef unordered_map[int, double] m = o
return m
def test_nested(o):
"""
......
# tag: cpp
# mode: run
# tag: cpp, werror
cimport cython
......
# mode: run
# tag: cpp
# tag: cpp, werror
# cython: c_string_encoding=ascii, c_string_type=unicode
cimport cython
......
# mode: run
# tag: cpp
# tag: cpp, werror
# cython: c_string_encoding=ascii, c_string_type=str
cimport cython
......
# tag: cpp
# mode: run
# tag: cpp, werror
from cython.operator import dereference as deref
from libcpp.pair cimport pair
......
# tag: cpp
# mode: run
# tag: cpp, werror
from cython cimport typeof
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment