Skip to content

Commit

Permalink
test: update test coverage for ad7768 and ad7768-4
Browse files Browse the repository at this point in the history
Signed-off-by: Trecia Agoylo <[email protected]>
  • Loading branch information
tagoylo committed Feb 13, 2024
1 parent 1f35729 commit 834bc87
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 26 deletions.
8 changes: 7 additions & 1 deletion test/dma_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@


def dma_rx(
uri, classname, channel, use_rx2=False, buffer_size=2 ** 15, annotated=False, param_set=None
uri,
classname,
channel,
use_rx2=False,
buffer_size=2 ** 15,
annotated=False,
param_set=None,
):
"""dma_rx: Construct RX buffers and verify data is non-zero when pulled.
Collected buffer is of size 2**15 and 10 buffers are checked
Expand Down
26 changes: 13 additions & 13 deletions test/test_ad7768.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
hardware = ["ad7768"]
classname = "adi.ad7768"

#########################################
@pytest.mark.iio_hardware(hardware, True)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1, 2, 3, 4, 5, 6, 7])
def test_ad7768_rx_data(test_dma_rx, iio_uri, classname, channel):
test_dma_rx(iio_uri, classname, channel)


#########################################
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
Expand All @@ -20,9 +12,6 @@ def test_ad7768_rx_data(test_dma_rx, iio_uri, classname, channel):
(
"sampling_frequency",
[
1000,
2000,
4000,
8000,
16000,
32000,
Expand All @@ -33,8 +22,19 @@ def test_ad7768_rx_data(test_dma_rx, iio_uri, classname, channel):
], # End on a rate compatible with all power modes
),
("filter_type", ["WIDEBAND", "SINC5"],),
("power_mode", ["MEDIAN_MODE", "FAST_MODE"],),
("power_mode", ["LOW_POWER_MODE", "MEDIAN_MODE", "FAST_MODE"],),
],
)
def test_ad4630_attr(test_attribute_multiple_values, iio_uri, classname, attr, val):
def test_ad7768_attr(test_attribute_multiple_values, iio_uri, classname, attr, val):
test_attribute_multiple_values(iio_uri, classname, attr, val, 0)


#########################################
@pytest.mark.iio_hardware(hardware, True)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1, 2, 3, 4, 5, 6, 7])
@pytest.mark.parametrize(
"param_set", [dict(filter_type="SINC5"), dict(filter_type="WIDEBAND")]
)
def test_ad7768_rx_data(test_dma_rx, iio_uri, classname, channel, param_set):
test_dma_rx(iio_uri, classname, channel, param_set=param_set)
24 changes: 12 additions & 12 deletions test/test_ad7768_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
hardware = ["ad7768-4"]
classname = "adi.ad7768_4"

#########################################
@pytest.mark.iio_hardware(hardware, True)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1, 2, 3])
def test_ad7768_4_rx_data(test_dma_rx, iio_uri, classname, channel):
test_dma_rx(iio_uri, classname, channel)


#########################################
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
Expand All @@ -20,9 +12,6 @@ def test_ad7768_4_rx_data(test_dma_rx, iio_uri, classname, channel):
(
"sampling_frequency",
[
1000,
2000,
4000,
8000,
16000,
32000,
Expand All @@ -33,9 +22,20 @@ def test_ad7768_4_rx_data(test_dma_rx, iio_uri, classname, channel):
], # End on a rate compatible with all power modes
),
("filter_type", ["WIDEBAND", "SINC5"],),
("power_mode", ["MEDIAN_MODE", "FAST_MODE"],),
("power_mode", ["LOW_POWER_MODE", "MEDIAN_MODE", "FAST_MODE"],),
("sync_start_enable", ["arm"],),
],
)
def test_ad7768_4_attr(test_attribute_multiple_values, iio_uri, classname, attr, val):
test_attribute_multiple_values(iio_uri, classname, attr, val, 0)


#########################################
@pytest.mark.iio_hardware(hardware, True)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize("channel", [0, 1, 2, 3])
@pytest.mark.parametrize(
"param_set", [dict(filter_type="SINC5"), dict(filter_type="WIDEBAND")]
)
def test_ad7768_4_rx_data(test_dma_rx, iio_uri, classname, channel, param_set):
test_dma_rx(iio_uri, classname, channel, param_set=param_set)

0 comments on commit 834bc87

Please sign in to comment.