summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/logic_constfolding.py
blob: 14afe6111a60045c27b2bca90f66a7dc7869677c (plain) (blame)
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
# tests logical constant folding in parser

def f_true():
    print('f_true')
    return True

def f_false():
    print('f_false')
    return False

print(0 or False)
print(1 or foo)
print(f_false() or 1 or foo)
print(f_false() or 1 or f_true())

print(0 and foo)
print(1 and True)
print(f_true() and 0 and foo)
print(f_true() and 1 and f_false())

print(not 0)
print(not False)
print(not 1)
print(not True)
print(not not 0)
print(not not 1)