From a3baf7d3e984f6d8d4fe7846181d537d2d08790a Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 8 Mar 2023 14:55:45 -0800 Subject: [PATCH] clang-tidy: no _ in tests Found with google-readability-avoid-underscore-in-googletest-name Signed-off-by: Rosen Penev --- unitTests/test_Photoshop.cpp | 28 ++++++++--------- unitTests/test_TimeValue.cpp | 6 ++-- unitTests/test_basicio.cpp | 18 +++++------ unitTests/test_datasets.cpp | 48 ++++++++++++++--------------- unitTests/test_helper_functions.cpp | 4 +-- unitTests/test_jp2image_int.cpp | 14 ++++----- unitTests/test_types.cpp | 10 +++--- 7 files changed, 64 insertions(+), 64 deletions(-) diff --git a/unitTests/test_Photoshop.cpp b/unitTests/test_Photoshop.cpp index e0b18036..321f4f7f 100644 --- a/unitTests/test_Photoshop.cpp +++ b/unitTests/test_Photoshop.cpp @@ -13,29 +13,29 @@ namespace { constexpr std::array validMarkers{"8BIM", "AgHg", "DCSR", "PHUT"}; } // namespace -TEST(Photoshop_isIrb, returnsTrueWithValidMarkers) { +TEST(PhotoshopIsIrb, returnsTrueWithValidMarkers) { for (const auto& marker : validMarkers) { ASSERT_TRUE(Photoshop::isIrb(reinterpret_cast(marker))); } } -TEST(Photoshop_isIrb, returnsFalseWithInvalidMarkers) { +TEST(PhotoshopIsIrb, returnsFalseWithInvalidMarkers) { ASSERT_FALSE(Photoshop::isIrb(reinterpret_cast("7BIM"))); ASSERT_FALSE(Photoshop::isIrb(reinterpret_cast("AGHg"))); ASSERT_FALSE(Photoshop::isIrb(reinterpret_cast("dcsr"))); ASSERT_FALSE(Photoshop::isIrb(reinterpret_cast("LUIS"))); } -TEST(Photoshop_isIrb, returnsFalseWithNullPointer) { +TEST(PhotoshopIsIrb, returnsFalseWithNullPointer) { ASSERT_FALSE(Photoshop::isIrb(nullptr)); } /// \note probably this is not safe and we need to remove it -TEST(Photoshop_isIrb, returnsFalseWithShorterMarker) { +TEST(PhotoshopIsIrb, returnsFalseWithShorterMarker) { ASSERT_FALSE(Photoshop::isIrb(reinterpret_cast("8BI"))); } -TEST(Photoshop_locateIrb, returnsMinus2withInvalidPhotoshopIRB) { +TEST(PhotoshopLocateIrb, returnsMinus2withInvalidPhotoshopIRB) { const std::string data{"8BIMlalalalalalala"}; const Exiv2::byte* record; uint32_t sizeHdr = 0; @@ -44,7 +44,7 @@ TEST(Photoshop_locateIrb, returnsMinus2withInvalidPhotoshopIRB) { &record, sizeHdr, sizeData)); } -TEST(Photoshop_locateIrb, returnsMinus2WithMarkerNotStartingWith8BIM) { +TEST(PhotoshopLocateIrb, returnsMinus2WithMarkerNotStartingWith8BIM) { const std::string data{"7BIMlalalalalalalala"}; const Exiv2::byte* record; uint32_t sizeHdr = 0; @@ -53,7 +53,7 @@ TEST(Photoshop_locateIrb, returnsMinus2WithMarkerNotStartingWith8BIM) { &record, sizeHdr, sizeData)); } -TEST(Photoshop_locateIrb, returns3withNotLongEnoughData) { +TEST(PhotoshopLocateIrb, returns3withNotLongEnoughData) { const std::string data{"8BIMlala"}; const Exiv2::byte* record; uint32_t sizeHdr = 0; @@ -62,7 +62,7 @@ TEST(Photoshop_locateIrb, returns3withNotLongEnoughData) { sizeHdr, sizeData)); } -TEST(Photoshop_locateIrb, returns0withGoodIptcIrb) { +TEST(PhotoshopLocateIrb, returns0withGoodIptcIrb) { // Data taken from file test/data/DSC_3079.jpg // The IPTC marker is 0x04 0x04 const std::array data{0x38, 0x42, 0x49, 0x4d, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x1c, 0x01, @@ -80,7 +80,7 @@ TEST(Photoshop_locateIrb, returns0withGoodIptcIrb) { ASSERT_EQ(27, sizeData); } -TEST(Photoshop_locateIptcIrb, returns0withGoodIptcIrb) { +TEST(PhotoshopLocateIptcIrb, returns0withGoodIptcIrb) { // Data taken from file test/data/DSC_3079.jpg // The IPTC marker is 0x04 0x04 const std::array data{0x38, 0x42, 0x49, 0x4d, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x1c, 0x01, @@ -98,7 +98,7 @@ TEST(Photoshop_locateIptcIrb, returns0withGoodIptcIrb) { ASSERT_EQ(27, sizeData); } -TEST(Photoshop_locateIptcIrb, returns3withoutIptcMarker) { +TEST(PhotoshopLocateIptcIrb, returns3withoutIptcMarker) { // Data taken from file test/data/DSC_3079.jpg // The IPTC marker (0x04 0x04) was manipulated to 0x03 0x04 const std::array data{0x38, 0x42, 0x49, 0x4d, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x1c, 0x01, @@ -114,7 +114,7 @@ TEST(Photoshop_locateIptcIrb, returns3withoutIptcMarker) { ASSERT_EQ(3, Photoshop::locateIptcIrb(data.data(), data.size(), &record, sizeHdr, sizeData)); } -TEST(Photoshop_locatePreviewIrb, returns0withGoodPreviewIrb) { +TEST(PhotoshopLocatePreviewIrb, returns0withGoodPreviewIrb) { // Data taken from file test/data/DSC_3079.jpg // The IPTC marker is 0x04 0x04 was transformed to a Preview one => (0x04 0x0c) const std::array data{0x38, 0x42, 0x49, 0x4d, 0x04, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x1c, 0x01, @@ -134,13 +134,13 @@ TEST(Photoshop_locatePreviewIrb, returns0withGoodPreviewIrb) { // -------------------------------- -TEST(Photoshop_setIptcIrb, withEmptyDataReturnsEmptyBuffer) { +TEST(PhotoshopSetIptcIrb, withEmptyDataReturnsEmptyBuffer) { const IptcData iptc; DataBuf buf = Photoshop::setIptcIrb(nullptr, 0, iptc); ASSERT_TRUE(buf.empty()); } -TEST(Photoshop_setIptcIrb, detectIntegerOverflow_withDataFromPOC2179) { +TEST(PhotoshopSetIptcIrb, detectIntegerOverflowWithDataFromPOC2179) { const std::array data{ 0x38, 0x42, 0x49, 0x4d, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x75, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0x20, 0x20, @@ -156,7 +156,7 @@ TEST(Photoshop_setIptcIrb, detectIntegerOverflow_withDataFromPOC2179) { ASSERT_THROW(Photoshop::setIptcIrb(data.data(), data.size(), iptc), Exiv2::Error); } -TEST(Photoshop_setIptcIrb, returnsEmptyBufferWhenDataDoesNotHave8BIM) { +TEST(PhotoshopSetIptcIrb, returnsEmptyBufferWhenDataDoesNotHave8BIM) { // First byte replaced from 0x38 to 0x37 const std::array data{ 0x37, 0x42, 0x49, 0x4d, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x04, 0x00, diff --git a/unitTests/test_TimeValue.cpp b/unitTests/test_TimeValue.cpp index d29fc13f..22b70f14 100644 --- a/unitTests/test_TimeValue.cpp +++ b/unitTests/test_TimeValue.cpp @@ -33,7 +33,7 @@ TEST(ATimeValue, canBeReadFromCompleteBasicFormatString) { ASSERT_EQ(2, value.getTime().second); } -TEST(ATimeValue, canBeReadFromReducedBasicFormatString_HHMM) { +TEST(ATimeValue, canBeReadFromReducedBasicFormatStringHHMM) { TimeValue value; const std::string hms("2355"); ASSERT_EQ(0, value.read(hms)); @@ -42,7 +42,7 @@ TEST(ATimeValue, canBeReadFromReducedBasicFormatString_HHMM) { ASSERT_EQ(0, value.getTime().second); } -TEST(ATimeValue, canBeReadFromReducedBasicFormatString_HH) { +TEST(ATimeValue, canBeReadFromReducedBasicFormatStringHH) { TimeValue value; const std::string hms("23"); ASSERT_EQ(0, value.read(hms)); @@ -60,7 +60,7 @@ TEST(ATimeValue, canBeReadFromCompleteExtendedFormatString) { ASSERT_EQ(2, value.getTime().second); } -TEST(ATimeValue, canBeReadFromReducedExtendedFormatString_HHMM) { +TEST(ATimeValue, canBeReadFromReducedExtendedFormatStringHHMM) { TimeValue value; const std::string hms("23:55"); ASSERT_EQ(0, value.read(hms)); diff --git a/unitTests/test_basicio.cpp b/unitTests/test_basicio.cpp index 9b8ef10a..8ccecfc4 100644 --- a/unitTests/test_basicio.cpp +++ b/unitTests/test_basicio.cpp @@ -7,30 +7,30 @@ using namespace Exiv2; -TEST(MemIo_Default, readEReturns0) { +TEST(MemIoDefault, readEReturns0) { std::array buf; MemIo io; ASSERT_EQ(0, io.read(buf.data(), buf.size())); } -TEST(MemIo_Default, isNotAtEof) { +TEST(MemIoDefault, isNotAtEof) { MemIo io; ASSERT_FALSE(io.eof()); } -TEST(MemIo_Default, seekBeyondBufferSizeReturns1AndSetsEofToTrue) { +TEST(MemIoDefault, seekBeyondBufferSizeReturns1AndSetsEofToTrue) { MemIo io; ASSERT_EQ(1, io.seek(1, BasicIo::beg)); ASSERT_TRUE(io.eof()); } -TEST(MemIo_Default, seekBefore0Returns1ButItDoesNotSetEofToTrue) { +TEST(MemIoDefault, seekBefore0Returns1ButItDoesNotSetEofToTrue) { MemIo io; ASSERT_EQ(1, io.seek(-1, BasicIo::beg)); ASSERT_FALSE(io.eof()); } -TEST(MemIo_Default, seekToEndPosition_doesNotTriggerEof) { +TEST(MemIoDefault, seekToEndPositionDoesNotTriggerEof) { MemIo io; ASSERT_EQ(0, io.tell()); ASSERT_EQ(0, io.seek(0, BasicIo::end)); @@ -38,7 +38,7 @@ TEST(MemIo_Default, seekToEndPosition_doesNotTriggerEof) { ASSERT_FALSE(io.eof()); } -TEST(MemIo_Default, seekToEndPositionAndReadTriggersEof) { +TEST(MemIoDefault, seekToEndPositionAndReadTriggersEof) { MemIo io; ASSERT_EQ(0, io.seek(0, BasicIo::end)); ASSERT_EQ(0, io.tell()); @@ -92,7 +92,7 @@ TEST(MemIo, seekInsideBoundsMoveThePosition) { ASSERT_EQ(32, io.tell()); } -TEST(MemIo, seekInsideBoundsUsingBeg_resetsThePosition) { +TEST(MemIo, seekInsideBoundsUsingBegResetsThePosition) { std::array buf = {}; MemIo io(buf.data(), buf.size()); @@ -103,7 +103,7 @@ TEST(MemIo, seekInsideBoundsUsingBeg_resetsThePosition) { } } -TEST(MemIo, seekInsideBoundsUsingCur_shiftThePosition) { +TEST(MemIo, seekInsideBoundsUsingCurShiftThePosition) { std::array buf = {}; MemIo io(buf.data(), buf.size()); @@ -115,7 +115,7 @@ TEST(MemIo, seekInsideBoundsUsingCur_shiftThePosition) { } } -TEST(MemIo, seekToEndPosition_doesNotTriggerEof) { +TEST(MemIo, seekToEndPositionDoesNotTriggerEof) { std::array buf = {}; MemIo io(buf.data(), buf.size()); diff --git a/unitTests/test_datasets.cpp b/unitTests/test_datasets.cpp index 01b8a7be..21026702 100644 --- a/unitTests/test_datasets.cpp +++ b/unitTests/test_datasets.cpp @@ -12,7 +12,7 @@ using namespace Exiv2; using ::testing::StartsWith; -TEST(IptcDataSets, dataSetName_returnsValidNamesWhenRequestingNumbersAvailableInEnvelopeRecord) { +TEST(IptcDataSets, dataSetNameReturnsValidNamesWhenRequestingNumbersAvailableInEnvelopeRecord) { ASSERT_EQ("ModelVersion", IptcDataSets::dataSetName(IptcDataSets::ModelVersion, IptcDataSets::envelope)); ASSERT_EQ("Destination", IptcDataSets::dataSetName(IptcDataSets::Destination, IptcDataSets::envelope)); ASSERT_EQ("FileFormat", IptcDataSets::dataSetName(IptcDataSets::FileFormat, IptcDataSets::envelope)); @@ -21,17 +21,17 @@ TEST(IptcDataSets, dataSetName_returnsValidNamesWhenRequestingNumbersAvailableIn ASSERT_EQ("EnvelopeNumber", IptcDataSets::dataSetName(IptcDataSets::EnvelopeNumber, IptcDataSets::envelope)); } -TEST(IptcDataSets, dataSetName_returnsValidNamesWhenRequestingNumbersAvailableInApplicationRecord) { +TEST(IptcDataSets, dataSetNameReturnsValidNamesWhenRequestingNumbersAvailableInApplicationRecord) { ASSERT_EQ("ObjectType", IptcDataSets::dataSetName(IptcDataSets::ObjectType, IptcDataSets::application2)); ASSERT_EQ("ObjectAttribute", IptcDataSets::dataSetName(IptcDataSets::ObjectAttribute, IptcDataSets::application2)); } -TEST(IptcDataSets, dataSetName_returnsWrongNamesWhenRequestingNumbersNotAvailableInEnvelopeRecord) { +TEST(IptcDataSets, dataSetNameReturnsWrongNamesWhenRequestingNumbersNotAvailableInEnvelopeRecord) { ASSERT_EQ("0x0003", IptcDataSets::dataSetName(IptcDataSets::ObjectType, IptcDataSets::envelope)); ASSERT_EQ("0x0004", IptcDataSets::dataSetName(IptcDataSets::ObjectAttribute, IptcDataSets::envelope)); } -TEST(IptcDataSets, dataSetTitle_returnsValidTitleWhenRequestingNumbersAvailableInRecord) { +TEST(IptcDataSets, dataSetTitleReturnsValidTitleWhenRequestingNumbersAvailableInRecord) { ASSERT_STREQ("Model Version", IptcDataSets::dataSetTitle(IptcDataSets::ModelVersion, IptcDataSets::envelope)); ASSERT_STREQ("Destination", IptcDataSets::dataSetTitle(IptcDataSets::Destination, IptcDataSets::envelope)); ASSERT_STREQ("File Format", IptcDataSets::dataSetTitle(IptcDataSets::FileFormat, IptcDataSets::envelope)); @@ -41,7 +41,7 @@ TEST(IptcDataSets, dataSetTitle_returnsValidTitleWhenRequestingNumbersAvailableI IptcDataSets::dataSetTitle(IptcDataSets::ObjectAttribute, IptcDataSets::application2)); } -TEST(IptcDataSets, dataSetTitle_returnsUnknownStringWhenRequestingNumbersNotAvailableInEnvelopeRecord) { +TEST(IptcDataSets, dataSetTitleReturnsUnknownStringWhenRequestingNumbersNotAvailableInEnvelopeRecord) { ASSERT_STREQ("Unknown dataset", IptcDataSets::dataSetTitle(IptcDataSets::ObjectType, IptcDataSets::envelope)); ASSERT_STREQ("Unknown dataset", IptcDataSets::dataSetTitle(IptcDataSets::ObjectAttribute, IptcDataSets::envelope)); } @@ -56,14 +56,14 @@ TEST(IptcDataSets, dataSetTitle_returnsUnknownStringWhenRequestingNumbersNotAvai // ASSERT_STREQ("Unknown dataset", IptcDataSets::dataSetTitle(IptcDataSets::FileFormat, IptcDataSets::application2)); //} -TEST(IptcDataSets, dataSetTitle_returnsUnknownStringWhenRequestingNumbersNotAvailableInApplicationRecord) { +TEST(IptcDataSets, dataSetTitleReturnsUnknownStringWhenRequestingNumbersNotAvailableInApplicationRecord) { ASSERT_STREQ("Unknown dataset", IptcDataSets::dataSetTitle(1, IptcDataSets::envelope)); ASSERT_STREQ("Unknown dataset", IptcDataSets::dataSetTitle(2, IptcDataSets::envelope)); } // ---------------------- -TEST(IptcDataSets, dataSetDescription_returnsValidDescriptionWhenRequestingNumbersAvailableInRecord) { +TEST(IptcDataSets, dataSetDescriptionReturnsValidDescriptionWhenRequestingNumbersAvailableInRecord) { ASSERT_THAT(IptcDataSets::dataSetDesc(IptcDataSets::ModelVersion, IptcDataSets::envelope), StartsWith("A binary number identifying the version of the Information Interchange Model")); ASSERT_THAT(IptcDataSets::dataSetDesc(IptcDataSets::FileFormat, IptcDataSets::envelope), @@ -75,7 +75,7 @@ TEST(IptcDataSets, dataSetDescription_returnsValidDescriptionWhenRequestingNumbe StartsWith("The Object Type is used to distinguish between different types of objects within the IIM")); } -TEST(IptcDataSets, dataSetDescription_returnsUnknownStringWhenRequestingNumbersNotAvailableInRecord) { +TEST(IptcDataSets, dataSetDescriptionReturnsUnknownStringWhenRequestingNumbersNotAvailableInRecord) { ASSERT_STREQ("Unknown dataset", IptcDataSets::dataSetDesc(1, IptcDataSets::envelope)); ASSERT_STREQ("Unknown dataset", IptcDataSets::dataSetDesc(2, IptcDataSets::envelope)); @@ -85,14 +85,14 @@ TEST(IptcDataSets, dataSetDescription_returnsUnknownStringWhenRequestingNumbersN // ---------------------- -TEST(IptcDataSets, dataSetPsName_returnsValidPsNameWhenRequestingNumbersAvailableInRecord) { +TEST(IptcDataSets, dataSetPsNameReturnsValidPsNameWhenRequestingNumbersAvailableInRecord) { ASSERT_STREQ("", IptcDataSets::dataSetPsName(IptcDataSets::FileFormat, IptcDataSets::envelope)); ASSERT_STREQ("Document Title", IptcDataSets::dataSetPsName(IptcDataSets::ObjectName, IptcDataSets::application2)); ASSERT_STREQ("Urgency", IptcDataSets::dataSetPsName(IptcDataSets::Urgency, IptcDataSets::application2)); } -TEST(IptcDataSets, dataSetPsName_returnsUnknownStringWhenRequestingNumbersNotAvailableInRecord) { +TEST(IptcDataSets, dataSetPsNameReturnsUnknownStringWhenRequestingNumbersNotAvailableInRecord) { ASSERT_STREQ("Unknown dataset", IptcDataSets::dataSetPsName(1, IptcDataSets::envelope)); ASSERT_STREQ("Unknown dataset", IptcDataSets::dataSetPsName(2, IptcDataSets::envelope)); @@ -102,7 +102,7 @@ TEST(IptcDataSets, dataSetPsName_returnsUnknownStringWhenRequestingNumbersNotAva // ---------------------- -TEST(IptcDataSets, dataSetRepeatable_returnsExpectedValueNameWhenRequestingNumbersAvailableInRecord) { +TEST(IptcDataSets, dataSetRepeatableReturnsExpectedValueNameWhenRequestingNumbersAvailableInRecord) { ASSERT_TRUE(IptcDataSets::dataSetRepeatable(IptcDataSets::Destination, IptcDataSets::envelope)); ASSERT_FALSE(IptcDataSets::dataSetRepeatable(IptcDataSets::FileFormat, IptcDataSets::envelope)); @@ -111,7 +111,7 @@ TEST(IptcDataSets, dataSetRepeatable_returnsExpectedValueNameWhenRequestingNumbe } /// \todo check if we want to return true in this case or throw an exception ... -TEST(IptcDataSets, dataSetRepeatable_returnsTrueWhenRequestingNumbersNotAvailableInRecord) { +TEST(IptcDataSets, dataSetRepeatableReturnsTrueWhenRequestingNumbersNotAvailableInRecord) { ASSERT_TRUE(IptcDataSets::dataSetRepeatable(1, IptcDataSets::envelope)); ASSERT_TRUE(IptcDataSets::dataSetRepeatable(2, IptcDataSets::envelope)); @@ -121,7 +121,7 @@ TEST(IptcDataSets, dataSetRepeatable_returnsTrueWhenRequestingNumbersNotAvailabl // ---------------------- -TEST(IptcDataSets, dataSet_returnsExpectedValueWhenRequestingValidDatasetName) { +TEST(IptcDataSets, dataSetReturnsExpectedValueWhenRequestingValidDatasetName) { ASSERT_EQ(IptcDataSets::ModelVersion, IptcDataSets::dataSet("ModelVersion", IptcDataSets::envelope)); ASSERT_EQ(IptcDataSets::FileFormat, IptcDataSets::dataSet("FileFormat", IptcDataSets::envelope)); @@ -129,7 +129,7 @@ TEST(IptcDataSets, dataSet_returnsExpectedValueWhenRequestingValidDatasetName) { ASSERT_EQ(IptcDataSets::FixtureId, IptcDataSets::dataSet("FixtureId", IptcDataSets::application2)); } -TEST(IptcDataSets, dataSet_throwWithNonExistingDatasetName) { +TEST(IptcDataSets, dataSetThrowWithNonExistingDatasetName) { try { IptcDataSets::dataSet("NonExistingName", IptcDataSets::envelope); FAIL(); @@ -140,7 +140,7 @@ TEST(IptcDataSets, dataSet_throwWithNonExistingDatasetName) { } /// \todo Weird error reporting here. It should indicate that the record specified does not exist -TEST(IptcDataSets, dataSet_throwWithNonExistingRecordId) { +TEST(IptcDataSets, dataSetThrowWithNonExistingRecordId) { try { IptcDataSets::dataSet("ModelVersion", 5); FAIL(); @@ -152,7 +152,7 @@ TEST(IptcDataSets, dataSet_throwWithNonExistingRecordId) { // ---------------------- -TEST(IptcDataSets, dataSetType_returnsExpectedTypeWhenRequestingValidDataset) { +TEST(IptcDataSets, dataSetTypeReturnsExpectedTypeWhenRequestingValidDataset) { ASSERT_EQ(unsignedShort, IptcDataSets::dataSetType(IptcDataSets::ModelVersion, IptcDataSets::envelope)); ASSERT_EQ(Exiv2::string, IptcDataSets::dataSetType(IptcDataSets::Destination, IptcDataSets::envelope)); @@ -161,49 +161,49 @@ TEST(IptcDataSets, dataSetType_returnsExpectedTypeWhenRequestingValidDataset) { } /// \todo probably better to throw exception here? -TEST(IptcDataSets, dataSetType_returnsStringTypeWhenRecordIdDoesNotExist) { +TEST(IptcDataSets, dataSetTypeReturnsStringTypeWhenRecordIdDoesNotExist) { ASSERT_EQ(Exiv2::string, IptcDataSets::dataSetType(1, 5)); } // ---------------------- -TEST(IptcDataSets, recordName_returnsExpectedNameWhenRequestingValidRecordId) { +TEST(IptcDataSets, recordNameReturnsExpectedNameWhenRequestingValidRecordId) { ASSERT_EQ("Envelope", IptcDataSets::recordName(IptcDataSets::envelope)); ASSERT_EQ("Application2", IptcDataSets::recordName(IptcDataSets::application2)); } -TEST(IptcDataSets, recordName_returnsHexStringWhenRecordIdDoesNotExist) { +TEST(IptcDataSets, recordNameReturnsHexStringWhenRecordIdDoesNotExist) { ASSERT_EQ("0x0000", IptcDataSets::recordName(0)); ASSERT_EQ("0x0003", IptcDataSets::recordName(3)); } // ---------------------- -TEST(IptcDataSets, recordDesc_returnsExpectedDescriptionWhenRequestingValidRecordId) { +TEST(IptcDataSets, recordDescReturnsExpectedDescriptionWhenRequestingValidRecordId) { ASSERT_STREQ("IIM envelope record", IptcDataSets::recordDesc(IptcDataSets::envelope)); ASSERT_STREQ("IIM application record 2", IptcDataSets::recordDesc(IptcDataSets::application2)); } -TEST(IptcDataSets, recordDesc_) { +TEST(IptcDataSets, recordDesc) { ASSERT_STREQ("Unknown dataset", IptcDataSets::recordDesc(0)); ASSERT_STREQ("Unknown dataset", IptcDataSets::recordDesc(3)); } // ---------------------- -TEST(IptcDataSets, recordId_returnsExpectedIdWithValidRecordName) { +TEST(IptcDataSets, recordIdReturnsExpectedIdWithValidRecordName) { ASSERT_EQ(IptcDataSets::envelope, IptcDataSets::recordId("Envelope")); ASSERT_EQ(IptcDataSets::application2, IptcDataSets::recordId("Application2")); } -TEST(IptcDataSets, recordId_throwsExceptionWithInvalidRecordName) { +TEST(IptcDataSets, recordIdThrowsExceptionWithInvalidRecordName) { ASSERT_THROW(IptcDataSets::recordId("NonExistingName"), Exiv2::Error); ASSERT_THROW(IptcDataSets::recordId(""), Exiv2::Error); } // ---------------------- -TEST(IptcDataSets, dataSetLists_printDatasetsIntoOstream) { +TEST(IptcDataSets, dataSetListsPrintDatasetsIntoOstream) { std::ostringstream stream; ASSERT_NO_THROW(IptcDataSets::dataSetList(stream)); ASSERT_FALSE(stream.str().empty()); diff --git a/unitTests/test_helper_functions.cpp b/unitTests/test_helper_functions.cpp index c0356ca8..483d932d 100644 --- a/unitTests/test_helper_functions.cpp +++ b/unitTests/test_helper_functions.cpp @@ -3,7 +3,7 @@ #include #include "helper_functions.hpp" -TEST(string_from_unterminated, terminatedArray) { +TEST(stringFromUnterminated, terminatedArray) { const char data[5] = {'a', 'b', 'c', 0, 'd'}; const std::string res = string_from_unterminated(data, 5); @@ -11,7 +11,7 @@ TEST(string_from_unterminated, terminatedArray) { ASSERT_STREQ(res.c_str(), "abc"); } -TEST(string_from_unterminated, unterminatedArray) { +TEST(stringFromUnterminated, unterminatedArray) { const char data[4] = {'a', 'b', 'c', 'd'}; const std::string res = string_from_unterminated(data, 4); diff --git a/unitTests/test_jp2image_int.cpp b/unitTests/test_jp2image_int.cpp index cd83c19b..f3794968 100644 --- a/unitTests/test_jp2image_int.cpp +++ b/unitTests/test_jp2image_int.cpp @@ -24,18 +24,18 @@ void setValidValues(std::vector& boxData) { } } // namespace -TEST(Jp2_FileTypeBox, isNotValidWithoutProperValuesSet) { +TEST(Jp2FileTypeBox, isNotValidWithoutProperValuesSet) { const std::vector boxData(12); ASSERT_FALSE(isValidBoxFileType(boxData)); } -TEST(Jp2_FileTypeBox, isValidWithMinimumPossibleSizeAndValidValues) { +TEST(Jp2FileTypeBox, isValidWithMinimumPossibleSizeAndValidValues) { std::vector boxData(12); setValidValues(boxData); ASSERT_TRUE(isValidBoxFileType(boxData)); } -TEST(Jp2_FileTypeBox, isNotValidWithMinimumPossibleSizeButInvalidBrand) { +TEST(Jp2FileTypeBox, isNotValidWithMinimumPossibleSizeButInvalidBrand) { std::vector boxData(12); setValidValues(boxData); boxData[2] = '3'; // Change byte in the brand field @@ -43,7 +43,7 @@ TEST(Jp2_FileTypeBox, isNotValidWithMinimumPossibleSizeButInvalidBrand) { ASSERT_FALSE(isValidBoxFileType(boxData)); } -TEST(Jp2_FileTypeBox, isNotValidWithMinimumPossibleSizeButInvalidCL1) { +TEST(Jp2FileTypeBox, isNotValidWithMinimumPossibleSizeButInvalidCL1) { std::vector boxData(12); setValidValues(boxData); boxData[10] = '3'; // Change byte in the CL1 @@ -53,17 +53,17 @@ TEST(Jp2_FileTypeBox, isNotValidWithMinimumPossibleSizeButInvalidCL1) { // ---------------------------------------------------------- -TEST(Jp2_FileTypeBox, withInvalidBoxDataSizeIsInvalid) { +TEST(Jp2FileTypeBox, withInvalidBoxDataSizeIsInvalid) { std::vector boxData(13); // 12 + 1 (the extra byte causes problems) ASSERT_FALSE(isValidBoxFileType(boxData)); } -TEST(Jp2_FileTypeBox, withSmallBoxDataSizeIsInvalid) { +TEST(Jp2FileTypeBox, withSmallBoxDataSizeIsInvalid) { std::vector boxData(7); // Minimum size is 8 ASSERT_FALSE(isValidBoxFileType(boxData)); } -TEST(Jp2_FileTypeBox, with2CLs_lastOneWithBrandValue_isValid) { +TEST(Jp2FileTypeBox, with2CLsLastOneWithBrandValueIsValid) { std::vector boxData(16); // The first 4 bytes correspond to the BR (Brand). It must have the value 'jp2\040' boxData[0] = 'j'; diff --git a/unitTests/test_types.cpp b/unitTests/test_types.cpp index d4a8e034..f9d3650c 100644 --- a/unitTests/test_types.cpp +++ b/unitTests/test_types.cpp @@ -53,7 +53,7 @@ TEST(DataBuf, tryingToAccessTooFarElementThrows) { ASSERT_THROW([[maybe_unused]] auto d = instance.c_data(4), std::out_of_range); } -TEST(DataBuf, read_uintFunctionsWorksOnExistingData) { +TEST(DataBuf, readUintFunctionsWorksOnExistingData) { const std::array data{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; DataBuf instance(data.data(), data.size()); ASSERT_EQ(data[0], instance.read_uint8(0)); @@ -62,7 +62,7 @@ TEST(DataBuf, read_uintFunctionsWorksOnExistingData) { ASSERT_EQ(0x0001020304050607, instance.read_uint64(0, bigEndian)); } -TEST(DataBuf, read_uintFunctionsThrowsOnTooFarElements) { +TEST(DataBuf, readUintFunctionsThrowsOnTooFarElements) { const std::array data{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; DataBuf instance(data.data(), data.size()); ASSERT_THROW([[maybe_unused]] auto d = instance.read_uint8(data.size()), std::out_of_range); @@ -71,7 +71,7 @@ TEST(DataBuf, read_uintFunctionsThrowsOnTooFarElements) { ASSERT_THROW([[maybe_unused]] auto d = instance.read_uint64(data.size(), bigEndian), std::out_of_range); } -TEST(DataBuf, write_uintFunctionsWorksWhenThereIsEnoughData) { +TEST(DataBuf, writeUintFunctionsWorksWhenThereIsEnoughData) { DataBuf instance(8); std::uint64_t val{0x0102030405060708}; ASSERT_NO_THROW(instance.write_uint8(0, (val >> 56))); @@ -87,7 +87,7 @@ TEST(DataBuf, write_uintFunctionsWorksWhenThereIsEnoughData) { ASSERT_EQ(val, instance.read_uint64(0, bigEndian)); } -TEST(DataBuf, write_uintFunctionsThrowsIfTryingToWriteOutOfBounds) { +TEST(DataBuf, writeUintFunctionsThrowsIfTryingToWriteOutOfBounds) { DataBuf instance(8); std::uint64_t val{0x0102030405060708}; ASSERT_THROW(instance.write_uint8(8, (val >> 56)), std::out_of_range); @@ -97,7 +97,7 @@ TEST(DataBuf, write_uintFunctionsThrowsIfTryingToWriteOutOfBounds) { } // Test methods like DataBuf::read_uint32 and DataBuf::write_uint32. -TEST(DataBuf, read_write_endianess) { +TEST(DataBuf, readWriteEndianess) { DataBuf buf(4 + 1 + 2 + 4 + 8); // Big endian.