@@ -58,7 +58,7 @@ struct IntNTestParamNames {
58
58
}
59
59
};
60
60
61
- using IntNTypes = ::testing::Types<int2, uint2, int4, uint4>;
61
+ using IntNTypes = ::testing::Types<int1, uint1, int2, uint2, int4, uint4>;
62
62
TYPED_TEST_SUITE (IntNTest, IntNTypes, IntNTestParamNames);
63
63
64
64
TEST (IntNTest, NumericLimits) {
@@ -69,6 +69,13 @@ TEST(IntNTest, NumericLimits) {
69
69
EXPECT_EQ (static_cast <int >(std::numeric_limits<int4>::lowest ()), -8 );
70
70
EXPECT_EQ (std::numeric_limits<int4>::digits, 3 );
71
71
EXPECT_EQ (std::numeric_limits<int4>::digits10, 0 );
72
+ EXPECT_EQ (std::numeric_limits<int1>::is_signed, true );
73
+ EXPECT_EQ (std::numeric_limits<int1>::is_modulo, false );
74
+ EXPECT_EQ (static_cast <int >(std::numeric_limits<int1>::min ()), -1 );
75
+ EXPECT_EQ (static_cast <int >(std::numeric_limits<int1>::max ()), 0 );
76
+ EXPECT_EQ (static_cast <int >(std::numeric_limits<int1>::lowest ()), -1 );
77
+ EXPECT_EQ (std::numeric_limits<int1>::digits, 0 );
78
+ EXPECT_EQ (std::numeric_limits<int1>::digits10, 0 );
72
79
}
73
80
74
81
TEST (UIntNTest, NumericLimits) {
@@ -79,6 +86,13 @@ TEST(UIntNTest, NumericLimits) {
79
86
EXPECT_EQ (static_cast <int >(std::numeric_limits<uint4>::lowest ()), 0 );
80
87
EXPECT_EQ (std::numeric_limits<uint4>::digits, 4 );
81
88
EXPECT_EQ (std::numeric_limits<uint4>::digits10, 1 );
89
+ EXPECT_EQ (std::numeric_limits<uint1>::is_signed, false );
90
+ EXPECT_EQ (std::numeric_limits<uint1>::is_modulo, true );
91
+ EXPECT_EQ (static_cast <int >(std::numeric_limits<uint1>::min ()), 0 );
92
+ EXPECT_EQ (static_cast <int >(std::numeric_limits<uint1>::max ()), 1 );
93
+ EXPECT_EQ (static_cast <int >(std::numeric_limits<uint4>::lowest ()), 0 );
94
+ EXPECT_EQ (std::numeric_limits<uint1>::digits, 1 );
95
+ EXPECT_EQ (std::numeric_limits<uint1>::digits10, 0 );
82
96
}
83
97
84
98
TYPED_TEST (IntNTest, NumericLimitsBase) {
@@ -141,7 +155,7 @@ struct ConstexprEvaluator {
141
155
};
142
156
143
157
// To avoid warnings about unused left-side of comma expressions,
144
- // we additionally pass the expression through a contexpr function.
158
+ // we additionally pass the expression through a constexpr function.
145
159
template <typename T>
146
160
constexpr void ConstexprEvaluatorFunc (T&&) {}
147
161
@@ -211,8 +225,8 @@ TYPED_TEST(IntNTest, Casts) {
211
225
}
212
226
213
227
// Implicit conversion to optional.
214
- std::optional<int64_t > c = IntN (1 );
215
- EXPECT_EQ (c, 1 );
228
+ std::optional<int64_t > c = IntN (0 );
229
+ EXPECT_EQ (c, 0 );
216
230
217
231
// Loop through all valid values.
218
232
for (int i = static_cast <int >(std::numeric_limits<IntN>::min ());
@@ -329,17 +343,18 @@ struct CustomInt {
329
343
int x;
330
344
};
331
345
332
- #define GEN_DEST_TYPES (Type ) \
333
- std::pair<Type, bool >, std::pair<Type, uint2>, std::pair<Type, uint4>, \
334
- std::pair<Type, uint8_t >, std::pair<Type, uint16_t >, \
335
- std::pair<Type, uint32_t >, std::pair<Type, uint64_t >, \
336
- std::pair<Type, int2>, std::pair<Type, int4>, std::pair<Type, int8_t >, \
337
- std::pair<Type, int16_t >, std::pair<Type, int32_t >, \
346
+ #define GEN_DEST_TYPES (Type ) \
347
+ std::pair<Type, bool >, std::pair<Type, uint1>, std::pair<Type, uint2>, \
348
+ std::pair<Type, uint4>, std::pair<Type, uint8_t >, \
349
+ std::pair<Type, uint16_t >, std::pair<Type, uint32_t >, \
350
+ std::pair<Type, uint64_t >, std::pair<Type, int1>, std::pair<Type, int2>, \
351
+ std::pair<Type, int4>, std::pair<Type, int8_t >, \
352
+ std::pair<Type, int16_t >, std::pair<Type, int32_t >, \
338
353
std::pair<Type, int64_t >, std::pair<Type, CustomInt>
339
354
340
355
#define GEN_TYPE_PAIRS () \
341
- GEN_DEST_TYPES (int2 ), GEN_DEST_TYPES(uint2 ), GEN_DEST_TYPES(int4 ), \
342
- GEN_DEST_TYPES (uint4)
356
+ GEN_DEST_TYPES (int1 ), GEN_DEST_TYPES(uint1 ), GEN_DEST_TYPES(int2 ), \
357
+ GEN_DEST_TYPES (uint2), GEN_DEST_TYPES(int4), GEN_DEST_TYPES( uint4)
343
358
344
359
using IntNCastTypePairs = ::testing::Types<GEN_TYPE_PAIRS()>;
345
360
template <typename CastPair>
0 commit comments