From ff87a6721e6100148de5a3f93844855f619491ad Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 7 Dec 2018 18:03:45 +0100 Subject: [PATCH] [tests] increase timestretch coverage, fix memory leak --- tests/src/effects/test-timestretch.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/src/effects/test-timestretch.c b/tests/src/effects/test-timestretch.c index c44d1ec4..9ead77ad 100644 --- a/tests/src/effects/test-timestretch.c +++ b/tests/src/effects/test-timestretch.c @@ -43,7 +43,7 @@ int main (int argc, char **argv) fvec_t *in = new_fvec(source_hopsize); fvec_t *out = new_fvec(hop_size); - if (!out) { err = 1; goto beach_fvec; } + if (!out || !in) { err = 1; goto beach_fvec; } aubio_timestretch_t *ps = new_aubio_timestretch(mode, stretch, hop_size, samplerate); @@ -90,6 +90,7 @@ beach_sink: del_aubio_timestretch(ps); beach_timestretch: del_fvec(out); + del_fvec(in); beach_fvec: del_aubio_source(s); beach_source: @@ -107,7 +108,8 @@ int test_wrong_params(void) uint_t hop_size = 256; uint_t samplerate = 44100; - if (new_aubio_timestretch("??", stretch, hop_size, samplerate)) return 1; + if (new_aubio_timestretch("ProcessOffline:?:", stretch, hop_size, samplerate)) return 1; + if (new_aubio_timestretch("", stretch, hop_size, samplerate)) return 1; if (new_aubio_timestretch(mode, 41., hop_size, samplerate)) return 1; if (new_aubio_timestretch(mode, stretch, 0, samplerate)) return 1; if (new_aubio_timestretch(mode, stretch, hop_size, 0)) return 1; @@ -119,6 +121,8 @@ int test_wrong_params(void) if (aubio_timestretch_get_latency(p) == 0) return 1; + if (aubio_timestretch_get_samplerate(p) != samplerate) return 1; + aubio_timestretch_reset(p); if (aubio_timestretch_get_transpose(p) != 0) return 1; -- 2.11.0