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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // argument. | 274 // argument. |
275 #define ASSERT(condition) do {} while (false && (condition)) | 275 #define ASSERT(condition) do {} while (false && (condition)) |
276 | 276 |
277 #define DEBUG_ASSERT(cond) | 277 #define DEBUG_ASSERT(cond) |
278 | 278 |
279 #define ASSERT_NOTNULL(ptr) (ptr) | 279 #define ASSERT_NOTNULL(ptr) (ptr) |
280 | 280 |
281 #endif // if defined(DEBUG) | 281 #endif // if defined(DEBUG) |
282 | 282 |
283 | 283 |
| 284 #define RELEASE_ASSERT(cond) \ |
| 285 do { \ |
| 286 if (!(cond)) dart::Assert(__FILE__, __LINE__).Fail("expected: %s", #cond); \ |
| 287 } while (false) |
| 288 |
| 289 |
284 // The COMPILE_ASSERT macro can be used to verify that a compile time | 290 // The COMPILE_ASSERT macro can be used to verify that a compile time |
285 // expression is true. For example, you could use it to verify the | 291 // expression is true. For example, you could use it to verify the |
286 // size of a static array: | 292 // size of a static array: |
287 // | 293 // |
288 // COMPILE_ASSERT(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES); | 294 // COMPILE_ASSERT(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES); |
289 // | 295 // |
290 // or to make sure a struct is smaller than a certain size: | 296 // or to make sure a struct is smaller than a certain size: |
291 // | 297 // |
292 // COMPILE_ASSERT(sizeof(foo) < 128); | 298 // COMPILE_ASSERT(sizeof(foo) < 128); |
293 // | 299 // |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 362 |
357 #define FAIL1(format, p1) \ | 363 #define FAIL1(format, p1) \ |
358 dart::Expect(__FILE__, __LINE__).Fail(format, (p1)) | 364 dart::Expect(__FILE__, __LINE__).Fail(format, (p1)) |
359 | 365 |
360 #define FAIL2(format, p1, p2) \ | 366 #define FAIL2(format, p1, p2) \ |
361 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2)) | 367 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2)) |
362 | 368 |
363 #endif // defined(TESTING) | 369 #endif // defined(TESTING) |
364 | 370 |
365 #endif // PLATFORM_ASSERT_H_ | 371 #endif // PLATFORM_ASSERT_H_ |
OLD | NEW |