summaryrefslogtreecommitdiff
path: root/ext/dsent/libutil/Assert.h
blob: 0fdd364b2a39093774a067beed980a8ddd83391d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef __ASSERT_H__
#define __ASSERT_H__

#include "String.h"
#include "Exception.h"

#ifdef NDEBUG
#define ASSERT(test_value_,exception_msg_)
#else
#define ASSERT(test_value_,msg_) \
    do \
    { \
        if(!(test_value_)) \
        { \
            const LibUtil::String& exception_msg = LibUtil::String::format("\nAt %s:%d\n", __FILE__, __LINE__) + (String)(msg_); \
            throw LibUtil::Exception(exception_msg); \
        } \
    } while(0);
#endif

#endif // __ASSERT_H__