@@ -298,15 +298,33 @@ void TestGetTypeInfoDynamic(void (*)(Key...), void (*)(Value...)) {
298
298
}
299
299
300
300
TEST (MapTest, StaticTypeInfoMatchesDynamicOne) {
301
+ enum SomeEnum : int {};
302
+
301
303
TestGetTypeInfoDynamic (
304
+ static_cast <void (*)(bool , int32_t , uint32_t , int64_t , uint64_t ,
305
+ std::string)>(nullptr ),
302
306
static_cast <void (*)(bool , int32_t , uint32_t , int64_t , uint64_t , float ,
303
- double , std::string)>(nullptr ),
304
- static_cast <void (*)(bool , int32_t , uint32_t , int64_t , uint64_t , float ,
305
- double , std::string,
307
+ double , std::string, SomeEnum,
306
308
protobuf_unittest::TestEmptyMessage,
307
309
protobuf_unittest::TestAllTypes)>(nullptr ));
308
310
}
309
311
312
+ TEST (MapTest, StaticTypeKindWorks) {
313
+ enum SomeEnum : int {};
314
+
315
+ using UMB = UntypedMapBase;
316
+ EXPECT_EQ (UMB::TypeKind::kBool , UMB::StaticTypeKind<bool >());
317
+ EXPECT_EQ (UMB::TypeKind::kU32 , UMB::StaticTypeKind<int32_t >());
318
+ EXPECT_EQ (UMB::TypeKind::kU32 , UMB::StaticTypeKind<uint32_t >());
319
+ EXPECT_EQ (UMB::TypeKind::kU32 , UMB::StaticTypeKind<SomeEnum>());
320
+ EXPECT_EQ (UMB::TypeKind::kU64 , UMB::StaticTypeKind<int64_t >());
321
+ EXPECT_EQ (UMB::TypeKind::kU64 , UMB::StaticTypeKind<uint64_t >());
322
+ EXPECT_EQ (UMB::TypeKind::kString , UMB::StaticTypeKind<std::string>());
323
+ EXPECT_EQ (UMB::TypeKind::kMessage ,
324
+ UMB::StaticTypeKind<protobuf_unittest::TestAllTypes>());
325
+ EXPECT_EQ (UMB::TypeKind::kUnknown , UMB::StaticTypeKind<void **>());
326
+ }
327
+
310
328
TEST (MapTest, IteratorNodeFieldIsNullPtrAtEnd) {
311
329
Map<int , int > map;
312
330
EXPECT_EQ (internal::UntypedMapIterator::FromTyped (map.cbegin ()).node_ ,
0 commit comments