diff options
| author | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
| commit | ffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch) | |
| tree | 1269efa852935b183daae4bb33a58d1b4d2ffb53 /tests/unit/jt65 | |
| parent | 059831534c7e884f0a607ed86b582fd00d821731 (diff) | |
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'tests/unit/jt65')
| -rw-r--r-- | tests/unit/jt65/test_jt65_decode_pipeline.f90 | 52 | ||||
| -rw-r--r-- | tests/unit/jt65/test_jt65_xcor_silence.f90 | 8 | ||||
| -rw-r--r-- | tests/unit/jt65/test_map65_jt65_handoff.f90 | 55 |
3 files changed, 68 insertions, 47 deletions
diff --git a/tests/unit/jt65/test_jt65_decode_pipeline.f90 b/tests/unit/jt65/test_jt65_decode_pipeline.f90 index 414b6f80..89d011f0 100644 --- a/tests/unit/jt65/test_jt65_decode_pipeline.f90 +++ b/tests/unit/jt65/test_jt65_decode_pipeline.f90 @@ -54,12 +54,13 @@ program test_jt65_decode_pipeline type(jt65_decoder) :: decoder real(real32), allocatable :: samples(:) allocate(samples(jt65_sample_count)) - call test_clean_modes(samples) + call test_clean_modes_and_reuse(samples) call test_ooo_signal(samples) - call test_silence_and_frequency_rejection(samples) - call test_decoder_reuse(samples, decoder) + call test_frequency_rejection(samples) call test_auto_clear_average(samples, decoder) call test_duplicate_average_cursor + call decoder%destroy() + deallocate(samples) print '(a)', 'JT65 decoder pipeline tests passed' contains @@ -155,12 +156,22 @@ contains call require(ieee_is_finite(callback_width), description//' finite width metric') end subroutine require_decode - subroutine test_clean_modes(waveform) + subroutine test_clean_modes_and_reuse(waveform) real(real32), intent(inout) :: waveform(:) call reset_capture() call make_jt65_wave(waveform, standard_tones, 1, 1500.0_real64) call decode_signal(decoder, waveform, 0, .true.) - call require_decode('K1ABC W9XYZ FN42', 'JT65A clean signal') + call require_decode('K1ABC W9XYZ FN42', 'first JT65A reused-decoder signal') + + waveform = 0.0_real32 + call reset_capture() + call decode_signal(decoder, waveform, 0, .true.) + call require(callback_count == 0, 'reused decoder silence produces no callback') + + call reset_capture() + call make_jt65_wave(waveform, standard_tones, 1, 1500.0_real64) + call decode_signal(decoder, waveform, 0, .true.) + call require_decode('K1ABC W9XYZ FN42', 'second JT65A reused-decoder signal') call reset_capture() call make_jt65_wave(waveform, standard_tones, 4, 1500.0_real64) @@ -171,7 +182,7 @@ contains call make_jt65_wave(waveform, standard_tones, 2, 1500.0_real64) call decode_signal(decoder, waveform, 1, .true.) call require_decode('K1ABC W9XYZ FN42', 'JT65B clean signal') - end subroutine test_clean_modes + end subroutine test_clean_modes_and_reuse subroutine test_ooo_signal(waveform) real(real32), intent(inout) :: waveform(:) @@ -188,39 +199,14 @@ contains call require(callback_count == 0, 'JT65A HF OOO signal is rejected') end subroutine test_ooo_signal - subroutine test_silence_and_frequency_rejection(waveform) + subroutine test_frequency_rejection(waveform) real(real32), intent(inout) :: waveform(:) - waveform = 0.0_real32 - call reset_capture() - call decode_signal(decoder, waveform, 0, .true.) - call require(callback_count == 0, 'silence produces no callback') - call make_jt65_wave(waveform, standard_tones, 1, 3000.0_real64) call reset_capture() call decode_signal(decoder, waveform, 0, .true.) call require(callback_count == 0, 'out-of-window signal produces no callback') - end subroutine test_silence_and_frequency_rejection - - subroutine test_decoder_reuse(waveform, decoder_to_use) - real(real32), intent(inout) :: waveform(:) - type(jt65_decoder), intent(inout) :: decoder_to_use - - call make_jt65_wave(waveform, standard_tones, 1, 1500.0_real64) - call reset_capture() - call decode_signal(decoder_to_use, waveform, 0, .true.) - call require_decode('K1ABC W9XYZ FN42', 'first reused-decoder signal') - - waveform = 0.0_real32 - call reset_capture() - call decode_signal(decoder_to_use, waveform, 0, .true.) - call require(callback_count == 0, 'reused decoder silence produces no callback') - - call make_jt65_wave(waveform, standard_tones, 1, 1500.0_real64) - call reset_capture() - call decode_signal(decoder_to_use, waveform, 0, .true.) - call require_decode('K1ABC W9XYZ FN42', 'second reused-decoder signal') - end subroutine test_decoder_reuse + end subroutine test_frequency_rejection subroutine test_auto_clear_average(waveform, decoder_to_use) real(real32), intent(inout) :: waveform(:) diff --git a/tests/unit/jt65/test_jt65_xcor_silence.f90 b/tests/unit/jt65/test_jt65_xcor_silence.f90 index d43049b2..27fbadfb 100644 --- a/tests/unit/jt65/test_jt65_xcor_silence.f90 +++ b/tests/unit/jt65/test_jt65_xcor_silence.f90 @@ -1,15 +1,17 @@ program test_jt65_xcor_silence + use jt65_mod, only: jt65_work, ensure_jt65_workspace implicit none integer, parameter :: lag1 = -32, lag2 = 82, nhmax = 3413, nsmax = 552 - real :: ss(nsmax,nhmax), ccf(lag1:lag2), ccf0, flip + real :: ccf(lag1:lag2), ccf0, flip integer :: lagpk - common /sync/ ss call setup65 - ss = 0.0 + call ensure_jt65_workspace() + allocate(jt65_work%spectra(nsmax,nhmax)) + jt65_work%spectra = 0.0 lagpk = huge(0) call xcor(1,nsmax,126,lag1,lag2,ccf,ccf0,lagpk,flip,0.0,0) diff --git a/tests/unit/jt65/test_map65_jt65_handoff.f90 b/tests/unit/jt65/test_map65_jt65_handoff.f90 index d263bccd..71321300 100644 --- a/tests/unit/jt65/test_map65_jt65_handoff.f90 +++ b/tests/unit/jt65/test_map65_jt65_handoff.f90 @@ -3,7 +3,8 @@ program test_map65_jt65_handoff use iso_fortran_env, only: real32, real64 use, intrinsic :: ieee_arithmetic, only: ieee_get_flag, ieee_invalid, ieee_is_finite, & ieee_quiet_nan, ieee_set_flag, ieee_value - use decode1a_mod + use decode1a_mod, only: decode1a, jt65_demod_bin, jt65_demod_sample_rate, & + jt65_fft_size, jt65c_center_offset use filbig_mod use afc65b_mod, only: afc65b use jt65_test_fixture @@ -11,21 +12,56 @@ program test_map65_jt65_handoff use npar_ptrs_mod, only: nsmax_active implicit none - real(real32), allocatable :: dd(:,:) + real(real32), allocatable :: dd(:,:), mode_b_wave(:,:) real(real64), parameter :: map65_base_frequency = 118.0_real64 * 11025.0_real64 / 1024.0_real64 allocate(dd(4, nsmax_active)) + allocate(mode_b_wave(2, nsmax_active)) + call make_map65_wave(mode_b_wave, standard_tones, 2, map65_base_frequency) + dd(1:2,:) = mode_b_wave call test_mono_filter_output(dd) call test_afc_zero_signal() - call test_mode(dd, standard_tones, 1, 1, 'JT65A MAP65 handoff') - call test_mode(dd, standard_tones, 2, 1, 'JT65B MAP65 handoff') - call test_mode(dd, standard_tones, 4, 1, 'JT65C MAP65 handoff') - call test_mode(dd, ooo_tones, 1, -1, 'JT65A OOO MAP65 handoff') - call test_mode(dd, standard_tones, 2, 1, 'JT65B xpol MAP65 handoff', .true.) + call test_demodulation_bins() + call make_map65_wave(dd, standard_tones, 1, map65_base_frequency) + call test_mode(dd, 1, 1, 'JT65A MAP65 handoff') + dd(1:2,:) = mode_b_wave + call test_mode(dd, 2, 1, 'JT65B MAP65 handoff') + call make_map65_wave(dd, standard_tones, 4, map65_base_frequency) + call test_mode(dd, 4, 1, 'JT65C MAP65 handoff') + call make_map65_wave(dd, ooo_tones, 1, map65_base_frequency) + call test_mode(dd, 1, -1, 'JT65A OOO MAP65 handoff') + dd(1:2,:) = mode_b_wave + call test_mode(dd, 2, 1, 'JT65B xpol MAP65 handoff', .true.) print '(a)', 'MAP65 JT65 handoff tests passed' contains + subroutine test_demodulation_bins() + real(real64) :: frequency, mapped_frequency + integer :: bin, mode65, signed_bin, tone + + do mode65=1,4 + if(mode65.eq.3) cycle + do tone=1,66 + bin=jt65_demod_bin(mode65,tone) + call require(bin.ge.1 .and. bin.le.jt65_fft_size, & + 'JT65 demodulation bin is in range') + frequency=real((tone-1)*mode65,real64)*jt65_demod_sample_rate/ & + jt65_fft_size + if(mode65.eq.4) frequency=frequency-jt65c_center_offset + signed_bin=bin-1 + if(signed_bin.gt.jt65_fft_size/2) signed_bin=signed_bin-jt65_fft_size + mapped_frequency=real(signed_bin,real64)*jt65_demod_sample_rate/ & + jt65_fft_size + call require(abs(mapped_frequency-frequency).lt. & + jt65_demod_sample_rate/jt65_fft_size, & + 'JT65 tone frequency maps to the selected FFT bin') + call require(abs(frequency).lt.0.5_real64*jt65_demod_sample_rate, & + 'JT65 data tone fits the demodulation passband') + enddo + enddo + end subroutine test_demodulation_bins + subroutine require(condition, description) logical, intent(in) :: condition character(len=*), intent(in) :: description @@ -43,7 +79,6 @@ contains logical :: invalid_raised allocate(cx(nsmax_active/64), cy(nsmax_active/64)) - call make_map65_wave(waveform, standard_tones, 2, map65_base_frequency) waveform(3:4,:) = ieee_value(0.0_real32, ieee_quiet_nan) newdat = 1 call ieee_set_flag(ieee_invalid, .false.) @@ -82,9 +117,8 @@ contains 'flat AFC objective has explicit detection defaults') end subroutine test_afc_zero_signal - subroutine test_mode(waveform, tones, mode65, polarity, description, cross_polarized) + subroutine test_mode(waveform, mode65, polarity, description, cross_polarized) real(real32), intent(inout) :: waveform(:,:) - integer, intent(in) :: tones(:) integer, intent(in) :: mode65 integer, intent(in) :: polarity character(len=*), intent(in) :: description @@ -97,7 +131,6 @@ contains character(len=22) :: decoded real :: dphi, sync2, a(5), dt, pol, qual - call make_map65_wave(waveform, tones, mode65, map65_base_frequency) xpol = .false. if (present(cross_polarized)) xpol = cross_polarized if (xpol) then |
