-
Notifications
You must be signed in to change notification settings - Fork 0
/
t2.py
39 lines (30 loc) · 1016 Bytes
/
t2.py
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
# this testcase looks like it's reversible, but it's not
# this testcase is unfortunately only really interesting for the 'solve' command
# because detecting one exception suffices to yield 'Unsat' when it comes to 'syn'
# whereas we can make sure that all exceptions are detected correctly through
# giving different output values for the 'solve' command
def f(x1, x2):
if x1 >= 750:
# raises a ValueError
x1, x2 = x1, x2, 5
return x1, x2, 0
if x1 >= 500:
# raises a ValueError
x1, x2, k = x1, x2
return x1, x2, 1
if x1 >= 250:
# raises a NameError
x1 = x1 + k
return x1, x2, 2
if x1 > 0:
# clearly irreversible
return 0, 0, 3
return x1, x2, 3
if x1 == 0:
# raises ZeroDivisionError
k = x1/x1
return x1, x2, 4
# the only reversible path
return x1, x2, 5
def f_inv(y1, y2, y3):
return unknown_choice(y1, y2, y3), unknown_choice(y1, y2, y3)