1# mode: run
2# tag: cpp, werror
3
4cdef extern from "cpp_namespaces_helper.h" namespace "A":
5    ctypedef int A_t
6    cdef struct S:
7        double x
8        A_t k
9    A_t A_func(A_t first, A_t)
10    cdef void f(A_t)
11
12cdef extern from "cpp_namespaces_helper.h" namespace "outer":
13    int outer_value
14
15cdef extern from "cpp_namespaces_helper.h" namespace "outer::inner":
16    int inner_value
17
18def test_function(x, y):
19    """
20    >>> test_function(1, 2)
21    3
22    >>> test_function(9, 16)
23    25
24    """
25    return A_func(x, y)
26
27def test_nested():
28    """
29    >>> test_nested()
30    10
31    100
32    """
33    print outer_value
34    print inner_value
35
36def test_typedef(A_t a):
37    """
38    >>> test_typedef(3)
39    3
40    """
41    return a
42
43def test_convert_struct(S s):
44    """
45    >>> py_value = {'x': 3.5, 'k': 10}
46    >>> test_convert_struct(py_value) == py_value
47    True
48    """
49    return s
50