]>
git.saurik.com Git - apple/security.git/blob - regressions/test/testcpp.h
2 * Copyright (c) 2005-2007 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
33 #define no_throw(THIS, TESTNAME) \
36 try { THIS; _this = true; } catch (...) { _this = false; } \
37 test_ok(_this, TESTNAME, test_directive, test_reason, \
39 "# got: <unknown exception>\n" \
40 "# expected: <no throw>\n"); \
42 #define does_throw(THIS, TESTNAME) \
45 try { THIS; _this = false; } catch (...) { _this = true; } \
46 test_ok(_this, TESTNAME, test_directive, test_reason, \
48 "# got: <no throw>\n" \
49 "# expected: <any exception>\n"); \
51 #define is_throw(THIS, CLASS, METHOD, VALUE, TESTNAME) \
57 _this = test_ok(false, TESTNAME, test_directive, test_reason, \
59 "# got: <no throw>\n" \
60 "# expected: %s.%s == %s\n", \
61 #CLASS, #METHOD, #VALUE); \
63 catch (const CLASS &_exception) \
65 _this = test_ok(_exception.METHOD == (VALUE), TESTNAME, \
66 test_directive, test_reason, __FILE__, __LINE__, \
68 "# expected: %s.%s == %s\n", \
69 _exception.METHOD, #CLASS, #METHOD, #VALUE); \
73 _this = test_ok(false, TESTNAME, test_directive, test_reason, \
75 "# got: <unknown exception>\n" \
76 "# expected: %s.%s == %s\n", \
77 #CLASS, #METHOD, #VALUE); \
81 #endif /* __cplusplus */
83 #endif /* !_TESTCPP_H_ */