Ejemplo n.º 1
0
def test_points_in_range_performance(performance_tolerance):
    result = time_function(generate_points, (43.084163, -89.324808), 2.0, 0.1)
    assert result.execution_ms < 5 * performance_tolerance

    result = time_function(generate_points, (43.084163, -89.324808), 0.3, 0.1)
    assert result.execution_ms < 2.5 * performance_tolerance

    result = time_function(generate_points, (43.084163, -89.324808), 0.2, 0.1)
    assert result.execution_ms < 1.5 * performance_tolerance

    result = time_function(generate_points, (43.084163, -89.324808), 0.01, 0.1)
    assert result.execution_ms < 1.5 * performance_tolerance
Ejemplo n.º 2
0
def test_offset_performance(performance_tolerance):
    result = time_function(offset, (43.073746, -89.406702), 0.1, 90, count=1000)
    assert result.execution_ms < 3 * performance_tolerance  # Expected 1 or 2 ms

    returned_coord = result.return_[0]
    assert len(returned_coord) == 2
    assert isinstance(returned_coord[0], float)
    assert isinstance(returned_coord[1], float)
Ejemplo n.º 3
0
def test_closest_stop_performance(performance_tolerance):
    """Test if the performance of getting the closest stops is OK."""
    # In Cottage Grove, very distant from the bus stops (unusual case)
    result = time_function(mmt_stop_controller.find_closest_stop, 43.086601, -89.208467, count=1000)
    # Expected to be 1300~1500 ms / 2000 ms on Github Actions
    assert result.execution_ms < 2000 * performance_tolerance

    # On Reddan Soccer Park, comparatively distant from the bus stops
    result = time_function(mmt_stop_controller.find_closest_stop, 43.006027, -89.524661, count=1000)
    # Expected to be 1000 ms / 1500~1700 ms on Github Actions
    assert result.execution_ms < 1500 * performance_tolerance

    # In UW Campus, has a stop very close to this point
    result = time_function(mmt_stop_controller.find_closest_stop, 43.084163, -89.324808, count=1000)
    # Expected to be 80~110 ms
    assert result.execution_ms < 250 * performance_tolerance

    # In NW of Lake Monona, on Walgreens, has a stop very close to this point
    result = time_function(mmt_stop_controller.find_closest_stop, 43.073746, -89.406702, count=1000)
    # Expected to be 90~130 ms
    assert result.execution_ms < 220 * performance_tolerance
Ejemplo n.º 4
0
def test_points_in_range():
    result = time_function(generate_points, (43.084163, -89.324808), 2.0, 0.1)
    assert len(result.return_) == 1681
    for lat, lon in result.return_:
        assert isinstance(lat, float)
        assert isinstance(lon, float)

    result = time_function(generate_points, (43.084163, -89.324808), 0.3, 0.1)
    assert len(result.return_) == 49
    for lat, lon in result.return_:
        assert isinstance(lat, float)
        assert isinstance(lon, float)

    result = time_function(generate_points, (43.084163, -89.324808), 0.2, 0.1)
    assert len(result.return_) == 25
    for lat, lon in result.return_:
        assert isinstance(lat, float)
        assert isinstance(lon, float)

    result = time_function(generate_points, (43.084163, -89.324808), 0.01, 0.1)
    assert len(result.return_) == 1
    for lat, lon in result.return_:
        assert isinstance(lat, float)
        assert isinstance(lon, float)
Ejemplo n.º 5
0
def test_distance_performance(performance_tolerance):
    result = time_function(distance, (43.084163, -89.324808), (43.073746, -89.406702), count=1000)
    assert result.execution_ms < 3 * performance_tolerance  # Expected 1 or 2 ms

    returned_dist = result.return_[0]
    assert isinstance(returned_dist, float)