| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file | 
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a | 
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef PLATFORM_ASSERT_H_ | 5 #ifndef PLATFORM_ASSERT_H_ | 
| 6 #define PLATFORM_ASSERT_H_ | 6 #define PLATFORM_ASSERT_H_ | 
| 7 | 7 | 
| 8 // TODO(5411406): include sstream for now, once we have a Utils::toString() | 8 // TODO(5411406): include sstream for now, once we have a Utils::toString() | 
| 9 // implemented for all the primitive types we can replace the usage of | 9 // implemented for all the primitive types we can replace the usage of | 
| 10 // sstream by Utils::toString() | 10 // sstream by Utils::toString() | 
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 290 // or to make sure a struct is smaller than a certain size: | 290 // or to make sure a struct is smaller than a certain size: | 
| 291 // | 291 // | 
| 292 //   COMPILE_ASSERT(sizeof(foo) < 128); | 292 //   COMPILE_ASSERT(sizeof(foo) < 128); | 
| 293 // | 293 // | 
| 294 | 294 | 
| 295 template <bool> | 295 template <bool> | 
| 296 struct CompileAssert { | 296 struct CompileAssert { | 
| 297 }; | 297 }; | 
| 298 // Macro to concatenate two tokens. The helper is need to proper expansion | 298 // Macro to concatenate two tokens. The helper is need to proper expansion | 
| 299 // in case an argument is a macro itself. | 299 // in case an argument is a macro itself. | 
|  | 300 #if !defined(COMPILE_ASSERT) | 
| 300 #define COMPILE_ASSERT_JOIN(a, b) COMPILE_ASSERT_JOIN_HELPER(a, b) | 301 #define COMPILE_ASSERT_JOIN(a, b) COMPILE_ASSERT_JOIN_HELPER(a, b) | 
| 301 #define COMPILE_ASSERT_JOIN_HELPER(a, b) a##b | 302 #define COMPILE_ASSERT_JOIN_HELPER(a, b) a##b | 
| 302 #define COMPILE_ASSERT(expr)                                                   \ | 303 #define COMPILE_ASSERT(expr)                                                   \ | 
| 303   DART_UNUSED typedef CompileAssert<(static_cast<bool>(expr))>                 \ | 304   DART_UNUSED typedef CompileAssert<(static_cast<bool>(expr))>                 \ | 
| 304   COMPILE_ASSERT_JOIN(CompileAssertTypeDef, __LINE__)[static_cast<bool>(expr)  \ | 305   COMPILE_ASSERT_JOIN(CompileAssertTypeDef, __LINE__)[static_cast<bool>(expr)  \ | 
| 305   ? 1 : -1] | 306   ? 1 : -1] | 
|  | 307 #endif  // !defined(COMPILE_ASSERT) | 
| 306 | 308 | 
| 307 #if defined(TESTING) | 309 #if defined(TESTING) | 
| 308 | 310 | 
| 309 // EXPECT and FAIL are equivalent to ASSERT and FATAL except that they do not | 311 // EXPECT and FAIL are equivalent to ASSERT and FATAL except that they do not | 
| 310 // cause early termination of the unit test. This allows testing to proceed | 312 // cause early termination of the unit test. This allows testing to proceed | 
| 311 // further to be able to report other failures before reporting the overall | 313 // further to be able to report other failures before reporting the overall | 
| 312 // unit tests as failing. | 314 // unit tests as failing. | 
| 313 | 315 | 
| 314 #define EXPECT(condition)                                                      \ | 316 #define EXPECT(condition)                                                      \ | 
| 315   if (!(condition)) {                                                          \ | 317   if (!(condition)) {                                                          \ | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 354 | 356 | 
| 355 #define FAIL1(format, p1)                                                      \ | 357 #define FAIL1(format, p1)                                                      \ | 
| 356   dart::Expect(__FILE__, __LINE__).Fail(format, (p1)) | 358   dart::Expect(__FILE__, __LINE__).Fail(format, (p1)) | 
| 357 | 359 | 
| 358 #define FAIL2(format, p1, p2)                                                  \ | 360 #define FAIL2(format, p1, p2)                                                  \ | 
| 359   dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2)) | 361   dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2)) | 
| 360 | 362 | 
| 361 #endif  // defined(TESTING) | 363 #endif  // defined(TESTING) | 
| 362 | 364 | 
| 363 #endif  // PLATFORM_ASSERT_H_ | 365 #endif  // PLATFORM_ASSERT_H_ | 
| OLD | NEW | 
|---|