예제 #1
0
def test_part1():
    ans = part1(text)
    print("Part 1 answer:", ans)
    assert ans == 7

    # Real test
    assert part1() == 1451
예제 #2
0
def test_part1():
    assert solution.part1(["#1 @ 1,3: 4x4", "#2 @ 3,1: 4x4",
                           "#3 @ 5,5: 2x2"]) == 4

    assert solution.part1(["#1 @ 1,3: 4x4", "#2 @ 3,1: 4x4",
                           "#3 @ 3,3: 1x1"]) == 4

    assert solution.part1(["#1 @ 1,3: 4x4", "#2 @ 3,1: 4x4",
                           "#3 @ 1,3: 1x2"]) == 6
예제 #3
0
def test_part1():
    """Test part1 function"""
    input_instructions = [
        ("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X", 8, 11),
        ("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X", 7, 101),
        ("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X", 8, 0),
    ]

    assert part1(input_instructions) == 165
예제 #4
0
def test_examples():
    examples = {
        '(())'      : 0,
        '()()'      : 0,
        '((('       : 3,
        '(()(()('   : 3,
        '))((((('   : 3,
        '())'       : -1,
        '))('       : -1,
        ')))'       : -3,
        ')())())'   : -3
    }
    for key in examples:
        assert s.part1(key) == examples[key]
예제 #5
0
 def test_it(self):
     _, _, wanted = part1(self.input)
     self.assertEqual(wanted, self.output)
예제 #6
0
 def test_it(self):
     guards, sleeptime, _ = part1(self.input)
     self.assertEqual(part2(guards, sleeptime), self.output)
예제 #7
0
def test_part1():
    assert part1(example1) == 2
예제 #8
0
def test_part1(test_input=test_input):
    """Test part 1 function"""
    assert part1(test_input, window=5) == 127
예제 #9
0
def test_solve():
    """Test with sample input."""
    assert 4512 == solution.part1('input2')
예제 #10
0
def test_part1(rules=test_rules, msgs=test_msgs, expected=2):
    """Test part1 function"""
    assert part1(rules, msgs) == expected
예제 #11
0
def test_solution1():
    assert solution.part1(
        ["abcdef", "bababc", "abbcde", "abcccd", "aabcdd", "abcdee",
         "ababab"]) == 12
예제 #12
0
def test_part1():
    assert part1(ex) == 5
예제 #13
0
def test_part1():
    test_result = 150
    out = part1(test_input)
    print(out)
    assert (out == test_result)
예제 #14
0
 def test_it(self):
     overlap, fabric = part1(self.input)
     self.assertEqual(part2(self.input, fabric), self.output)
예제 #15
0
def test_part1():
    """Test part 1"""
    assert part1(directions=test_input, start_direction="E") == 25
예제 #16
0
 def test_it(self):
     self.assertEqual(part1(self.input), self.output)
예제 #17
0
def test_part1():
    """Test part1 function"""
    assert part1(earliest_time=939,
                 bus_ids=["7", "13", "x", "x", "59", "x", "31", "19"]) == 295
예제 #18
0
def test_part1():
    assert part1(case1) == 7 * 5
    assert part1(case2) == 22 * 10
예제 #19
0
def test_part1():
    assert part1(text) == 198
예제 #20
0
def test_part1(test_input):
    """Test part1 function"""
    assert part1(test_input[0], test_input[2]) == 71
예제 #21
0
def test_solution1():
    assert solution.part1(test_input) == 10*24
예제 #22
0
def test_part1(input_adapters, expected):
    """Test part 1 function"""
    sorted_adapters = sorted(input_adapters)
    adapters = [0] + sorted_adapters + [sorted_adapters[-1] + 3]
    assert part1(adapters) == expected
예제 #23
0
def test_part1():
    assert solution.part1([1, -1]) == 0