shithub: aubio

Download patch

ref: 633a40817e65660dcfb3f2237a4a1a39a22edee5
parent: 46a1e34d5888da40de92ef6d507b9d97c51ba6d3
author: Paul Brossier <piem@piem.org>
date: Sat Dec 15 22:47:53 EST 2018

[tests] improve sink_custom tests

--- a/tests/src/io/base-sink_custom.h
+++ b/tests/src/io/base-sink_custom.h
@@ -63,6 +63,40 @@
 
 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);
 }