Qucs-core
0.0.19
|
00001 // Copyright 2006, Google Inc. 00002 // All rights reserved. 00003 // 00004 // Redistribution and use in source and binary forms, with or without 00005 // modification, are permitted provided that the following conditions are 00006 // met: 00007 // 00008 // * Redistributions of source code must retain the above copyright 00009 // notice, this list of conditions and the following disclaimer. 00010 // * Redistributions in binary form must reproduce the above 00011 // copyright notice, this list of conditions and the following disclaimer 00012 // in the documentation and/or other materials provided with the 00013 // distribution. 00014 // * Neither the name of Google Inc. nor the names of its 00015 // contributors may be used to endorse or promote products derived from 00016 // this software without specific prior written permission. 00017 // 00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00019 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00020 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00021 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00022 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00023 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00024 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00025 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00026 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00027 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00028 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 00030 // This file is AUTOMATICALLY GENERATED on 10/31/2011 by command 00031 // 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND! 00032 // 00033 // Implements a family of generic predicate assertion macros. 00034 00035 #ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ 00036 #define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ 00037 00038 // Makes sure this header is not included before gtest.h. 00039 #ifndef GTEST_INCLUDE_GTEST_GTEST_H_ 00040 # error Do not include gtest_pred_impl.h directly. Include gtest.h instead. 00041 #endif // GTEST_INCLUDE_GTEST_GTEST_H_ 00042 00043 // This header implements a family of generic predicate assertion 00044 // macros: 00045 // 00046 // ASSERT_PRED_FORMAT1(pred_format, v1) 00047 // ASSERT_PRED_FORMAT2(pred_format, v1, v2) 00048 // ... 00049 // 00050 // where pred_format is a function or functor that takes n (in the 00051 // case of ASSERT_PRED_FORMATn) values and their source expression 00052 // text, and returns a testing::AssertionResult. See the definition 00053 // of ASSERT_EQ in gtest.h for an example. 00054 // 00055 // If you don't care about formatting, you can use the more 00056 // restrictive version: 00057 // 00058 // ASSERT_PRED1(pred, v1) 00059 // ASSERT_PRED2(pred, v1, v2) 00060 // ... 00061 // 00062 // where pred is an n-ary function or functor that returns bool, 00063 // and the values v1, v2, ..., must support the << operator for 00064 // streaming to std::ostream. 00065 // 00066 // We also define the EXPECT_* variations. 00067 // 00068 // For now we only support predicates whose arity is at most 5. 00069 // Please email googletestframework@googlegroups.com if you need 00070 // support for higher arities. 00071 00072 // GTEST_ASSERT_ is the basic statement to which all of the assertions 00073 // in this file reduce. Don't use this in your code. 00074 00075 #define GTEST_ASSERT_(expression, on_failure) \ 00076 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ 00077 if (const ::testing::AssertionResult gtest_ar = (expression)) \ 00078 ; \ 00079 else \ 00080 on_failure(gtest_ar.failure_message()) 00081 00082 00083 // Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use 00084 // this in your code. 00085 template <typename Pred, 00086 typename T1> 00087 AssertionResult AssertPred1Helper(const char* pred_text, 00088 const char* e1, 00089 Pred pred, 00090 const T1& v1) { 00091 if (pred(v1)) return AssertionSuccess(); 00092 00093 return AssertionFailure() << pred_text << "(" 00094 << e1 << ") evaluates to false, where" 00095 << "\n" << e1 << " evaluates to " << v1; 00096 } 00097 00098 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1. 00099 // Don't use this in your code. 00100 #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\ 00101 GTEST_ASSERT_(pred_format(#v1, v1), \ 00102 on_failure) 00103 00104 // Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use 00105 // this in your code. 00106 #define GTEST_PRED1_(pred, v1, on_failure)\ 00107 GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \ 00108 #v1, \ 00109 pred, \ 00110 v1), on_failure) 00111 00112 // Unary predicate assertion macros. 00113 #define EXPECT_PRED_FORMAT1(pred_format, v1) \ 00114 GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_) 00115 #define EXPECT_PRED1(pred, v1) \ 00116 GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_) 00117 #define ASSERT_PRED_FORMAT1(pred_format, v1) \ 00118 GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_) 00119 #define ASSERT_PRED1(pred, v1) \ 00120 GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_) 00121 00122 00123 00124 // Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use 00125 // this in your code. 00126 template <typename Pred, 00127 typename T1, 00128 typename T2> 00129 AssertionResult AssertPred2Helper(const char* pred_text, 00130 const char* e1, 00131 const char* e2, 00132 Pred pred, 00133 const T1& v1, 00134 const T2& v2) { 00135 if (pred(v1, v2)) return AssertionSuccess(); 00136 00137 return AssertionFailure() << pred_text << "(" 00138 << e1 << ", " 00139 << e2 << ") evaluates to false, where" 00140 << "\n" << e1 << " evaluates to " << v1 00141 << "\n" << e2 << " evaluates to " << v2; 00142 } 00143 00144 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2. 00145 // Don't use this in your code. 00146 #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\ 00147 GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \ 00148 on_failure) 00149 00150 // Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use 00151 // this in your code. 00152 #define GTEST_PRED2_(pred, v1, v2, on_failure)\ 00153 GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \ 00154 #v1, \ 00155 #v2, \ 00156 pred, \ 00157 v1, \ 00158 v2), on_failure) 00159 00160 // Binary predicate assertion macros. 00161 #define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \ 00162 GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_) 00163 #define EXPECT_PRED2(pred, v1, v2) \ 00164 GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_) 00165 #define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \ 00166 GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_) 00167 #define ASSERT_PRED2(pred, v1, v2) \ 00168 GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_) 00169 00170 00171 00172 // Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use 00173 // this in your code. 00174 template <typename Pred, 00175 typename T1, 00176 typename T2, 00177 typename T3> 00178 AssertionResult AssertPred3Helper(const char* pred_text, 00179 const char* e1, 00180 const char* e2, 00181 const char* e3, 00182 Pred pred, 00183 const T1& v1, 00184 const T2& v2, 00185 const T3& v3) { 00186 if (pred(v1, v2, v3)) return AssertionSuccess(); 00187 00188 return AssertionFailure() << pred_text << "(" 00189 << e1 << ", " 00190 << e2 << ", " 00191 << e3 << ") evaluates to false, where" 00192 << "\n" << e1 << " evaluates to " << v1 00193 << "\n" << e2 << " evaluates to " << v2 00194 << "\n" << e3 << " evaluates to " << v3; 00195 } 00196 00197 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3. 00198 // Don't use this in your code. 00199 #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\ 00200 GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \ 00201 on_failure) 00202 00203 // Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use 00204 // this in your code. 00205 #define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\ 00206 GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \ 00207 #v1, \ 00208 #v2, \ 00209 #v3, \ 00210 pred, \ 00211 v1, \ 00212 v2, \ 00213 v3), on_failure) 00214 00215 // Ternary predicate assertion macros. 00216 #define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \ 00217 GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_) 00218 #define EXPECT_PRED3(pred, v1, v2, v3) \ 00219 GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_) 00220 #define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \ 00221 GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_) 00222 #define ASSERT_PRED3(pred, v1, v2, v3) \ 00223 GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_) 00224 00225 00226 00227 // Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use 00228 // this in your code. 00229 template <typename Pred, 00230 typename T1, 00231 typename T2, 00232 typename T3, 00233 typename T4> 00234 AssertionResult AssertPred4Helper(const char* pred_text, 00235 const char* e1, 00236 const char* e2, 00237 const char* e3, 00238 const char* e4, 00239 Pred pred, 00240 const T1& v1, 00241 const T2& v2, 00242 const T3& v3, 00243 const T4& v4) { 00244 if (pred(v1, v2, v3, v4)) return AssertionSuccess(); 00245 00246 return AssertionFailure() << pred_text << "(" 00247 << e1 << ", " 00248 << e2 << ", " 00249 << e3 << ", " 00250 << e4 << ") evaluates to false, where" 00251 << "\n" << e1 << " evaluates to " << v1 00252 << "\n" << e2 << " evaluates to " << v2 00253 << "\n" << e3 << " evaluates to " << v3 00254 << "\n" << e4 << " evaluates to " << v4; 00255 } 00256 00257 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4. 00258 // Don't use this in your code. 00259 #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\ 00260 GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \ 00261 on_failure) 00262 00263 // Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use 00264 // this in your code. 00265 #define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\ 00266 GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \ 00267 #v1, \ 00268 #v2, \ 00269 #v3, \ 00270 #v4, \ 00271 pred, \ 00272 v1, \ 00273 v2, \ 00274 v3, \ 00275 v4), on_failure) 00276 00277 // 4-ary predicate assertion macros. 00278 #define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \ 00279 GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_) 00280 #define EXPECT_PRED4(pred, v1, v2, v3, v4) \ 00281 GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_) 00282 #define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \ 00283 GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_) 00284 #define ASSERT_PRED4(pred, v1, v2, v3, v4) \ 00285 GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_) 00286 00287 00288 00289 // Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use 00290 // this in your code. 00291 template <typename Pred, 00292 typename T1, 00293 typename T2, 00294 typename T3, 00295 typename T4, 00296 typename T5> 00297 AssertionResult AssertPred5Helper(const char* pred_text, 00298 const char* e1, 00299 const char* e2, 00300 const char* e3, 00301 const char* e4, 00302 const char* e5, 00303 Pred pred, 00304 const T1& v1, 00305 const T2& v2, 00306 const T3& v3, 00307 const T4& v4, 00308 const T5& v5) { 00309 if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess(); 00310 00311 return AssertionFailure() << pred_text << "(" 00312 << e1 << ", " 00313 << e2 << ", " 00314 << e3 << ", " 00315 << e4 << ", " 00316 << e5 << ") evaluates to false, where" 00317 << "\n" << e1 << " evaluates to " << v1 00318 << "\n" << e2 << " evaluates to " << v2 00319 << "\n" << e3 << " evaluates to " << v3 00320 << "\n" << e4 << " evaluates to " << v4 00321 << "\n" << e5 << " evaluates to " << v5; 00322 } 00323 00324 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5. 00325 // Don't use this in your code. 00326 #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\ 00327 GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \ 00328 on_failure) 00329 00330 // Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use 00331 // this in your code. 00332 #define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\ 00333 GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \ 00334 #v1, \ 00335 #v2, \ 00336 #v3, \ 00337 #v4, \ 00338 #v5, \ 00339 pred, \ 00340 v1, \ 00341 v2, \ 00342 v3, \ 00343 v4, \ 00344 v5), on_failure) 00345 00346 // 5-ary predicate assertion macros. 00347 #define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \ 00348 GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_) 00349 #define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \ 00350 GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_) 00351 #define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \ 00352 GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_) 00353 #define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \ 00354 GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_) 00355 00356 00357 00358 #endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_