1 #ifndef CHECK_AEC_H 2 #define CHECK_AEC_H 1 3 4 #include <config.h> 5 #include "libaec.h" 6 7 struct test_state { 8 int (* codec)(struct test_state *state); 9 int id; 10 int id_len; 11 int bytes_per_sample; 12 unsigned char *ubuf; 13 unsigned char *cbuf; 14 unsigned char *obuf; 15 size_t ibuf_len; /* input buffer length may be shorter than buf_len */ 16 size_t buf_len; 17 size_t cbuf_len; 18 long long int xmax; 19 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 struct aec_stream *strm; 23 }; 24 25 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 #ifndef HAVE_SNPRINTF 30 #ifdef HAVE__SNPRINTF_S 31 #define snprintf(d, n, ...) _snprintf_s((d), (n), _TRUNCATE, __VA_ARGS__) 32 #else 33 #ifdef HAVE__SNPRINTF 34 #define snprintf _snprintf 35 #else 36 #error "no snprintf compatible function found" 37 #endif /* HAVE__SNPRINTF */ 38 #endif /* HAVE__SNPRINTF_S */ 39 #endif /* HAVE_SNPRINTF */ 40 41 #ifdef _WIN32 42 #define CHECK_PASS "PASS" 43 #define CHECK_FAIL "FAIL" 44 #else 45 #define CHECK_PASS "[0;32mPASS[0m" 46 #define CHECK_FAIL "[0;31mFAIL[0m" 47 #endif 48 49 #endif /* CHECK_AEC_H */ 50