Ejemplo n.º 1
0
def test_inner_1_not_existing():
    with patch("y_2015.day7.WIRING", defaultdict(Container)):
        assert (inner_1([
            "x -> y",
            "123 -> x",
        ]) == {
            "x": 123,
            "y": 123
        })
Ejemplo n.º 2
0
def test_inner_1_value():
    with patch("y_2015.day7.WIRING", defaultdict(Container)):
        assert (inner_1([
            "123 -> x",
            "456 -> y",
        ]) == {
            "x": 123,
            "y": 456
        })
Ejemplo n.º 3
0
def test_inner_1():
    with patch("y_2015.day7.WIRING", defaultdict(Container)):
        assert inner_1([
            "123 -> x",
            "456 -> y",
            "x AND y -> d",
            "x OR y -> e",
            "x LSHIFT 2 -> f",
            "y RSHIFT 2 -> g",
            "NOT x -> h",
            "NOT y -> i",
        ]) == {
            "d": 72,
            "e": 507,
            "f": 492,
            "g": 114,
            "h": 65412,
            "i": 65079,
            "x": 123,
            "y": 456,
        }
Ejemplo n.º 4
0
def test_inner_1_unary():
    with patch("y_2015.day7.WIRING", defaultdict(Container)):
        assert inner_1(["NOT 123 -> h"]) == {"h": 65412}
Ejemplo n.º 5
0
def test_inner_1_binary():
    with patch("y_2015.day7.WIRING", defaultdict(Container)):
        assert inner_1(["123 AND 456 -> d"]) == {"d": 72}
        assert inner_1(["123 OR 456 -> d"]) == {"d": 507}
        assert inner_1(["123 LSHIFT 2 -> d"]) == {"d": 492}
        assert inner_1(["456 RSHIFT 2 -> d"]) == {"d": 114}
Ejemplo n.º 6
0
def test_inner_1_direct():
    with patch("y_2015.day7.WIRING", defaultdict(Container)):
        assert inner_1(["123 -> x", "x -> y"]) == {"x": 123, "y": 123}