| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 return true; | 47 return true; |
| 48 } | 48 } |
| 49 | 49 |
| 50 ::testing::AssertionResult AssertAlmostEqual(const char* expr, | 50 ::testing::AssertionResult AssertAlmostEqual(const char* expr, |
| 51 const char* n_expr, | 51 const char* n_expr, |
| 52 const FloatBox& m, | 52 const FloatBox& m, |
| 53 const FloatBox& n) { | 53 const FloatBox& n) { |
| 54 if (!ApproximatelyEqual(m, n)) { | 54 if (!ApproximatelyEqual(m, n)) { |
| 55 return ::testing::AssertionFailure() | 55 return ::testing::AssertionFailure() |
| 56 << " Value of:" << n_expr << std::endl | 56 << " Value of:" << n_expr << std::endl |
| 57 << " Actual:" << testing::PrintToString(n) << std::endl | 57 << " Actual:" << ::testing::PrintToString(n) << std::endl |
| 58 << "Expected Approx:" << expr << std::endl | 58 << "Expected Approx:" << expr << std::endl |
| 59 << " Which is:" << ::testing::PrintToString(m); | 59 << " Which is:" << ::testing::PrintToString(m); |
| 60 } | 60 } |
| 61 return ::testing::AssertionSuccess(); | 61 return ::testing::AssertionSuccess(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 ::testing::AssertionResult AssertContains(const char* expr, | 64 ::testing::AssertionResult AssertContains(const char* expr, |
| 65 const char* n_expr, | 65 const char* n_expr, |
| 66 const FloatBox& m, | 66 const FloatBox& m, |
| 67 const FloatBox& n) { | 67 const FloatBox& n) { |
| 68 FloatBox new_m = m; | 68 FloatBox new_m = m; |
| 69 new_m.ExpandTo(n); | 69 new_m.ExpandTo(n); |
| 70 if (!ApproximatelyEqual(m, new_m)) { | 70 if (!ApproximatelyEqual(m, new_m)) { |
| 71 return ::testing::AssertionFailure() | 71 return ::testing::AssertionFailure() |
| 72 << " Value of:" << n_expr << std::endl | 72 << " Value of:" << n_expr << std::endl |
| 73 << " Actual:" << testing::PrintToString(n) << std::endl | 73 << " Actual:" << ::testing::PrintToString(n) << std::endl |
| 74 << "Not Contained in:" << expr << std::endl | 74 << "Not Contained in:" << expr << std::endl |
| 75 << " Which is:" << ::testing::PrintToString(m); | 75 << " Which is:" << ::testing::PrintToString(m); |
| 76 } | 76 } |
| 77 return ::testing::AssertionSuccess(); | 77 return ::testing::AssertionSuccess(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace FloatBoxTest | 80 } // namespace FloatBoxTest |
| 81 } // namespace blink | 81 } // namespace blink |
| OLD | NEW |