/*
 *  Copyright (C)  2000-2001 Marc Wandschneider <mw@kiltdown.org>
 *
 *  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.
 *
 *  For more information look at the file COPYRIGHT in this package
 *
 */
#ifndef _ASSERT_H_

#ifdef K_DEBUG

void errorFailedAssertion(const char *, const char *, const char *, int );


#define K_ASSERT(condition, message) \
	if (!(condition)) errorFailedAssertion(#condition, __FILE__, (message), __LINE__)
	
#define K_FAIL(message)		errorFailedAssertion(NULL, __FILE__, (message), __LINE__)

#define DEBUG_TEST_DECL        private:\
                                    const char *debugAllocation
#define DEBUG_TEST_START        this->debugAllocation = (const char *)localAlloc(2)
#define DEBUG_TEST_STOP         if (this->debugAllocation) localFree(this->debugAllocation), this->debugAllocation = NULL

#else // K_DEBUG


#define K_ASSERT(condition, message)
#define K_FAIL(message)

#define DEBUG_TEST_DECL
#define DEBUG_TEST_START
#define DEBUG_TEST_STOP

#endif // K_DEBUG

#define _ASSERT_H_
#endif // _ASSERT_H_


syntax highlighted by Code2HTML, v. 0.9.1