blob: c898abbdf360cf89d42da2f9e71e7cf24b30f36f [file] [log] [blame]
#ifndef MARISA_ASSERT_H_
#define MARISA_ASSERT_H_
#include <stdio.h>
#include <stdlib.h>
#define ASSERT(cond) (void)((!!(cond)) || \
(printf("%d: Assertion `%s' failed.\n", __LINE__, #cond), exit(-1), 0))
#define EXCEPT(code, expected_status) try { \
code; \
printf("%d: Exception `%s' failed.\n", __LINE__, #code); \
exit(-1); \
} catch (const marisa::Exception &ex) { \
ASSERT(ex.status() == expected_status); \
}
#define TEST_START() \
printf("%s:%d: %s(): ", __FILE__, __LINE__, __FUNCTION__)
#define TEST_END() \
printf("ok\n")
#endif // MARISA_ASSERT_H_