Changeset 0f5f40b


Ignore:
Timestamp:
Nov 24, 2018, 7:00:11 PM (8 months ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master
Children:
ce323e4
Parents:
e4e0861
Message:

[tests] run some tests in onset if no arguments passed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/src/onset/test-onset.c

    re4e0861 r0f5f40b  
    11#include <aubio.h>
    22#include "utils_tests.h"
     3
     4int test_wrong_params(void);
    35
    46int main (int argc, char **argv)
     
    79  if (argc < 2) {
    810    err = 2;
    9     PRINT_ERR("not enough arguments\n");
    10     PRINT_MSG("read a wave file as a mono vector\n");
     11    PRINT_WRN("no arguments, running tests\n");
     12    if (test_wrong_params() != 0) {
     13      PRINT_ERR("tests failed!\n");
     14      err = 1;
     15    } else {
     16      err = 0;
     17    }
    1118    PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]);
    1219    return err;
     
    6168  return err;
    6269}
     70
     71int test_wrong_params(void)
     72{
     73  uint_t win_size = 1024;
     74  uint_t hop_size = win_size / 2;
     75  uint_t samplerate = 44100;
     76  // hop_size < 1
     77  if (new_aubio_onset("default", 5, 0, samplerate))
     78    return 1;
     79  // buf_size < 2
     80  if (new_aubio_onset("default", 1, 1, samplerate))
     81    return 1;
     82  // buf_size < hop_size
     83  if (new_aubio_onset("default", hop_size, win_size, samplerate))
     84    return 1;
     85  // samplerate < 1
     86  if (new_aubio_onset("default", 1024, 512, 0))
     87    return 1;
     88
     89  // specdesc creation failed
     90  if (new_aubio_onset("abcd", win_size, win_size/2, samplerate))
     91    return 1;
     92  // pv creation failed
     93  if (new_aubio_onset("default", 5, 2, samplerate))
     94    return 1;
     95
     96  aubio_onset_t *o;
     97  o = new_aubio_onset("default", win_size, hop_size, samplerate);
     98  if (!aubio_onset_set_default_parameters(o, "wrong_type"))
     99    return 1;
     100  del_aubio_onset(o);
     101
     102  return 0;
     103}
Note: See TracChangeset for help on using the changeset viewer.