MCPcopy Create free account
hub / github.com/OSGeo/gdal / test

Method test

autotest/cpp/test_cpl.cpp:3858–3894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3856template <class T> struct TesterDelta
3857{
3858 static void test(const char *dtypeOption)
3859 {
3860 const auto pCompressor = CPLGetCompressor("delta");
3861 ASSERT_TRUE(pCompressor);
3862 if (pCompressor == nullptr)
3863 return;
3864 const auto pDecompressor = CPLGetDecompressor("delta");
3865 ASSERT_TRUE(pDecompressor);
3866 if (pDecompressor == nullptr)
3867 return;
3868
3869 const T tabIn[] = {static_cast<T>(-2), 3, 1};
3870 T tabCompress[3];
3871 T tabOut[3];
3872 const char *const apszOptions[] = {dtypeOption, nullptr};
3873
3874 void *outPtr = &tabCompress[0];
3875 size_t outSize = sizeof(tabCompress);
3876 ASSERT_TRUE(pCompressor->pfnFunc(&tabIn[0], sizeof(tabIn), &outPtr,
3877 &outSize, apszOptions,
3878 pCompressor->user_data));
3879 ASSERT_EQ(outSize, sizeof(tabCompress));
3880
3881 // ASSERT_EQ(tabCompress[0], 2);
3882 // ASSERT_EQ(tabCompress[1], 1);
3883 // ASSERT_EQ(tabCompress[2], -2);
3884
3885 outPtr = &tabOut[0];
3886 outSize = sizeof(tabOut);
3887 ASSERT_TRUE(pDecompressor->pfnFunc(&tabCompress[0], sizeof(tabCompress),
3888 &outPtr, &outSize, apszOptions,
3889 pDecompressor->user_data));
3890 ASSERT_EQ(outSize, sizeof(tabOut));
3891 ASSERT_EQ(tabOut[0], tabIn[0]);
3892 ASSERT_EQ(tabOut[1], tabIn[1]);
3893 ASSERT_EQ(tabOut[2], tabIn[2]);
3894 }
3895};
3896
3897// Test delta compressor/decompressor

Callers 10

GDALPDFOutputDevClass · 0.80
IReadBlockMethod · 0.80
ReadPixelsMethod · 0.80
GetCatalogMethod · 0.80
~PDFDatasetMethod · 0.80
IRasterIOMethod · 0.80
CheckTiledRasterMethod · 0.80
OpenMethod · 0.80
ParseMeasureMethod · 0.80
GetMetadataItemMethod · 0.80

Calls 3

CPLGetCompressorFunction · 0.85
CPLGetDecompressorFunction · 0.85
ASSERT_EQFunction · 0.85

Tested by

no test coverage detected