summaryrefslogtreecommitdiff
path: root/tests/run/str_char_coercion_T412.pyx
blob: 6a470e2b74b0f6cb456b1f82a88bab58f1e7500e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# ticket: 412

cdef int   i = 'x'
cdef char  c = 'x'
cdef char* s = 'x'

def test_eq():
    """
    >>> test_eq()
    True
    True
    True
    True
    """
    print i ==  'x'
    print i == c'x'
    print c ==  'x'
    print c == c'x'
#    print s ==  'x' # error
#    print s == c'x' # error

def test_cascaded_eq():
    """
    >>> test_cascaded_eq()
    True
    True
    True
    True
    True
    True
    True
    True
    """
    print  'x' == i ==  'x'
    print  'x' == i == c'x'
    print c'x' == i ==  'x'
    print c'x' == i == c'x'

    print  'x' == c ==  'x'
    print  'x' == c == c'x'
    print c'x' == c ==  'x'
    print c'x' == c == c'x'

def test_cascaded_ineq():
    """
    >>> test_cascaded_ineq()
    True
    True
    True
    True
    True
    True
    True
    True
    """
    print  'a' <= i <=  'z'
    print  'a' <= i <= c'z'
    print c'a' <= i <=  'z'
    print c'a' <= i <= c'z'

    print  'a' <= c <=  'z'
    print  'a' <= c <= c'z'
    print c'a' <= c <=  'z'
    print c'a' <= c <= c'z'

def test_long_ineq():
    """
    >>> test_long_ineq()
    True
    """
    print 'a' < 'b' < 'c' < 'd' < c < 'y' < 'z'

def test_long_ineq_py():
    """
    >>> test_long_ineq_py()
    True
    True
    """
    print 'abcdef' < 'b' < 'c' < 'd' < 'y' < 'z'
    print 'a' < 'b' < 'cde' < 'd' < 'y' < 'z'