]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/blob - libkmstest/test.h
libkmstest: move color bar code to libkmstest
[android/external-libkmsxx.git] / libkmstest / test.h
1 #pragma once
3 #include "color.h"
4 #include "conv.h"
5 #include "testpat.h"
6 #include "colorbar.h"
8 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
10 #define unlikely(x) __builtin_expect(!!(x), 0)
12 static void ASSERT_FAIL(const char *cond, const char *file,
13                            unsigned int line, const char *func) __attribute__ ((__noreturn__));
15 static void ASSERT_FAIL(const char *cond, const char *file,
16                            unsigned int line, const char *func)
17 {
18         fprintf(stderr, "%s:%d: %s: ASSERT(%s) failed\n", file, line, func, cond);
19         abort();
20 }
22 #define ASSERT(x) if (unlikely(!(x))) { ASSERT_FAIL( __STRING(x), __FILE__, __LINE__, __PRETTY_FUNCTION__); }
24 static void FAIL_IF_FAIL(const char *txt, const char *file,
25                            unsigned int line, const char *func) __attribute__ ((__noreturn__));
27 static void FAIL_IF_FAIL(const char *txt, const char *file,
28                            unsigned int line, const char *func)
29 {
30         fprintf(stderr, "%s:%d: %s: FAIL: %s\n", file, line, func, txt);
31         abort();
32 }
34 #define FAIL_IF(x, y) if (unlikely(x)) { FAIL_IF_FAIL(y, __FILE__, __LINE__, __PRETTY_FUNCTION__); }