Aliases added to some graphToEps() named params.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2008
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
21 #include <lemon/error.h>
22 #include "test_tools.h"
24 using namespace lemon;
26 #ifdef LEMON_ENABLE_ASSERTS
27 #undef LEMON_ENABLE_ASSERTS
30 #ifdef LEMON_DISABLE_ASSERTS
31 #undef LEMON_DISABLE_ASSERTS
34 //checking disabled asserts
35 #define LEMON_DISABLE_ASSERTS
36 #include <lemon/assert.h>
38 void no_assertion_text_disable() {
39 LEMON_ASSERT(true, "This is a fault message");
42 void no_assertion_exception_disable() {
43 LEMON_ASSERT(true, Exception());
46 void assertion_text_disable() {
47 LEMON_ASSERT(false, "This is a fault message");
50 void assertion_exception_disable() {
51 LEMON_ASSERT(false, Exception());
54 void fixme_disable() {
55 LEMON_FIXME("fixme_disable() is fixme!");
58 void check_assertion_disable() {
59 no_assertion_text_disable();
60 no_assertion_exception_disable();
61 assertion_exception_disable();
62 assertion_text_disable();
65 #undef LEMON_DISABLE_ASSERTS
68 #define LEMON_ASSERT_ERROR
69 #include <lemon/assert.h>
71 void no_assertion_text_error() {
72 LEMON_ASSERT(true, "This is a fault message");
75 void no_assertion_exception_error() {
76 LEMON_ASSERT(true, Exception());
79 void assertion_text_error() {
80 LEMON_ASSERT(false, "This is a fault message");
83 void assertion_exception_error() {
84 LEMON_ASSERT(false, Exception());
88 LEMON_FIXME("fixme_error() is fixme!");
91 void check_assertion_error() {
92 no_assertion_text_error();
93 no_assertion_exception_error();
95 assertion_exception_error();
96 check(false, "Assertion error");
97 } catch (const AssertionFailedError& e) {
101 assertion_text_error();
102 check(false, "Assertion error");
103 } catch (const AssertionFailedError& e) {
108 check(false, "Assertion error");
109 } catch (const AssertionFailedError& e) {
112 #undef LEMON_ASSERT_ERROR
114 #define LEMON_ASSERT_EXCEPTION
115 #include <lemon/assert.h>
117 void no_assertion_text_exception() {
118 LEMON_ASSERT(true, "This is a fault message");
121 void no_assertion_exception_exception() {
122 LEMON_ASSERT(true, Exception());
125 void assertion_text_exception() {
126 LEMON_ASSERT(false, "This is a fault message");
129 void assertion_exception_exception() {
130 LEMON_ASSERT(false, Exception());
133 void fixme_exception() {
134 LEMON_FIXME("fixme_exception() is fixme!");
137 void check_assertion_exception() {
138 no_assertion_text_exception();
139 no_assertion_exception_exception();
141 assertion_exception_exception();
142 check(false, "Assertion error");
143 } catch (const Exception& e) {
147 assertion_text_exception();
148 check(false, "Assertion error");
149 } catch (const AssertionFailedError& e) {
153 assertion_text_exception();
154 check(false, "Assertion error");
155 } catch (const AssertionFailedError& e) {
160 check(false, "Assertion error");
161 } catch (const AssertionFailedError& e) {
164 #undef LEMON_ASSERT_EXCEPTION
166 #define LEMON_ASSERT_LOG
168 #include <lemon/assert.h>
170 void no_assertion_text_log() {
171 LEMON_ASSERT(true, "This is a fault message");
174 void no_assertion_exception_log() {
175 LEMON_ASSERT(true, Exception());
178 void assertion_text_log() {
179 LEMON_ASSERT(false, "This is a fault message");
182 void assertion_exception_log() {
183 LEMON_ASSERT(false, Exception());
187 LEMON_FIXME("fixme_log() is fixme!");
190 void check_assertion_log() {
191 no_assertion_text_log();
192 no_assertion_exception_log();
193 std::cerr << "The next 3 failure messages are expected: " << std::endl;
194 assertion_exception_log();
195 assertion_text_log();
197 std::cerr << "End of expected error messages" << std::endl;
199 #undef LEMON_ASSERT_LOG
201 #define LEMON_ASSERT_CUSTOM
204 void my_assert_handler(const char*, int, const char*,
205 const char*, const char*) {
209 void my_assert_handler(const char*, int, const char*,
210 const std::exception&, const char*) {
214 void my_assert_handler(const char*, int, const char*,
215 const std::string&, const char*) {
220 #define LEMON_CUSTOM_ASSERT_HANDLER my_assert_handler
221 #include <lemon/assert.h>
223 void no_assertion_text_custom() {
224 LEMON_ASSERT(true, "This is a fault message");
227 void no_assertion_exception_custom() {
228 LEMON_ASSERT(true, Exception());
231 void assertion_text_custom() {
232 LEMON_ASSERT(false, "This is a fault message");
235 void assertion_exception_custom() {
236 LEMON_ASSERT(false, Exception());
239 void fixme_custom() {
240 LEMON_FIXME("fixme_custom() is fixme!");
243 void check_assertion_custom() {
244 no_assertion_text_custom();
245 no_assertion_exception_custom();
246 assertion_exception_custom();
247 assertion_text_custom();
249 check(cnt == 3, "The custom assert handler does not work");
252 #undef LEMON_ASSERT_CUSTOM
256 check_assertion_disable();
257 check_assertion_error();
258 check_assertion_exception();
259 check_assertion_log();
260 check_assertion_custom();