Пример #1
0
def pytestcase_seek_event_future(dataset_dir):
    """Tests seeking at a define position (after n events)"""
    filename = os.path.join(dataset_dir,
                            "metavision_core", "event_io", "recording_td.dat")
    record = EventDatReader(filename)
    assert record.current_event_index() == 0
    assert record.done is False
    assert record.current_time == 0
    record.seek_event(13)
    assert record.current_event_index() == 13
    assert record.done is False
    # current_time should be the timestamp of the fourteenth event
    assert record.current_time == 93
Пример #2
0
def pytestcase_seek_event_negative(dataset_dir):
    """Tests seeking in the file after a negative number of events"""
    filename = os.path.join(dataset_dir,
                            "metavision_core", "event_io", "recording_td.dat")
    record = EventDatReader(filename)
    assert record.current_event_index() == 0
    assert record.done is False
    assert record.current_time == 0
    record.load_n_events(18)
    assert record.current_event_index() == 18
    assert record.done is False
    # current_time should be the timestamp of the nineteenth event
    assert record.current_time == 138
    record.seek_event(-4)
    assert record.current_event_index() == 0
    assert record.done is False
    assert record.current_time == 0
Пример #3
0
def pytestcase_seek_event_past(dataset_dir):
    """Tests seeking at a define position (after n events)"""
    filename = os.path.join(dataset_dir,
                            "metavision_core", "event_io", "recording_td.dat")
    record = EventDatReader(filename)
    assert record.current_event_index() == 0
    assert record.done is False
    assert record.current_time == 0
    record.load_n_events(18)
    assert record.current_event_index() == 18
    assert record.done is False
    # current_time should be the timestamp of the nineteenth event
    assert record.current_time == 138
    record.seek_event(15)
    assert record.current_event_index() == 15
    assert record.done is False
    # current_time should be the timestamp of the sixteenth event
    assert record.current_time == 121