wavmetrics: add a small test

This commit is contained in:
tTh
2024-02-08 04:07:42 +01:00
parent f039df4fe2
commit 09a4cb7cff
4 changed files with 37 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
program essai
program twavm
! new: Wed Feb 7 01:27:48 UTC 2024
@@ -6,9 +6,9 @@ program essai
use wavmetrics
implicit none
write(0, *) "----------------- essai -------------------"
write(0, *) "----------------- twavm -------------------"
call run_first_test(44100/30)
call run_second_test(44100/30)
contains
!-----------------------------------------------------------------------
@@ -35,5 +35,33 @@ subroutine run_first_test(nbs)
end subroutine
!-----------------------------------------------------------------------
!-----------------------------------------------------------------------
!-
!- we read the datas from stdin
!-
subroutine run_second_test(nbs)
integer, intent(in) :: nbs ! nombre d'echantillons
type(intsample), allocatable :: samples(:)
type(wavmetric) :: metrics
integer :: foo, bar
integer :: vl, vr
write(0, '(1X, "second test on ", I0, " samples.")') nbs
! create the buffer, and fill it with stdin
allocate(samples(nbs))
do foo=1, nbs
read(5, *) vl, vr
! print '(1X, 2I16)', vl, vr
samples(foo)%left = vl
samples(foo)%right = vr
enddo
! compute and display the metrics (gi-go)
call compute_wavmetric(samples, nbs, metrics)
call display_wavmetrics(metrics)
end subroutine
!-----------------------------------------------------------------------
end program