Skip to content

Commit

Permalink
unitTests: fix sign comparison warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Feb 16, 2024
1 parent 84ce408 commit 149fe1e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion unitTests/test_DateValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ TEST(ADateValue, copiesToByteBufferWithBasicFormat) {
std::array<byte, 8> buf = {};

const byte expectedDate[10] = {'2', '0', '2', '1', '1', '2', '0', '1'};
ASSERT_EQ(8, dateValue.copy(buf.data()));
ASSERT_EQ(8u, dateValue.copy(buf.data()));
ASSERT_TRUE(std::equal(buf.begin(), buf.end(), expectedDate));
}

Expand Down
2 changes: 1 addition & 1 deletion unitTests/test_FileIo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TEST(AFileIO, returnsFileSizeEvenWhenFileItIsNotOpened) {
TEST(AFileIO, isOpenedAtPosition0) {
FileIo file(imagePath);
file.open();
ASSERT_EQ(0, file.tell());
ASSERT_EQ(0u, file.tell());
}

TEST(AFileIO, canSeekToExistingPositions) {
Expand Down
4 changes: 2 additions & 2 deletions unitTests/test_Photoshop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ TEST(PhotoshopLocateIrb, returns0withGoodIptcIrb) {
uint32_t sizeData = 0;

ASSERT_EQ(0, Photoshop::locateIrb(data.data(), data.size(), Photoshop::iptc_, &record, sizeHdr, sizeData));
ASSERT_EQ(12, sizeHdr);
ASSERT_EQ(27, sizeData);
ASSERT_EQ(12u, sizeHdr);
ASSERT_EQ(27u, sizeData);
}

TEST(PhotoshopLocateIptcIrb, returns0withGoodIptcIrb) {
Expand Down
2 changes: 1 addition & 1 deletion unitTests/test_TimeValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ TEST(ATimeValue, cannotReadFromStringWithBadFormat) {
TEST(ATimeValue, isCopiedToBuffer) {
const TimeValue value(23, 55, 2);
byte buffer[11];
ASSERT_EQ(11, value.copy(buffer));
ASSERT_EQ(11u, value.copy(buffer));

const byte expectedDate[11] = {'2', '3', '5', '5', '0', '2', '+', '0', '0', '0', '0'};
for (int i = 0; i < 11; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions unitTests/test_basicio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using namespace Exiv2;
TEST(MemIoDefault, readEReturns0) {
std::array<byte, 10> buf;
MemIo io;
ASSERT_EQ(0, io.read(buf.data(), buf.size()));
ASSERT_EQ(0u, io.read(buf.data(), buf.size()));
}

TEST(MemIoDefault, isNotAtEof) {
Expand Down Expand Up @@ -44,7 +44,7 @@ TEST(MemIoDefault, seekToEndPositionAndReadTriggersEof) {
ASSERT_EQ(0, io.tell());

std::array<byte, 64> buf2 = {};
ASSERT_EQ(0, io.read(buf2.data(), 1)); // Note that we cannot even read 1 byte being at the end
ASSERT_EQ(0u, io.read(buf2.data(), 1)); // Note that we cannot even read 1 byte being at the end
ASSERT_TRUE(io.eof());
}

Expand Down
4 changes: 2 additions & 2 deletions unitTests/test_bmpimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ TEST(BmpImage, readMetadataReadsImageDimensionsWhenDataIsAvailable) {
auto memIo = std::make_unique<MemIo>(header.data(), header.size());
BmpImage bmp(std::move(memIo));
ASSERT_NO_THROW(bmp.readMetadata());
ASSERT_EQ(1280, bmp.pixelWidth());
ASSERT_EQ(800, bmp.pixelHeight());
ASSERT_EQ(1280u, bmp.pixelWidth());
ASSERT_EQ(800u, bmp.pixelHeight());
}

TEST(BmpImage, readMetadataThrowsWhenImageIsNotBMP) {
Expand Down
2 changes: 1 addition & 1 deletion unitTests/test_matroskavideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ TEST(MatroskaVideo, readMetadata) {
ASSERT_NO_THROW(mkv.setXmpData(xmpData));
auto data = mkv.xmpData();
ASSERT_FALSE(data.empty());
ASSERT_EQ(xmpData["Xmp.video.TotalStream"].count(), 4);
ASSERT_EQ(xmpData["Xmp.video.TotalStream"].count(), 4u);
}
2 changes: 1 addition & 1 deletion unitTests/test_pngimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TEST(PngChunk, keyTxtChunkExtractsKeywordCorrectlyInPresenceOfNullChar) {

DataBuf chunkBuf(data.data(), data.size());
DataBuf key = Internal::PngChunk::keyTXTChunk(chunkBuf, true);
ASSERT_EQ(21, key.size());
ASSERT_EQ(21u, key.size());

ASSERT_TRUE(std::equal(key.data(), key.data() + key.size(), data.data() + 8));
}
Expand Down

0 comments on commit 149fe1e

Please sign in to comment.