1 | /* |
2 | Copyright (c) 2005-2019 Intel Corporation |
3 | |
4 | Licensed under the Apache License, Version 2.0 (the "License"); |
5 | you may not use this file except in compliance with the License. |
6 | You may obtain a copy of the License at |
7 | |
8 | http://www.apache.org/licenses/LICENSE-2.0 |
9 | |
10 | Unless required by applicable law or agreed to in writing, software |
11 | distributed under the License is distributed on an "AS IS" BASIS, |
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | See the License for the specific language governing permissions and |
14 | limitations under the License. |
15 | */ |
16 | |
17 | // Just the assertion portion of the harness. |
18 | // This is useful for writing portions of tests that include |
19 | // the minimal number of necessary header files. |
20 | // |
21 | // The full "harness.h" must be included later. |
22 | |
23 | #ifndef harness_assert_H |
24 | #define harness_assert_H |
25 | |
26 | void ReportError( const char* filename, int line, const char* expression, const char* message); |
27 | void ReportWarning( const char* filename, int line, const char* expression, const char* message); |
28 | |
29 | #define ASSERT_CUSTOM(p,message,file,line) ((p)?(void)0:ReportError(file,line,#p,message)) |
30 | #define ASSERT(p,message) ASSERT_CUSTOM(p,message,__FILE__,__LINE__) |
31 | #define ASSERT_WARNING(p,message) ((p)?(void)0:ReportWarning(__FILE__,__LINE__,#p,message)) |
32 | |
33 | //! Compile-time error if x and y have different types |
34 | template<typename T> |
35 | void AssertSameType( const T& /*x*/, const T& /*y*/ ) {} |
36 | |
37 | #endif /* harness_assert_H */ |
38 | |