ref: b0d4c788e02df0fec3ca20efd90e942050c4ba01
parent: da67922de5df2d993ede7ecccbfc7c9fec234b78
author: Paul Brossier <piem@piem.org>
date: Thu Nov 29 11:12:31 EST 2018
[tests] fix argument parsing in source tests
--- a/tests/src/io/test-source_apple_audio.c
+++ b/tests/src/io/test-source_apple_audio.c
@@ -27,8 +27,8 @@
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];
--- a/tests/src/io/test-source_avcodec.c
+++ b/tests/src/io/test-source_avcodec.c
@@ -27,8 +27,8 @@
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];
--- a/tests/src/io/test-source_seek.c
+++ b/tests/src/io/test-source_seek.c
@@ -23,8 +23,8 @@
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];
--- a/tests/src/io/test-source_sndfile.c
+++ b/tests/src/io/test-source_sndfile.c
@@ -27,8 +27,8 @@
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];
--- a/tests/src/io/test-source_wavread.c
+++ b/tests/src/io/test-source_wavread.c
@@ -27,8 +27,8 @@
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];