source: tests/src/test-fvec.c @ b65230a

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change on this file since b65230a was 986131d, checked in by Eduard Müller <mueller.eduard@googlemail.com>, 7 years ago

Intel IPP support for aubio

See emuell/aubio/ intel_ipp2 for details please

  • Property mode set to 100644
File size: 886 bytes
Line 
1#include "aubio.h"
2#include "utils_tests.h"
3
4int main (void)
5{
6  aubio_init();
7
8  uint_t vec_size = 10, i;
9  fvec_t * vec = new_fvec (vec_size);
10
11  // vec->length matches requested size
12  assert(vec->length == vec_size);
13
14  // all elements are initialized to `0.`
15  for ( i = 0; i < vec->length; i++ ) {
16    assert(vec->data[i] == 0.);
17  }
18
19  // all elements can be set to `0.`
20  fvec_zeros(vec);
21  for ( i = 0; i < vec->length; i++ ) {
22    assert(vec->data[i] == 0.);
23  }
24  fvec_print(vec);
25
26  // all elements can be set to `1.`
27  fvec_ones(vec);
28  for ( i = 0; i < vec->length; i++ ) {
29    assert(vec->data[i] == 1.);
30  }
31  fvec_print(vec);
32
33  // each element can be accessed directly
34  for ( i = 0; i < vec->length; i++ ) {
35    vec->data[i] = i;
36    assert(vec->data[i] == i);
37  }
38  fvec_print(vec);
39
40  // now destroys the vector
41  del_fvec(vec);
42
43  aubio_cleanup();
44
45  return 0;
46}
47
Note: See TracBrowser for help on using the repository browser.