Skip to content

Commit 639a799

Browse files
committed
tests : fix strcmp assert and use beam search
This commit fixes a mistake in the usage of strcmp where I missed the actual comparision evaluation. This commit also changes the sampling method from WHISPER_SAMPLING_GREEDY to WHISPER_SAMPLING_BEAM_SEARCH in the to match the default cli behavior.
1 parent 845233e commit 639a799

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tests/test-vad-full.cpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ int main() {
2727
whisper_model_path.c_str(),
2828
cparams);
2929

30-
struct whisper_full_params wparams = whisper_full_default_params(WHISPER_SAMPLING_GREEDY);
30+
struct whisper_full_params wparams = whisper_full_default_params(WHISPER_SAMPLING_BEAM_SEARCH);
3131
wparams.vad = true;
3232
wparams.vad_model_path = vad_model_path.c_str();
3333
wparams.vad_threshold = 0.5f;
@@ -40,15 +40,13 @@ int main() {
4040
assert(whisper_full_parallel(wctx, wparams, pcmf32.data(), pcmf32.size(), 1) == 0);
4141

4242
const int n_segments = whisper_full_n_segments(wctx);
43-
assert(n_segments == 2);
44-
45-
assert(strcmp("And so my fellow Americans ask not what you country can do for you.",
46-
whisper_full_get_segment_text(wctx, 0)));
47-
assert(strcmp("Ask what you can do for your country.",
48-
whisper_full_get_segment_text(wctx, 1)));
43+
assert(n_segments == 1);
4944

45+
assert(strcmp(" And so my fellow Americans, ask not what your country can do for you,"
46+
" ask what you can do for your country.",
47+
whisper_full_get_segment_text(wctx, 0)) == 0);
5048
assert(whisper_full_get_segment_t0(wctx, 0) == 0);
51-
assert(whisper_full_get_segment_t1(wctx, 1) == 1047);
49+
assert(whisper_full_get_segment_t1(wctx, 0) == 1049);
5250

5351
whisper_free(wctx);
5452

0 commit comments

Comments
 (0)