Changeset abffec0


Ignore:
Timestamp:
Aug 20, 2015, 5:22:05 PM (9 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
a984461
Parents:
130b651
Message:

tests/src/test-delnull.c: improve test, avoid segfaults

File:
1 edited

Legend:

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

    r130b651 rabffec0  
    22#include "aubio.h"
    33
    4 // Because aubio does not check for double free, this program will crash.
    5 // Programs that call these functions should check for null pointers.
     4// When creating an aubio object, the user should check whether the object is
     5// set NULL, indicating the creation failed and the object was not allocated.
    66
    77int main (void)
    88{
    9   del_fvec(NULL);
    10   del_lvec(NULL);
    11   del_cvec(NULL);
    12   return 0;
     9  uint_t return_code = 0;
     10  fvec_t *f = new_fvec(-12);
     11  cvec_t *c = new_cvec(-12);
     12  lvec_t *l = new_lvec(-12);
     13  aubio_fft_t *fft = new_aubio_fft(-12);
     14  if (f != NULL) {
     15    return_code = 1;
     16  } else if (c != NULL) {
     17    return_code = 2;
     18  } else if (l != NULL) {
     19    return_code = 3;
     20  } else if (fft != NULL) {
     21    return_code = 3;
     22  }
     23  return return_code;
    1324}
Note: See TracChangeset for help on using the changeset viewer.