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 15 matching lines...) Expand all Loading... |
26 class DynamicAssertionHelper { | 26 class DynamicAssertionHelper { |
27 public: | 27 public: |
28 enum Kind { | 28 enum Kind { |
29 ASSERT, | 29 ASSERT, |
30 EXPECT | 30 EXPECT |
31 }; | 31 }; |
32 | 32 |
33 DynamicAssertionHelper(const char* file, int line, Kind kind) | 33 DynamicAssertionHelper(const char* file, int line, Kind kind) |
34 : file_(file), line_(line), kind_(kind) { } | 34 : file_(file), line_(line), kind_(kind) { } |
35 | 35 |
36 void Fail(const char* format, ...); | 36 void Fail(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
37 | 37 |
38 #if defined(TESTING) | 38 #if defined(TESTING) |
39 template<typename E, typename A> | 39 template<typename E, typename A> |
40 void Equals(const E& expected, const A& actual); | 40 void Equals(const E& expected, const A& actual); |
41 | 41 |
42 template<typename E, typename A> | 42 template<typename E, typename A> |
43 void NotEquals(const E& not_expected, const A& actual); | 43 void NotEquals(const E& not_expected, const A& actual); |
44 | 44 |
45 template<typename E, typename A, typename T> | 45 template<typename E, typename A, typename T> |
46 void FloatEquals(const E& expected, const A& actual, const T& tol); | 46 void FloatEquals(const E& expected, const A& actual, const T& tol); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 #define WARN(error) \ | 342 #define WARN(error) \ |
343 dart::Expect(__FILE__, __LINE__).Fail("%s", error) | 343 dart::Expect(__FILE__, __LINE__).Fail("%s", error) |
344 | 344 |
345 #define WARN1(format, p1) \ | 345 #define WARN1(format, p1) \ |
346 dart::Expect(__FILE__, __LINE__).Fail(format, (p1)) | 346 dart::Expect(__FILE__, __LINE__).Fail(format, (p1)) |
347 | 347 |
348 #define WARN2(format, p1, p2) \ | 348 #define WARN2(format, p1, p2) \ |
349 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2)) | 349 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2)) |
350 | 350 |
351 #endif // PLATFORM_ASSERT_H_ | 351 #endif // PLATFORM_ASSERT_H_ |
OLD | NEW |