Skip to content

Commit

Permalink
Added a check for BZip2 decompression size
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuck Atkins committed Mar 27, 2018
1 parent 5017bb4 commit 0f5d07e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions testing/adios2/transform/TestBZip2Wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ class ADIOSBZip2Wrapper : public ::testing::Test
TEST_F(ADIOSBZip2Wrapper, UInt100)
{
/** Application variable uints from 0 to 1000 */
std::vector<unsigned int> myUInts(100);
std::vector<uint32_t> myUInts(100);
std::iota(myUInts.begin(), myUInts.end(), 0.f);
const std::size_t Nx = myUInts.size();
const std::size_t inputBytes = Nx * sizeof(unsigned int);
const std::size_t inputBytes = Nx * sizeof(uint32_t);

// Define ADIOS variable
auto &var_UInt = io.DefineVariable<unsigned int>("myUInts", {}, {}, {Nx},
adios2::ConstantDims);
auto &var_UInt = io.DefineVariable<uint32_t>("myUInts", {}, {}, {Nx},
adios2::ConstantDims);

// Verify the return type is as expected
::testing::StaticAssertTypeEq<decltype(var_UInt),
adios2::Variable<unsigned int> &>();
adios2::Variable<uint32_t> &>();

// Define bzip2 transform
adios2::Operator &adiosBZip2 =
Expand All @@ -53,11 +53,11 @@ TEST_F(ADIOSBZip2Wrapper, UInt100)
compressedBuffer.resize(compressedSize);

// Allocate original data size
std::vector<unsigned int> decompressedBuffer(Nx);
std::vector<uint32_t> decompressedBuffer(Nx);
size_t decompressedSize = adiosBZip2.Decompress(
compressedBuffer.data(), compressedSize, decompressedBuffer.data(),
decompressedBuffer.size() * sizeof(unsigned int));
ASSERT_EQ(decompressedSize, Nx);
decompressedBuffer.size() * sizeof(uint32_t));
ASSERT_EQ(decompressedSize, inputBytes);

// testing data recovery
for (size_t i = 0; i < Nx; ++i)
Expand Down

0 comments on commit 0f5d07e

Please sign in to comment.