| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkTFitsIn.h" |
| 9 #include "SkTypes.h" |
| 8 #include "Test.h" | 10 #include "Test.h" |
| 9 #include "SkTypes.h" | |
| 10 #include "SkTFitsIn.h" | |
| 11 | 11 |
| 12 #include <limits> | 12 #include <limits> |
| 13 | 13 |
| 14 #define TEST(S, s, D, expected) REPORTER_ASSERT(reporter, (SkTFitsIn<D>((S)(s))
== (expected))) | 14 #define TEST(S, s, D, expected) REPORTER_ASSERT(reporter, (SkTFitsIn<D>((S)(s))
== (expected))) |
| 15 | 15 |
| 16 DEF_TEST(FitsIn, reporter) { | 16 DEF_TEST(FitsIn, reporter) { |
| 17 TEST(int32_t, 1, int8_t, true); | 17 TEST(int32_t, 1, int8_t, true); |
| 18 TEST(int32_t, -1, int8_t, true); | 18 TEST(int32_t, -1, int8_t, true); |
| 19 TEST(int32_t, (int32_t)(std::numeric_limits<int8_t>::max)(), int8_t, tru
e); | 19 TEST(int32_t, (int32_t)(std::numeric_limits<int8_t>::max)(), int8_t, tru
e); |
| 20 TEST(int32_t, ((int32_t)(std::numeric_limits<int8_t>::max)())+1, int8_t, fal
se); | 20 TEST(int32_t, ((int32_t)(std::numeric_limits<int8_t>::max)())+1, int8_t, fal
se); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 TEST(uint64_t, 1, int8_t, true); | 60 TEST(uint64_t, 1, int8_t, true); |
| 61 TEST(uint64_t, 1, uint8_t, true); | 61 TEST(uint64_t, 1, uint8_t, true); |
| 62 TEST(uint64_t, 1, int32_t, true); | 62 TEST(uint64_t, 1, int32_t, true); |
| 63 TEST(uint64_t, 1, uint32_t, true); | 63 TEST(uint64_t, 1, uint32_t, true); |
| 64 TEST(uint64_t, 1, int64_t, true); | 64 TEST(uint64_t, 1, int64_t, true); |
| 65 TEST(uint64_t, 1, uint64_t, true); | 65 TEST(uint64_t, 1, uint64_t, true); |
| 66 | 66 |
| 67 // Uncommenting the following should cause compile failures. | 67 // Uncommenting the following should cause compile failures. |
| 68 //TEST(float, 1, uint64_t, true); | 68 //TEST(float, 1, uint64_t, true); |
| 69 } | 69 } |
| OLD | NEW |