Пример #1
0
def test_move_round_trip():
    moves = (Move('a1',
                  'b4',
                  move_type=enums.MoveType.JUMP,
                  move_variant=enums.MoveVariant.BASIC),
             Move('a1',
                  'b4',
                  move_type=enums.MoveType.JUMP,
                  move_variant=enums.MoveVariant.BASIC,
                  measurement=0),
             Move('a1',
                  'b4',
                  move_type=enums.MoveType.JUMP,
                  move_variant=enums.MoveVariant.BASIC,
                  measurement=1),
             Move('a1',
                  'b4',
                  move_type=enums.MoveType.JUMP,
                  move_variant=enums.MoveVariant.BASIC,
                  measurement=1),
             Move('c8',
                  'g4',
                  target2='f5',
                  move_type=enums.MoveType.SPLIT_SLIDE,
                  move_variant=enums.MoveVariant.BASIC,
                  measurement=0))
    for m in moves:
        assert m == Move.from_string(m.to_string(include_type=True))
Пример #2
0
def test_from_string():
    assert Move.from_string("a1b4:JUMP:BASIC") == Move(
        "a1",
        "b4",
        move_type=enums.MoveType.JUMP,
        move_variant=enums.MoveVariant.BASIC)
    assert Move.from_string("a1b4.m0:JUMP:BASIC") == Move(
        "a1",
        "b4",
        move_type=enums.MoveType.JUMP,
        move_variant=enums.MoveVariant.BASIC,
        measurement=0,
    )
    assert Move.from_string("a1b4.m1:JUMP:BASIC") == Move(
        "a1",
        "b4",
        move_type=enums.MoveType.JUMP,
        move_variant=enums.MoveVariant.BASIC,
        measurement=1,
    )
    assert Move.from_string("a1b4.m1:JUMP:BASIC") == Move(
        "a1",
        "b4",
        move_type=enums.MoveType.JUMP,
        move_variant=enums.MoveVariant.BASIC,
        measurement=1,
    )
    assert Move.from_string("c8^g4f5.m0:SPLIT_SLIDE:BASIC") == Move(
        "c8",
        "g4",
        target2="f5",
        move_type=enums.MoveType.SPLIT_SLIDE,
        move_variant=enums.MoveVariant.BASIC,
        measurement=0,
    )

    assert Move.from_string("a1^a4d1:SPLIT_SLIDE:BASIC") == Move(
        "a1",
        "a4",
        target2="d1",
        move_type=enums.MoveType.SPLIT_SLIDE,
        move_variant=enums.MoveVariant.BASIC,
    )
    assert Move.from_string("c3^c4c5:SPLIT_JUMP:BASIC") == Move(
        "c3",
        "c4",
        target2="c5",
        move_type=enums.MoveType.SPLIT_JUMP,
        move_variant=enums.MoveVariant.BASIC,
    )
    assert Move.from_string("a4d4^d1:MERGE_SLIDE:BASIC") == Move(
        "a4",
        "d1",
        source2="d4",
        move_type=enums.MoveType.MERGE_SLIDE,
        move_variant=enums.MoveVariant.BASIC,
    )
Пример #3
0
def test_string_round_trip():
    move_strings = (
        'a1b4:JUMP:BASIC',
        'a1b4.m0:JUMP:BASIC',
        'a1b4.m1:JUMP:BASIC',
        'a1b4.m1:JUMP:BASIC',
        'c8^g4f5.m0:SPLIT_SLIDE:BASIC',
    )
    for s in move_strings:
        assert s == Move.from_string(s).to_string(include_type=True)
Пример #4
0
def test_from_string():
    assert Move.from_string('a1b4:JUMP:BASIC') == Move(
        'a1',
        'b4',
        move_type=enums.MoveType.JUMP,
        move_variant=enums.MoveVariant.BASIC)
    assert Move.from_string('a1b4.m0:JUMP:BASIC') == Move(
        'a1',
        'b4',
        move_type=enums.MoveType.JUMP,
        move_variant=enums.MoveVariant.BASIC,
        measurement=0)
    assert Move.from_string('a1b4.m1:JUMP:BASIC') == Move(
        'a1',
        'b4',
        move_type=enums.MoveType.JUMP,
        move_variant=enums.MoveVariant.BASIC,
        measurement=1)
    assert Move.from_string('a1b4.m1:JUMP:BASIC') == Move(
        'a1',
        'b4',
        move_type=enums.MoveType.JUMP,
        move_variant=enums.MoveVariant.BASIC,
        measurement=1)
    assert Move.from_string('c8^g4f5.m0:SPLIT_SLIDE:BASIC') == Move(
        'c8',
        'g4',
        target2='f5',
        move_type=enums.MoveType.SPLIT_SLIDE,
        move_variant=enums.MoveVariant.BASIC,
        measurement=0)

    assert Move.from_string('a1^a4d1:SPLIT_SLIDE:BASIC') == Move(
        'a1',
        'a4',
        target2='d1',
        move_type=enums.MoveType.SPLIT_SLIDE,
        move_variant=enums.MoveVariant.BASIC)
    assert Move.from_string('c3^c4c5:SPLIT_JUMP:BASIC') == Move(
        'c3',
        'c4',
        target2='c5',
        move_type=enums.MoveType.SPLIT_JUMP,
        move_variant=enums.MoveVariant.BASIC)
    assert Move.from_string('a4d4^d1:MERGE_SLIDE:BASIC') == Move(
        'a4',
        'd1',
        source2='d4',
        move_type=enums.MoveType.MERGE_SLIDE,
        move_variant=enums.MoveVariant.BASIC)
Пример #5
0
def test_move_round_trip():
    moves = (
        Move(
            "a1",
            "b4",
            move_type=enums.MoveType.JUMP,
            move_variant=enums.MoveVariant.BASIC,
        ),
        Move(
            "a1",
            "b4",
            move_type=enums.MoveType.JUMP,
            move_variant=enums.MoveVariant.BASIC,
            measurement=0,
        ),
        Move(
            "a1",
            "b4",
            move_type=enums.MoveType.JUMP,
            move_variant=enums.MoveVariant.BASIC,
            measurement=1,
        ),
        Move(
            "a1",
            "b4",
            move_type=enums.MoveType.JUMP,
            move_variant=enums.MoveVariant.BASIC,
            measurement=1,
        ),
        Move(
            "c8",
            "g4",
            target2="f5",
            move_type=enums.MoveType.SPLIT_SLIDE,
            move_variant=enums.MoveVariant.BASIC,
            measurement=0,
        ),
    )
    for m in moves:
        assert m == Move.from_string(m.to_string(include_type=True))