From: Paul Brossier Date: Sun, 16 Dec 2018 02:47:53 +0000 (+0100) Subject: [tests] improve sink_custom tests X-Git-Tag: 0.4.9~106 X-Git-Url: https://git.aubio.org/?p=aubio.git;a=commitdiff_plain;h=633a40817e65660dcfb3f2237a4a1a39a22edee5 [tests] improve sink_custom tests --- diff --git a/tests/src/io/base-sink_custom.h b/tests/src/io/base-sink_custom.h index 44e1e201..9f6d7208 100644 --- a/tests/src/io/base-sink_custom.h +++ b/tests/src/io/base-sink_custom.h @@ -63,6 +63,40 @@ failure: int test_wrong_params(void) { + aubio_sink_custom_t *s; + char_t sink_path[PATH_MAX] = "tmp_aubio_XXXXXX"; + uint_t samplerate = 44100; + // create temp file + int fd = create_temp_sink(sink_path); + + if (!fd) return 1; + + if (new_aubio_sink_custom( 0, samplerate)) return 1; + if (new_aubio_sink_custom("\0", samplerate)) return 1; + if (new_aubio_sink_custom(sink_path, -1)) return 1; + + s = new_aubio_sink_custom(sink_path, 0); + + if (aubio_sink_custom_preset_samplerate(s, samplerate)) return 1; + if (aubio_sink_custom_preset_channels(s, 1)) return 1; + + // test delete without closing + del_aubio_sink_custom(s); + + s = new_aubio_sink_custom(sink_path, 0); + + if (aubio_sink_custom_preset_samplerate(s, samplerate)) return 1; + if (aubio_sink_custom_preset_channels(s, 3)) return 1; + + aubio_sink_custom_close(s); + // test closing twice + aubio_sink_custom_close(s); + + del_aubio_sink_custom(s); + + // delete temp file + close_temp_sink(sink_path, fd); + return run_on_default_source_and_sink(base_main); }