From b0d4c788e02df0fec3ca20efd90e942050c4ba01 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 29 Nov 2018 16:12:31 +0100 Subject: [PATCH] [tests] fix argument parsing in source tests --- tests/src/io/test-source_apple_audio.c | 4 ++-- tests/src/io/test-source_avcodec.c | 4 ++-- tests/src/io/test-source_seek.c | 4 ++-- tests/src/io/test-source_sndfile.c | 4 ++-- tests/src/io/test-source_wavread.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/src/io/test-source_apple_audio.c b/tests/src/io/test-source_apple_audio.c index 373d30a3..b38ed95b 100644 --- a/tests/src/io/test-source_apple_audio.c +++ b/tests/src/io/test-source_apple_audio.c @@ -27,8 +27,8 @@ int main (int argc, char **argv) uint_t samplerate = 0; uint_t hop_size = 256; uint_t n_frames = 0, read = 0; - if ( argc == 3 ) samplerate = atoi(argv[2]); - if ( argc == 4 ) hop_size = atoi(argv[3]); + if ( argc >= 3 ) samplerate = atoi(argv[2]); + if ( argc >= 4 ) hop_size = atoi(argv[3]); char_t *source_path = argv[1]; diff --git a/tests/src/io/test-source_avcodec.c b/tests/src/io/test-source_avcodec.c index 00524bf6..962b578e 100644 --- a/tests/src/io/test-source_avcodec.c +++ b/tests/src/io/test-source_avcodec.c @@ -27,8 +27,8 @@ int main (int argc, char **argv) uint_t samplerate = 0; uint_t hop_size = 256; uint_t n_frames = 0, read = 0; - if ( argc == 3 ) samplerate = atoi(argv[2]); - if ( argc == 4 ) hop_size = atoi(argv[3]); + if ( argc >= 3 ) samplerate = atoi(argv[2]); + if ( argc >= 4 ) hop_size = atoi(argv[3]); char_t *source_path = argv[1]; diff --git a/tests/src/io/test-source_seek.c b/tests/src/io/test-source_seek.c index 07eeb8da..8defe22e 100644 --- a/tests/src/io/test-source_seek.c +++ b/tests/src/io/test-source_seek.c @@ -23,8 +23,8 @@ int main (int argc, char **argv) uint_t hop_size = 256; uint_t n_frames = 0, read = 0; uint_t old_n_frames_1 = 0, old_n_frames_2 = 0, old_n_frames_3 = 0; - if ( argc == 3 ) samplerate = atoi(argv[2]); - if ( argc == 4 ) hop_size = atoi(argv[3]); + if ( argc >= 3 ) samplerate = atoi(argv[2]); + if ( argc >= 4 ) hop_size = atoi(argv[3]); char_t *source_path = argv[1]; diff --git a/tests/src/io/test-source_sndfile.c b/tests/src/io/test-source_sndfile.c index 5afb9379..e50ae472 100644 --- a/tests/src/io/test-source_sndfile.c +++ b/tests/src/io/test-source_sndfile.c @@ -27,8 +27,8 @@ int main (int argc, char **argv) uint_t samplerate = 0; uint_t hop_size = 256; uint_t n_frames = 0, read = 0; - if ( argc == 3 ) samplerate = atoi(argv[2]); - if ( argc == 4 ) hop_size = atoi(argv[3]); + if ( argc >= 3 ) samplerate = atoi(argv[2]); + if ( argc >= 4 ) hop_size = atoi(argv[3]); char_t *source_path = argv[1]; diff --git a/tests/src/io/test-source_wavread.c b/tests/src/io/test-source_wavread.c index 4f1f35fe..a3363f03 100644 --- a/tests/src/io/test-source_wavread.c +++ b/tests/src/io/test-source_wavread.c @@ -27,8 +27,8 @@ int main (int argc, char **argv) uint_t samplerate = 0; uint_t hop_size = 256; uint_t n_frames = 0, read = 0; - if ( argc == 3 ) samplerate = atoi(argv[2]); - if ( argc == 4 ) hop_size = atoi(argv[3]); + if ( argc >= 3 ) samplerate = atoi(argv[2]); + if ( argc >= 4 ) hop_size = atoi(argv[3]); char_t *source_path = argv[1]; -- 2.11.0