Skip to content

Commit

Permalink
gdal_typetraits: remove some boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaston committed Oct 15, 2024
1 parent b2693a1 commit 66e3fbd
Show file tree
Hide file tree
Showing 2 changed files with 190 additions and 279 deletions.
6 changes: 6 additions & 0 deletions autotest/cpp/test_gdal_typetraits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,32 @@ TEST_F(test_gdal_typetraits, CXXTypeTraits)
EXPECT_EQ(
gdal::CXXTypeTraits<int8_t>::GetExtendedDataType().GetNumericDataType(),
GDT_Int8);

static_assert(gdal::CXXTypeTraits<uint8_t>::gdal_type == GDT_Byte);
static_assert(gdal::CXXTypeTraits<uint8_t>::size == 1);
EXPECT_EQ(gdal::CXXTypeTraits<uint8_t>::GetExtendedDataType()
.GetNumericDataType(),
GDT_Byte);

static_assert(gdal::CXXTypeTraits<int16_t>::gdal_type == GDT_Int16);
static_assert(gdal::CXXTypeTraits<int16_t>::size == 2);
EXPECT_EQ(gdal::CXXTypeTraits<int16_t>::GetExtendedDataType()
.GetNumericDataType(),
GDT_Int16);

static_assert(gdal::CXXTypeTraits<uint16_t>::gdal_type == GDT_UInt16);
static_assert(gdal::CXXTypeTraits<uint16_t>::size == 2);
EXPECT_EQ(gdal::CXXTypeTraits<uint16_t>::GetExtendedDataType()
.GetNumericDataType(),
GDT_UInt16);

static_assert(gdal::CXXTypeTraits<int32_t>::gdal_type == GDT_Int32);
static_assert(gdal::CXXTypeTraits<int32_t>::size == 4);
EXPECT_EQ(gdal::CXXTypeTraits<int32_t>::GetExtendedDataType()
.GetNumericDataType(),
GDT_Int32);
static_assert(gdal::CXXTypeTraits<int32_t>::ogr_type == OFTInteger);

static_assert(gdal::CXXTypeTraits<uint32_t>::gdal_type == GDT_UInt32);
static_assert(gdal::CXXTypeTraits<uint32_t>::size == 4);
EXPECT_EQ(gdal::CXXTypeTraits<uint32_t>::GetExtendedDataType()
Expand Down
Loading

0 comments on commit 66e3fbd

Please sign in to comment.