def test_add_cells_at_same_slot_offset(sim_engine):
    sim_engine = sim_engine()  # need for log

    slotframe = SlotFrame(None, 1, 101)

    cell_1 = Cell(1, 5, [d.CELLOPTION_TX], 'test_mac_addr_1')
    cell_2 = Cell(1, 5, [d.CELLOPTION_RX], 'test_mac_addr_2')

    assert slotframe.get_cells_by_slot_offset(1) == []

    slotframe.add(cell_1)
    slotframe.add(cell_2)

    assert slotframe.get_cells_by_slot_offset(1) == [cell_1, cell_2]
    assert slotframe.get_cells_by_mac_addr('test_mac_addr_1') == [cell_1]
    assert slotframe.get_cells_by_mac_addr('test_mac_addr_2') == [cell_2]

    slotframe.delete(cell_1)

    assert slotframe.get_cells_by_mac_addr('test_mac_addr_1') == []
    assert slotframe.get_cells_by_mac_addr('test_mac_addr_2') == [cell_2]

    slotframe.delete(cell_2)

    assert slotframe.get_cells_by_mac_addr('test_mac_addr_1') == []
    assert slotframe.get_cells_by_mac_addr('test_mac_addr_2') == []
Ejemplo n.º 2
0
def test_delete_cell():
    neighbor_mac_addr = 'test_mac_addr'
    slotframe = SlotFrame(101)
    cell = Cell(0, 0, all_options_on, neighbor_mac_addr)

    assert slotframe.get_cells_by_mac_addr(neighbor_mac_addr) == []
    assert slotframe.get_cells_by_slot_offset(0) == []

    slotframe.add(cell)

    assert slotframe.get_cells_by_mac_addr(neighbor_mac_addr) == [cell]
    assert slotframe.get_cells_by_slot_offset(0) == [cell]

    slotframe.delete(cell)

    assert slotframe.get_cells_by_mac_addr(neighbor_mac_addr) == []
    assert slotframe.get_cells_by_slot_offset(0) == []
def test_delete_cell(sim_engine):
    sim_engine = sim_engine()  # need for log

    neighbor_mac_addr = 'test_mac_addr'
    slotframe = SlotFrame(None, 1, 101)
    cell = Cell(0, 0, all_options_on, neighbor_mac_addr)

    assert slotframe.get_cells_by_mac_addr(neighbor_mac_addr) == []
    assert slotframe.get_cells_by_slot_offset(0) == []

    slotframe.add(cell)

    assert slotframe.get_cells_by_mac_addr(neighbor_mac_addr) == [cell]
    assert slotframe.get_cells_by_slot_offset(0) == [cell]

    slotframe.delete(cell)

    assert slotframe.get_cells_by_mac_addr(neighbor_mac_addr) == []
    assert slotframe.get_cells_by_slot_offset(0) == []