/* Copyright (C) 2008 Emmanuel Varoquaux This file is part of XOS. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef COMMON_H #define COMMON_H #include extern int status; int test(const char *file, int line, const char *expr, int retval, int exp_errnum, int stop_on_error); void *test_ptr(const char *file, int line, const char *expr, void *retval, int exp_errnum, int stop_on_error); void _assert(const char *file, int line, const char *expr, int test_status, int stop_on_error); #define TEST(expr, exp_errnum) test(__FILE__, __LINE__, #expr, (expr), (exp_errnum), STOP_ON_ERROR) #define TEST_PTR(expr, exp_errnum) test_ptr(__FILE__, __LINE__, #expr, (expr), (exp_errnum), STOP_ON_ERROR) #define ASSERT(expr) _assert(__FILE__, __LINE__, #expr, (expr), STOP_ON_ERROR) #define NEWLINE() putchar('\n') #endif