check_aec.h 1.22 KB
Newer Older
1
#ifndef CHECK_AEC_H
2
#define CHECK_AEC_H 1
3 4

#include <config.h>
5 6 7
#include "libaec.h"

struct test_state {
8
    int (* codec)(struct test_state *state);
9
    int id;
10
    int id_len;
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
11
    int bytes_per_sample;
12 13 14 15 16 17 18 19
    unsigned char *ubuf;
    unsigned char *cbuf;
    unsigned char *obuf;
    size_t ibuf_len; /* input buffer legth may be shorter than buf_len */
    size_t buf_len;
    size_t cbuf_len;
    long long int xmax;
    long long int xmin;
20
    void (*out)(unsigned char *dest, unsigned long long int val, int size);
21
    int dump; /* dump buffer to file for fuzzing corpus */
22 23 24 25
    struct aec_stream *strm;
};

int update_state(struct test_state *state);
26
int encode_decode_small(struct test_state *state);
27
int encode_decode_large(struct test_state *state);
28

29 30 31 32 33 34 35 36 37 38 39 40
#ifndef HAVE_SNPRINTF
#ifdef HAVE__SNPRINTF_S
#define snprintf(d, n, ...) _snprintf_s((d), (n), _TRUNCATE, __VA_ARGS__)
#else
#ifdef HAVE__SNPRINTF
#define snprintf _snprintf
#else
#error "no snprintf compatible function found"
#endif /* HAVE__SNPRINTF */
#endif /* HAVE__SNPRINTF_S */
#endif /* HAVE_SNPRINTF */

Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
41 42 43 44
#ifdef _WIN32
#define CHECK_PASS "PASS"
#define CHECK_FAIL "FAIL"
#else
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
45 46
#define CHECK_PASS "PASS"
#define CHECK_FAIL "FAIL"
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
47
#endif
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
48

49
#endif /* CHECK_AEC_H */