#ifndef __ASSERTIONS_H__
#define __ASSERTIONS_H__

 // DISABLE_ASSERTIONS macro disables all contract validations
 //   (assertions, preconditions, postconditions, and invariants).
 //
#ifdef DISABLE_ASSERTIONS

#define DEFINE_THIS_FILE
#define ASSERT(ignore_)  ((void)0)
#define ALLEGE(test_)    ((void)(test_))

#else //  Assertions are defined

// callback invoked in case of assertion failure */
void AssertionFailure(char const *file, unsigned line);

#define DEFINE_THIS_FILE \
		static char const THIS_FILE__[] = __FILE__

#define ASSERT(test_) \
		((test_) ? (void)0 : AssertionFailure(THIS_FILE__, __LINE__))

#define ALLEGE(test_)    ASSERT(test_)

#endif // of DISABLE_ASSERTIONS

#define REQUIRE(test_)   ASSERT(test_)
#define ENSURE(test_)    ASSERT(test_)
#define INVARIANT(test_) ASSERT(test_)

#endif // __ASSERTIONS_H__
