diff options
Diffstat (limited to 'lab_control/test/sds1000xe_test.py')
-rw-r--r-- | lab_control/test/sds1000xe_test.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lab_control/test/sds1000xe_test.py b/lab_control/test/sds1000xe_test.py index 87cdefd..88d5022 100644 --- a/lab_control/test/sds1000xe_test.py +++ b/lab_control/test/sds1000xe_test.py @@ -1,5 +1,4 @@ import pytest -import time from lab_control.sds1000xe import SDS1000XE from lab_control.test.mock_sds1000xe_server import MockSDS1000XEServer @@ -17,5 +16,21 @@ def uut(mockServer): return SDS1000XE(MOCK_IP) def test_amplitudeMeasurement(uut, mockServer): - assert True + testCases = [(1, 16.23987), (2, 0.0), (3, -0.0164), (4, 10.1)] + + for t in testCases: + channel = t[0] + expectedAmplitude = t[1] + mockServer.setAmplitude(channel, expectedAmplitude) + + measuredAmplitude = uut.measureAmplitude(channel) + assert measuredAmplitude == expectedAmplitude + +def test_invalidChannel(uut, mockServer): + # Channel is checked by the UUT before the request is sent + testCases = [0, 5] + + for t in testCases: + with pytest.raises(AssertionError): + measuredAmplitude = uut.measureAmplitude(t) |