-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathtest.py
More file actions
93 lines (80 loc) · 2.35 KB
/
test.py
File metadata and controls
93 lines (80 loc) · 2.35 KB
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
def f(w, x, y, z):
if x < 0 or z < 0:
raise Exception()
if x >= 0: # Useless test due to x < 0 being false
y += 1
if z >= 0: # Useless test due to z < 0 being false
y += 1
while w >= 0:
if y < 10:
z += 1
if y == 15: # Useless test due to y < 10 being true
z += 1
elif y > 7: # Useless test
y -= 1
if y < 10:
y += 1
if y < 12: #A useless test, but too complex to infer.
pass
if not y != 5 and z > 0:
w = 0 if y < 3 else 1 #Useless test as y is 5
def g(w, x, y, z):
if w < x or y < z+2:
raise Exception()
if w >= x: # Useless test due to w < x being false
pass
if cond:
if z > y-2: # Useless test due to y < z+2 being false
y += 1
else:
if z >= y-2: # Not a useless test.
y += 1
#ODASA-5643
def validate_series(start, end):
# Check that the values 'make sense'
if end < start:
raise click.BadParameter('The start value must be less than the end value.')
if start == end:
raise click.BadParameter('The start value and the end value most not be the same.')
return start, end
#Overflow
def medium1(x, y):
if x + 1000000000000000 > y + 1000000000000000:
return
if x > y: # Redundant
pass
def medium2(x, y):
if x + 1000000000000000 > y + 1000000000000001:
return
if x > y: # Not redundant
pass
def big1(x, y):
if x + 10000000000000000 > y + 10000000000000000:
return
if x > y: # Redundant (but cannot be sure due to FP rounding errors)
pass
def big2(x, y):
if x + 10000000000000000 > y + 10000000000000001:
return
if x > y: # Not redundant (but might appear to be due to FP rounding errors)
pass
def odasa6782_v1(protocol):
if protocol < 0:
protocol = HIGHEST_PROTOCOL
elif not 0 <= protocol:
raise ValueError()
def odasa6782_v2(protocol):
if protocol < 0:
protocol = HIGHEST_PROTOCOL
elif not 0 <= protocol <= HIGHEST_PROTOCOL:
raise ValueError()
def odasa6782_v3(protocol):
if protocol < 0:
protocol = HIGHEST_PROTOCOL
elif 0 <= protocol <= HIGHEST_PROTOCOL:
pass
else:
raise ValueError()
#Inverted complex test
if not (0 > stop >= step) and stop < 0:
pass