Skip to content

Commit

Permalink
improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
takenori-y committed Aug 7, 2023
1 parent 26f849c commit 44eec5c
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/main/world_synth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ void PrintUsage(std::ostream* stream) {

} // namespace

/*
* @a world_synth [ @e option ] @e f0file @e spfile @e apfile
/**
* @a world_synth [ @e option ] @e spfile @e apfile [ @e f0file ]
*
* - @b -l @e int
* - FFT length
Expand Down
4 changes: 2 additions & 2 deletions test/test_amgcep.bats
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ teardown() {
}

@test "amgcep: compatibility (a = 0, c = 0)" {
$sptk3/nrand -l 20 | $sptk3/acep -m 3 -k 0.2 -p 2 > $tmp/1
$sptk3/nrand -l 20 | $sptk4/amgcep -m 3 -c 0 -a 0 -s 0.2 -p 2 > $tmp/2
$sptk3/nrand -l 20 | $sptk3/acep -m 3 -k 0.2 -t 0.8 -l 0.9 -p 2 > $tmp/1
$sptk3/nrand -l 20 | $sptk4/amgcep -m 3 -c 0 -a 0 -s 0.2 -t 0.8 -l 0.9 -p 2 > $tmp/2
run $sptk4/aeq $tmp/1 $tmp/2
[ "$status" -eq 0 ]
}
Expand Down
10 changes: 8 additions & 2 deletions test/test_dtw.bats
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,19 @@ teardown() {
for d in $(seq 0 1); do
for p in $(seq 0 6); do
$sptk3/dtw -l 2 -p $((p + 1)) -n $((d + 1)) \
$tmp/0_r $tmp/0_q -s $tmp/1_s > $tmp/1
$tmp/0_r $tmp/0_q -s $tmp/1_s -v $tmp/1_v > $tmp/1
$sptk4/dtw -l 2 -p "$p" -d "$d" \
$tmp/0_r $tmp/0_q -S $tmp/2_s > $tmp/2
$tmp/0_r $tmp/0_q -S $tmp/2_s -P $tmp/2_v > $tmp/2
run $sptk4/aeq $tmp/1 $tmp/2
[ "$status" -eq 0 ]

run $sptk4/aeq $tmp/1_s $tmp/2_s
[ "$status" -eq 0 ]

$sptk3/x2x +id $tmp/1_v > $tmp/1_p
$sptk3/x2x +id $tmp/2_v > $tmp/2_p
run $sptk4/aeq $tmp/1_p $tmp/2_p
[ "$status" -eq 0 ]
done
done
}
Expand Down
4 changes: 2 additions & 2 deletions test/test_fbank.bats
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ teardown() {

@test "fbank: compatibility" {
$sptk3/nrand -l 16 |
$sptk3/mfcc -a 0 -c 0 -e 1 -l 8 -L 8 -w 1 -n 4 -m 3 > $tmp/1
$sptk3/mfcc -a 0 -c 0 -e 1 -l 8 -L 8 -w 1 -n 4 -m 3 -s 8 > $tmp/1
$sptk3/nrand -l 16 |
$sptk4/fbank -l 8 -n 4 -e 1 |
$sptk4/fbank -l 8 -n 4 -e 1 -s 8 |
$sptk3/dct -l 4 |
$sptk3/bcp -l 4 -s 1 +d > $tmp/2
run $sptk4/aeq $tmp/1 $tmp/2
Expand Down
9 changes: 9 additions & 0 deletions test/test_histogram.bats
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ teardown() {
$sptk3/ramp -l 10 | $sptk4/histogram -l 0 -u 9 -b 4 > $tmp/2
run $sptk4/aeq $tmp/1 $tmp/2
[ "$status" -eq 0 ]

cmd="import numpy as np; "
cmd+="h, e = np.histogram(np.arange(10), bins=4, range=(0, 9), density=True); "
cmd+="h *= np.diff(e); "
cmd+="print(' '.join(map(str, h)))"
tools/venv/bin/python -c "${cmd}" | $sptk3/x2x +ad > $tmp/3
$sptk3/ramp -l 10 | $sptk4/histogram -l 0 -u 9 -b 4 -n > $tmp/4
run $sptk4/aeq $tmp/3 $tmp/4
[ "$status" -eq 0 ]
}

@test "histogram: valgrind" {
Expand Down
4 changes: 2 additions & 2 deletions test/test_mfcc.bats
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ teardown() {
# signal energy before windowing whereas SPTK4 calculates one after
# windowing.
$sptk3/nrand -l 16 |
$sptk3/mfcc -a 0 -c 10 -e 1 -l 8 -L 8 -w 1 -n 6 -m 3 -E -0 > $tmp/1
$sptk3/mfcc -a 0 -c 10 -e 1 -l 8 -L 8 -w 1 -n 6 -m 3 -E -0 -s 8 > $tmp/1
$sptk3/nrand -l 16 |
$sptk4/mfcc -c 10 -e 1 -l 8 -n 6 -m 3 -o 3 > $tmp/2
$sptk4/mfcc -c 10 -e 1 -l 8 -n 6 -m 3 -o 3 -s 8 > $tmp/2
run $sptk4/aeq $tmp/1 $tmp/2
[ "$status" -eq 0 ]
}
Expand Down
5 changes: 5 additions & 0 deletions test/test_nrand.bats
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ teardown() {
$sptk4/nrand -l 256 -u 2 -d 0.1 -s 123 > $tmp/2
run $sptk4/aeq $tmp/1 $tmp/2
[ "$status" -eq 0 ]

$sptk3/nrand -l 256 -m -2 -v 2 -s 234 > $tmp/3
$sptk4/nrand -l 256 -u -2 -v 2 -s 234 > $tmp/4
run $sptk4/aeq $tmp/3 $tmp/4
[ "$status" -eq 0 ]
}

@test "nrand: valgrind" {
Expand Down
7 changes: 7 additions & 0 deletions test/test_x2x.bats
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ teardown() {
done
}

@test "x2x: rounding" {
echo -0.5 0.5 | $sptk3/x2x +ai -r > $tmp/1
echo -0.5 0.5 | $sptk4/x2x +ai -r > $tmp/2
run $sptk4/aeq $tmp/1 $tmp/2
[ "$status" -eq 0 ]
}

@test "x2x: valgrind" {
$sptk3/nrand -l 20 > $tmp/1
run valgrind $sptk4/x2x +da $tmp/1
Expand Down

0 comments on commit 44eec5c

Please sign in to comment.