| 80 | class ZlibCompressTestFixture : public testing::TestWithParam<ZlibCompressParameters> {}; |
| 81 | |
| 82 | TEST_P( ZlibCompressTestFixture, ZlibCompress ) |
| 83 | { |
| 84 | const auto& [input, inputSize, output, outputSize, level, rawDeflate] = GetParam(); |
| 85 | |
| 86 | const std::string inputStr( reinterpret_cast<const char*>( input ), inputSize ); |
| 87 | std::istringstream in( inputStr ); |
| 88 | |
| 89 | const std::string outputStr( reinterpret_cast<const char*>( output ), outputSize ); |
| 90 | std::ostringstream out( outputStr ); |
| 91 | |
| 92 | auto res = MR::zlibCompressStream( in, out, MR::ZlibCompressParams{ { .rawDeflate = rawDeflate }, level } ); |
| 93 | EXPECT_TRUE( res.has_value() ); |
| 94 | // FIXME: Python and MeshLib output data mismatch; note that MeshLib output is still valid |
| 95 | //EXPECT_STREQ( out.str().c_str(), outputStr.c_str() ); |
| 96 | |
| 97 | std::istringstream in2( out.str() ); |
| 98 | std::ostringstream out2; |
| 99 | res = MR::zlibDecompressStream( in2, out2, MR::ZlibParams{ .rawDeflate = rawDeflate } ); |
| 100 | EXPECT_TRUE( res.has_value() ); |
| 101 | EXPECT_STREQ( out2.str().c_str(), inputStr.c_str() ); |
| 102 | } |
| 103 | |
| 104 | INSTANTIATE_TEST_SUITE_P( MRMesh, ZlibCompressTestFixture, testing::Values( |
| 105 | ZlibCompressParameters { cInput, sizeof( cInput ), cWrappedLevel1, sizeof( cWrappedLevel1 ), 1, false }, |
nothing calls this directly
no test coverage detected