Exemple #1
0
def test_hold_army_002():
    """ Tests hold army """
    raw_order = 'A ABC H'
    order_str = ''
    order_dict = {}
    order_from_string = Order(raw_order)
    order_from_dict = Order(order_dict)

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)
Exemple #2
0
def test_move_army_001():
    """ Tests move army """
    raw_order = 'A YOR - LON'
    order_str = 'A YOR - LON'
    order_dict = {
        'terrID': 4,
        'unitType': 'Army',
        'type': 'Move',
        'toTerrID': 6,
        'fromTerrID': '',
        'viaConvoy': 'No'
    }
    order_from_string = Order(raw_order)
    order_from_dict = Order(order_dict)

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)
Exemple #3
0
def test_hold_fleet_001():
    """ Tests hold fleet """
    raw_order = 'F LON H'
    order_str = 'F LON H'
    order_dict = {
        'terrID': 6,
        'unitType': 'Fleet',
        'type': 'Hold',
        'toTerrID': '',
        'fromTerrID': '',
        'viaConvoy': ''
    }
    order_from_string = Order(raw_order)
    order_from_dict = Order(order_dict)

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)
Exemple #4
0
def test_disband_fleet_002():
    """ Tests disband fleet """
    raw_order = 'F BRE D'
    order_str = 'F BRE D'
    order_dict = {
        'terrID': 46,
        'unitType': 'Fleet',
        'type': 'Destroy',
        'toTerrID': 46,
        'fromTerrID': '',
        'viaConvoy': ''
    }
    order_from_string = Order(raw_order, phase_type='A')
    order_from_dict = Order(order_dict, phase_type='A')

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)
Exemple #5
0
def test_disband_fleet_coast_001():
    """ Tests disband fleet (retreats phase) """
    raw_order = 'F SPA/NC D'
    order_str = 'F SPA/NC D'
    order_dict = {
        'terrID': 76,
        'unitType': 'Fleet',
        'type': 'Disband',
        'toTerrID': '',
        'fromTerrID': '',
        'viaConvoy': ''
    }
    order_from_string = Order(raw_order, phase_type='R')
    order_from_dict = Order(order_dict, phase_type='R')

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)
Exemple #6
0
def test_build_army_001():
    """ Tests build army """
    raw_order = 'A PAR B'
    order_str = 'A PAR B'
    order_dict = {
        'terrID': 47,
        'unitType': 'Army',
        'type': 'Build Army',
        'toTerrID': 47,
        'fromTerrID': '',
        'viaConvoy': ''
    }
    order_from_string = Order(raw_order)
    order_from_dict = Order(order_dict)

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)
Exemple #7
0
def test_retreat_fleet_001():
    """ Tests retreat fleet """
    raw_order = 'F BRE R SPA/SC'
    order_str = 'F BRE R SPA/SC'
    order_dict = {
        'terrID': 46,
        'unitType': 'Fleet',
        'type': 'Retreat',
        'toTerrID': 77,
        'fromTerrID': '',
        'viaConvoy': ''
    }
    order_from_string = Order(raw_order)
    order_from_dict = Order(order_dict)

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)
Exemple #8
0
def test_disband_army_001():
    """ Tests disband army """
    raw_order = 'A PAR D'
    order_str = 'A PAR D'
    order_dict = {
        'terrID': 47,
        'unitType': 'Army',
        'type': 'Disband',
        'toTerrID': '',
        'fromTerrID': '',
        'viaConvoy': ''
    }
    order_from_string = Order(raw_order, phase_type='R')
    order_from_dict = Order(order_dict, phase_type='R')

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)
Exemple #9
0
def test_retreat_army_002():
    """ Tests retreat army """
    raw_order = 'A PAR - LON'
    order_str = 'A PAR R LON'
    order_dict = {
        'terrID': 47,
        'unitType': 'Army',
        'type': 'Retreat',
        'toTerrID': 6,
        'fromTerrID': '',
        'viaConvoy': ''
    }
    order_from_string = Order(raw_order, phase_type='R')
    order_from_dict = Order(order_dict, phase_type='R')

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)
Exemple #10
0
def test_convoy_001():
    """ Tests convoy """
    raw_order = 'F MAO C A PAR - LON'
    order_str = 'F MAO C A PAR - LON'
    order_dict = {
        'terrID': 61,
        'unitType': 'Fleet',
        'type': 'Convoy',
        'toTerrID': 6,
        'fromTerrID': 47,
        'viaConvoy': ''
    }
    order_from_string = Order(raw_order)
    order_from_dict = Order(order_dict)

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)
Exemple #11
0
def test_support_move_002():
    """ Tests support move """
    raw_order = 'F MAO S A PAR - BRE'
    order_str = 'F MAO S PAR - BRE'
    order_dict = {
        'terrID': 61,
        'unitType': 'Fleet',
        'type': 'Support move',
        'toTerrID': 46,
        'fromTerrID': 47,
        'viaConvoy': ''
    }
    order_from_string = Order(raw_order)
    order_from_dict = Order(order_dict)

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)
Exemple #12
0
def test_support_hold_001():
    """ Tests for support hold """
    raw_order = 'A PAR S F BRE'
    order_str = 'A PAR S BRE'
    order_dict = {
        'terrID': 47,
        'unitType': 'Army',
        'type': 'Support hold',
        'toTerrID': 46,
        'fromTerrID': '',
        'viaConvoy': ''
    }
    order_from_string = Order(raw_order)
    order_from_dict = Order(order_dict)

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)
Exemple #13
0
def test_move_fleet_001():
    """ Tests move fleet """
    raw_order = 'F BRE - MAO'
    order_str = 'F BRE - MAO'
    order_dict = {
        'terrID': 46,
        'unitType': 'Fleet',
        'type': 'Move',
        'toTerrID': 61,
        'fromTerrID': '',
        'viaConvoy': 'No'
    }
    order_from_string = Order(raw_order)
    order_from_dict = Order(order_dict)

    # Validating
    assert order_from_string.to_string() == order_str
    assert compare_dicts(order_from_string.to_dict(), order_dict)
    assert order_from_dict.to_string() == order_str
    assert compare_dicts(order_from_dict.to_dict(), order_dict)