2 * Copyright (C) 2005, 2006, 2007, 2009, 2010,
3 * 2011, 2012 Free Software Foundation, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "gnashconfig.h"
30 #define HAVE_DEJAGNU_H 1 // we ship our own now...
34 #define info(x) note x
37 //#warning "You should install DejaGnu! Using stubs for pass/fail/xpass/xfail..."
41 void pass(std::string s
) { std::cout
<< "PASSED: " << s
<< std::endl
; };
42 void xpass(std::string s
) { std::cout
<< "XPASSED: " << s
<< std::endl
; };
43 void fail(std::string s
) { std::cout
<< "FAILED: " << s
<< std::endl
; };
44 void xfail(std::string s
) { std::cout
<< "XFAILED: " << s
<< std::endl
; };
45 void unresolved(std::string s
) { std::cout
<< "UNRESOLVED: " << s
<< std::endl
; };
48 #define info(x) { printf("NOTE: "); printf x; putchar('\n'); }
54 #define check_equals_label(label, expr, expected) \
56 std::stringstream ss; \
57 if ( ! label.empty() ) ss << label << ": "; \
58 if ( expr == expected ) \
60 ss << #expr << " == " << expected; \
61 ss << " [" << __FILE__ << ":" << __LINE__ << "]"; \
62 _runtest.pass(ss.str().c_str()); \
66 ss << #expr << " == '" << expr << "' (expected: " \
68 ss << " [" << __FILE__ << ":" << __LINE__ << "]"; \
69 _runtest.fail(ss.str().c_str()); \
73 #define xcheck_equals_label(label, expr, expected) \
75 std::stringstream ss; \
76 if ( label != "" ) ss << label << ": "; \
77 if ( expr == expected ) \
79 ss << #expr << " == " << expected; \
80 ss << " [" << __FILE__ << ":" << __LINE__ << "]"; \
81 _runtest.xpass(ss.str().c_str()); \
85 ss << #expr << " == '" << expr << "' (expected: " \
87 ss << " [" << __FILE__ << ":" << __LINE__ << "]"; \
88 _runtest.xfail(ss.str().c_str()); \
92 #define check_equals(expr, expected) check_equals_label(std::string(), expr, expected)
94 #define xcheck_equals(expr, expected) xcheck_equals_label(std::string(), expr, expected)
98 std::stringstream ss; \
100 ss << " [" << __FILE__ << ":" << __LINE__ << "]"; \
102 _runtest.pass(ss.str().c_str()); \
104 _runtest.fail(ss.str().c_str()); \
108 #define xcheck(expr) \
110 std::stringstream ss; \
112 ss << " [" << __FILE__ << ":" << __LINE__ << "]"; \
114 _runtest.xpass(ss.str().c_str()); \
116 _runtest.xfail(ss.str().c_str()); \