15#define TEST(S, s, D, expected) REPORTER_ASSERT(reporter, (SkTFitsIn<D>((S)(s)) == (expected)))
24 TEST(uint16_t, 257, int8_t,
false);
26 TEST(int32_t, 1, int8_t,
true);
27 TEST(int32_t, -1, int8_t,
true);
33 TEST(int32_t, 1, uint8_t,
true);
34 TEST(int32_t, -1, uint8_t,
false);
37 TEST(int32_t, 0, uint8_t,
true);
38 TEST(int32_t, -1, uint8_t,
false);
39 TEST(int32_t, -127, uint8_t,
false);
40 TEST(int32_t, -128, uint8_t,
false);
45 TEST(int32_t, 1000, int8_t,
false);
46 TEST(int32_t, 1000, uint8_t,
false);
48 TEST(int32_t, 1, int32_t,
true);
49 TEST(int32_t, -1, int32_t,
true);
50 TEST(int32_t, 1, uint32_t,
true);
51 TEST(int32_t, -1, uint32_t,
false);
53 TEST(int32_t, 1, int64_t,
true);
54 TEST(int32_t, -1, int64_t,
true);
55 TEST(int32_t, 1, uint64_t,
true);
56 TEST(int32_t, -1, uint64_t,
false);
58 TEST(uint32_t, 1, int8_t,
true);
59 TEST(uint32_t, 1, uint8_t,
true);
60 TEST(uint32_t, 1, int32_t,
true);
61 TEST(uint32_t, 1, uint32_t,
true);
62 TEST(uint32_t, 1, int64_t,
true);
63 TEST(uint32_t, 1, uint64_t,
true);
72 TEST(uint64_t, 1, int8_t,
true);
73 TEST(uint64_t, 1, uint8_t,
true);
74 TEST(uint64_t, 1, int32_t,
true);
75 TEST(uint64_t, 1, uint32_t,
true);
76 TEST(uint64_t, 1, int64_t,
true);
77 TEST(uint64_t, 1, uint64_t,
true);
79 enum class E :
int { n1 = -1, p1 = 1 };
80 TEST(
E, E::p1,
int,
true);
81 TEST(
E, E::n1,
int,
true);
82 TEST(
int, -1,
E,
true);
83 TEST(
int, 1,
E,
true);
84 TEST(
E, E::p1,
unsigned,
true);
85 TEST(
E, E::n1,
unsigned,
false);
DEF_TEST(FitsIn, reporter)
#define TEST(S, s, D, expected)
static float max(float r, float g, float b)
static float min(float r, float g, float b)