From e174f26c97647468d75aaced2577c47d04d5f4ef Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Thu, 25 Jul 2024 13:46:09 -0700 Subject: [PATCH] fix formatting --- src/hdf5/HDF5IO.cpp | 3 ++- tests/testBase.cpp | 13 +++++++------ tests/testFile.cpp | 7 ++++--- tests/testHDF5IO.cpp | 31 ++++++++++++++++++++----------- tests/testUtils.hpp | 5 +++-- 5 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/hdf5/HDF5IO.cpp b/src/hdf5/HDF5IO.cpp index 1d64255a..2eeda9fa 100644 --- a/src/hdf5/HDF5IO.cpp +++ b/src/hdf5/HDF5IO.cpp @@ -656,6 +656,7 @@ Status HDF5RecordingData::writeDataBlock( return Status::Success; } -const H5::DataSet* HDF5RecordingData::getDataSet(){ +const H5::DataSet* HDF5RecordingData::getDataSet() +{ return dSet.get(); }; diff --git a/tests/testBase.cpp b/tests/testBase.cpp index d470c909..d296292d 100644 --- a/tests/testBase.cpp +++ b/tests/testBase.cpp @@ -38,9 +38,9 @@ TEST_CASE("TimeSeries", "[base]") // Read data back from file double* tsBuffer = new double[numSamples]; BaseRecordingData* tsDset = io->getDataSet(dataPath + "/timestamps"); - readH5DataBlock(static_cast(tsDset)->getDataSet(), - timestampsType, - tsBuffer); + readH5DataBlock(static_cast(tsDset)->getDataSet(), + timestampsType, + tsBuffer); std::vector tsRead(tsBuffer, tsBuffer + numSamples); delete[] tsBuffer; REQUIRE(tsRead == timestamps); @@ -48,9 +48,10 @@ TEST_CASE("TimeSeries", "[base]") // Read data back from file float* dataBuffer = new float[numSamples]; BaseRecordingData* dataDset = io->getDataSet(dataPath + "/data"); - readH5DataBlock(static_cast(dataDset)->getDataSet(), - dataType, - dataBuffer); + readH5DataBlock( + static_cast(dataDset)->getDataSet(), + dataType, + dataBuffer); std::vector dataRead(dataBuffer, dataBuffer + numSamples); delete[] dataBuffer; REQUIRE_THAT(dataRead, Catch::Matchers::Approx(data).margin(1)); diff --git a/tests/testFile.cpp b/tests/testFile.cpp index d0dd9921..7c815102 100644 --- a/tests/testFile.cpp +++ b/tests/testFile.cpp @@ -37,9 +37,10 @@ TEST_CASE("ElectrodeTable", "[ecephys]") SizeType numChannels = 3; BaseRecordingData* id_data = io->getDataSet(path + "id"); int* buffer = new int[numChannels]; - readH5DataBlock(static_cast(id_data)->getDataSet(), - BaseDataType::I32, - buffer); + readH5DataBlock( + static_cast(id_data)->getDataSet(), + BaseDataType::I32, + buffer); std::vector read_channels(buffer, buffer + numChannels); delete[] buffer; REQUIRE(channelIDs == read_channels); diff --git a/tests/testHDF5IO.cpp b/tests/testHDF5IO.cpp index 6e5ef96f..05988e14 100644 --- a/tests/testHDF5IO.cpp +++ b/tests/testHDF5IO.cpp @@ -65,9 +65,10 @@ TEST_CASE("writeDataset", "[hdf5io]") BaseRecordingData* dataRead = hdf5io->getDataSet(dataPath); int* buffer = new int[numSamples]; - readH5DataBlock(static_cast(dataRead)->getDataSet(), - BaseDataType::I32, - buffer); + readH5DataBlock( + static_cast(dataRead)->getDataSet(), + BaseDataType::I32, + buffer); std::vector dataOut(buffer, buffer + numSamples); delete[] buffer; @@ -100,9 +101,10 @@ TEST_CASE("writeDataset", "[hdf5io]") // Read back the 1D data block from 3D dataset BaseRecordingData* dataRead1D = hdf5io->getDataSet(dataPath); int* buffer1D = new int[numCols]; - readH5DataBlock(static_cast(dataRead1D)->getDataSet(), - BaseDataType::I32, - buffer1D); + readH5DataBlock( + static_cast(dataRead1D)->getDataSet(), + BaseDataType::I32, + buffer1D); std::vector dataOut1D(buffer1D, buffer1D + numCols); delete[] buffer1D; @@ -139,8 +141,10 @@ TEST_CASE("writeDataset", "[hdf5io]") // Read back the 2D data block BaseRecordingData* dataRead = hdf5io->getDataSet(dataPath); int* buffer = new int[numRows * numCols]; - readH5DataBlock(static_cast(dataRead)->getDataSet(), - BaseDataType::I32, buffer); + readH5DataBlock( + static_cast(dataRead)->getDataSet(), + BaseDataType::I32, + buffer); std::vector dataOut(buffer, buffer + numRows * numCols); delete[] buffer; @@ -175,8 +179,10 @@ TEST_CASE("writeDataset", "[hdf5io]") BaseRecordingData* dataRead1D = hdf5io->getDataSet(dataPath); int* buffer1D = new int[width]; // Assuming 'width' is the size of the 1D data block - readH5DataBlock(static_cast(dataRead1D)->getDataSet(), - BaseDataType::I32, buffer1D); + readH5DataBlock( + static_cast(dataRead1D)->getDataSet(), + BaseDataType::I32, + buffer1D); std::vector dataOut1D(buffer1D, buffer1D + width); delete[] buffer1D; @@ -211,7 +217,10 @@ TEST_CASE("writeDataset", "[hdf5io]") int* buffer2D = new int[height * width]; // Assuming 'numRows' and 'numCols' define the // 2D data block size - readH5DataBlock(static_cast(dataRead2D)->getDataSet(), BaseDataType::I32, buffer2D); + readH5DataBlock( + static_cast(dataRead2D)->getDataSet(), + BaseDataType::I32, + buffer2D); std::vector dataOut2D(buffer2D, buffer2D + height * width); delete[] buffer2D; diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp index f584a0f6..01832a23 100644 --- a/tests/testUtils.hpp +++ b/tests/testUtils.hpp @@ -100,8 +100,9 @@ inline std::vector getMockTimestamps(SizeType numSamples = 1000, return mockTimestamps; } -inline void readH5DataBlock(const H5::DataSet* dSet, const BaseDataType& type, void* -buffer) +inline void readH5DataBlock(const H5::DataSet* dSet, + const BaseDataType& type, + void* buffer) { H5::DataSpace fSpace = dSet->getSpace(); H5::DataType nativeType = HDF5::HDF5IO::getNativeType(type);