File: irbuild-str.test

package info (click to toggle)
mypy 0.812-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 18,596 kB
  • sloc: python: 74,869; cpp: 11,212; ansic: 3,935; makefile: 238; sh: 13
file content (105 lines) | stat: -rw-r--r-- 2,060 bytes parent folder | download
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
[case testStrSplit]
from typing import Optional, List

def do_split(s: str, sep: Optional[str] = None, max_split: Optional[int] = None) -> List[str]:
    if sep is not None:
        if max_split is not None:
            return s.split(sep, max_split)
        else:
            return s.split(sep)
    return s.split()
[out]
def do_split(s, sep, max_split):
    s :: str
    sep :: union[str, None]
    max_split :: union[int, None]
    r0, r1, r2 :: object
    r3, r4 :: bit
    r5 :: object
    r6, r7 :: bit
    r8 :: str
    r9 :: int
    r10 :: list
    r11 :: str
    r12, r13 :: list
L0:
    if is_error(sep) goto L1 else goto L2
L1:
    r0 = box(None, 1)
    sep = r0
L2:
    if is_error(max_split) goto L3 else goto L4
L3:
    r1 = box(None, 1)
    max_split = r1
L4:
    r2 = box(None, 1)
    r3 = sep == r2
    r4 = r3 ^ 1
    if r4 goto L5 else goto L9 :: bool
L5:
    r5 = box(None, 1)
    r6 = max_split == r5
    r7 = r6 ^ 1
    if r7 goto L6 else goto L7 :: bool
L6:
    r8 = cast(str, sep)
    r9 = unbox(int, max_split)
    r10 = CPyStr_Split(s, r8, r9)
    return r10
L7:
    r11 = cast(str, sep)
    r12 = PyUnicode_Split(s, r11, -1)
    return r12
L8:
L9:
    r13 = PyUnicode_Split(s, 0, -1)
    return r13

[case testStrEquality]
def eq(x: str, y: str) -> bool:
    return x == y

def neq(x: str, y: str) -> bool:
    return x != y

[out]
def eq(x, y):
    x, y :: str
    r0 :: int32
    r1 :: bit
    r2 :: object
    r3, r4, r5 :: bit
L0:
    r0 = PyUnicode_Compare(x, y)
    r1 = r0 == -1
    if r1 goto L1 else goto L3 :: bool
L1:
    r2 = PyErr_Occurred()
    r3 = r2 != 0
    if r3 goto L2 else goto L3 :: bool
L2:
    r4 = CPy_KeepPropagating()
L3:
    r5 = r0 == 0
    return r5
def neq(x, y):
    x, y :: str
    r0 :: int32
    r1 :: bit
    r2 :: object
    r3, r4, r5 :: bit
L0:
    r0 = PyUnicode_Compare(x, y)
    r1 = r0 == -1
    if r1 goto L1 else goto L3 :: bool
L1:
    r2 = PyErr_Occurred()
    r3 = r2 != 0
    if r3 goto L2 else goto L3 :: bool
L2:
    r4 = CPy_KeepPropagating()
L3:
    r5 = r0 != 0
    return r5