| 1 | from bluetooth_data_tools import calculate_distance_meters |
| 2 | |
| 3 | _CLOSE_POWER = -4 |
| 4 | _CLOSE_RSSI = -3 |
| 5 | |
| 6 | _FAR_POWER = -59 |
| 7 | _FAR_RSSI = -60 |
| 8 | |
| 9 | _ZERO_POWER = 59 |
| 10 | _ZERO_RSSI = 0 |
| 11 | |
| 12 | |
| 13 | def test_calculate_distance_meters_close(benchmark): |
| 14 | benchmark(lambda: calculate_distance_meters(_CLOSE_POWER, _CLOSE_RSSI)) |
| 15 | |
| 16 | |
| 17 | def test_calculate_distance_meters_far(benchmark): |
| 18 | benchmark(lambda: calculate_distance_meters(_FAR_POWER, _FAR_RSSI)) |
| 19 | |
| 20 | |
| 21 | def test_calculate_distance_meters_zero(benchmark): |
| 22 | benchmark(lambda: calculate_distance_meters(_ZERO_POWER, _ZERO_RSSI)) |