source: tests/src/test-mathutils-window.c @ 6f330f12

feature/crepe_org
Last change on this file since 6f330f12 was 776d65b, checked in by Paul Brossier <piem@piem.org>, 6 years ago

[tests] test-mathutils-window input validation

  • Property mode set to 100644
File size: 906 bytes
Line 
1#include "aubio.h"
2#include "utils_tests.h"
3
4int main (void)
5{
6  uint_t length = 0;
7  uint_t n_length = 4, n_types = 10, i, t;
8  uint_t lengths[4] = { 8, 10, 15, 16 };
9  char *method = "default";
10  char *window_types[11] = { "default",
11    "ones", "rectangle", "hamming", "hanning", "hanningz",
12    "blackman", "blackman_harris", "gaussian", "welch", "parzen"};
13
14  for ( t = 0; t < n_types; t ++ ) {
15    for ( i = 0; i < n_length; i++)
16    {
17      length = lengths[i];
18      method = window_types[t];
19
20      fvec_t * window = new_aubio_window(method, length);
21
22      fvec_set_window(window, method);
23      fprintf(stdout, "length: %d, method: %s, window:, ", length, method);
24      fvec_print(window);
25
26      del_fvec(window);
27    }
28  }
29
30  assert (new_aubio_window("parzen", -1) == NULL);
31  assert (new_aubio_window(NULL, length) == NULL);
32  assert (new_aubio_window("\0", length) == NULL);
33  return 0;
34}
35
Note: See TracBrowser for help on using the repository browser.