-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest_bool.py
41 lines (32 loc) · 938 Bytes
/
test_bool.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
40
41
import pytest
from lambdas import AND, OR, TRUE, FALSE, NOT, XOR
@pytest.mark.parametrize('left, right, expected', [
(FALSE, FALSE, FALSE),
(FALSE, TRUE, FALSE),
(TRUE, FALSE, FALSE),
(TRUE, TRUE, TRUE),
])
def test_and(left, right, expected):
assert AND(left)(right) is expected
@pytest.mark.parametrize('left, right, expected', [
(FALSE, FALSE, FALSE),
(FALSE, TRUE, TRUE),
(TRUE, FALSE, TRUE),
(TRUE, TRUE, TRUE),
])
def test_or(left, right, expected):
assert OR(left)(right) is expected
@pytest.mark.parametrize('given, expected', [
(FALSE, TRUE),
(TRUE, FALSE),
])
def test_not(given, expected):
assert NOT(given) is expected
@pytest.mark.parametrize('left, right, expected', [
(FALSE, FALSE, FALSE),
(FALSE, TRUE, TRUE),
(TRUE, FALSE, TRUE),
(TRUE, TRUE, FALSE),
])
def test_xor(left, right, expected):
assert XOR(left)(right) is expected