You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
567 B
30 lines
567 B
import pytest |
|
import main |
|
|
|
|
|
@pytest.fixture(autouse=True) |
|
def patch_log(monkeypatch): |
|
monkeypatch.setattr(main, "log", lambda msg: None) |
|
monkeypatch.setattr(main, "logvv", lambda msg: None) |
|
|
|
def test_translate_pos_max(): |
|
|
|
assert main.translate_pos(0.0, 100.0, 100.0, 10) == 10 |
|
|
|
|
|
def test_translate_pos_min(): |
|
|
|
assert main.translate_pos(0.0, 100.0, 0.0, 10) == 0 |
|
|
|
|
|
def test_translate_pos_high(): |
|
|
|
assert main.translate_pos(10.0, 110.0, 100.1, 50) == 45 |
|
|
|
|
|
def test_translate_pos_low(): |
|
|
|
assert main.translate_pos(10.0, 110.0, 20.1, 90) == 9 |
|
|
|
|
|
|
|
|