Skip to content

Commit aafad17

Browse files
committed
Changed assertion of Two tone test
Signed-off-by: Macy Libed <macy.libed@analog.com>
1 parent 16f0d06 commit aafad17

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

test/dma_tests.py

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -439,27 +439,16 @@ def dds_two_tone(
439439
)
440440
}
441441

442-
# Define tolerance
443-
tolerance1 = frequency1 * 0.01
444-
tolerance2 = frequency2 * 0.01
445-
446-
# Check frequency and peak values
447-
if (abs(tone_freqs[indx1] - frequency1) <= tolerance1 and
448-
abs(tone_freqs[indx2] - frequency2) <= tolerance2):
449-
450-
assert abs(tone_freqs[indx1] - frequency1) <= tolerance1
451-
assert abs(tone_freqs[indx2] - frequency2) <= tolerance2
452-
assert tone_peaks[indx1] > peak_min1
453-
assert tone_peaks[indx2] > peak_min2
454-
455-
elif (abs(tone_freqs[indx1] - frequency2) <= tolerance2 and
456-
abs(tone_freqs[indx2] - frequency1) <= tolerance1):
457-
458-
assert abs(tone_freqs[indx1] - frequency2) <= tolerance2
459-
assert abs(tone_freqs[indx2] - frequency1) <= tolerance1
460-
assert tone_peaks[indx1] > peak_min1
461-
assert tone_peaks[indx2] > peak_min2
462-
442+
# Assertions
443+
diff1 = abs(tone_freqs[indx1] - frequency1)
444+
diff2 = abs(tone_freqs[indx2] - frequency2)
445+
446+
assert diff1 < (frequency1 * 0.01)
447+
assert diff2 < (frequency2 * 0.01)
448+
assert tone_peaks[indx1] > peak_min1
449+
assert tone_peaks[indx2] > peak_min2
450+
451+
463452
def nco_loopback(uri, classname, param_set, channel, frequency, peak_min):
464453
"""nco_loopback: TX/DAC Test tone loopback with connected loopback cables.
465454
This test requires a devices with TX and RX onboard where the transmit

0 commit comments

Comments
 (0)