コード例 #1
0
ファイル: test.py プロジェクト: Fiddle-N/advent-of-code-2020
def test_simple_with_mode_addition_first():
    input_str = '1 + 2 * 3 + 4 * 5 + 6'
    assert process.process(input_str, mode='addition_first') == 231
コード例 #2
0
ファイル: test.py プロジェクト: Fiddle-N/advent-of-code-2020
def test_nested_4_with_mode_same_precedence():
    input_str = '((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2'
    assert process.process(input_str, mode='same_precedence') == 13632
コード例 #3
0
ファイル: test.py プロジェクト: Fiddle-N/advent-of-code-2020
def test_nested_4_with_mode_addition_first():
    input_str = '((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2'
    assert process.process(input_str, mode='addition_first') == 23340
コード例 #4
0
ファイル: test.py プロジェクト: Fiddle-N/advent-of-code-2020
def test_nested_3_with_mode_same_precedence():
    input_str = '5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4))'
    assert process.process(input_str, mode='same_precedence') == 12240
コード例 #5
0
ファイル: test.py プロジェクト: Fiddle-N/advent-of-code-2020
def test_nested_3_with_mode_addition_first():
    input_str = '5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4))'
    assert process.process(input_str, mode='addition_first') == 669060
コード例 #6
0
ファイル: test.py プロジェクト: Fiddle-N/advent-of-code-2020
def test_nested_2_with_mode_same_precedence():
    input_str = '5 + (8 * 3 + 9 + 3 * 4 * 3)'
    assert process.process(input_str, mode='same_precedence') == 437
コード例 #7
0
ファイル: test.py プロジェクト: Fiddle-N/advent-of-code-2020
def test_nested_2_with_mode_addition_first():
    input_str = '5 + (8 * 3 + 9 + 3 * 4 * 3)'
    assert process.process(input_str, mode='addition_first') == 1445
コード例 #8
0
ファイル: test.py プロジェクト: Fiddle-N/advent-of-code-2020
def test_simple_with_mode_same_precedence():
    input_str = '1 + 2 * 3 + 4 * 5 + 6'
    assert process.process(input_str, mode='same_precedence') == 71
コード例 #9
0
ファイル: test.py プロジェクト: Fiddle-N/advent-of-code-2020
def test_nested_1_with_mode_addition_first():
    input_str = '2 * 3 + (4 * 5)'
    assert process.process(input_str, mode='addition_first') == 46
コード例 #10
0
ファイル: test.py プロジェクト: Fiddle-N/advent-of-code-2020
def test_nested_1_with_mode_same_precedence():
    input_str = '2 * 3 + (4 * 5)'
    assert process.process(input_str, mode='same_precedence') == 26
コード例 #11
0
ファイル: test.py プロジェクト: Fiddle-N/advent-of-code-2020
def test_nested_0_with_mode_addition_first():
    input_str = '1 + (2 * 3) + (4 * (5 + 6))'
    assert process.process(input_str, mode='addition_first') == 51
コード例 #12
0
ファイル: test.py プロジェクト: Fiddle-N/advent-of-code-2020
def test_nested_0_with_mode_same_precedence():
    input_str = '1 + (2 * 3) + (4 * (5 + 6))'
    assert process.process(input_str, mode='same_precedence') == 51