Skip to content

Commit

Permalink
Fix compilation warnings on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
piponazo committed Jan 5, 2022
1 parent eb5dd82 commit 8cbbf11
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions unitTests/test_basicio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TEST(MemIo, isNotAtEofInitially)
std::array<byte, 64> buf;
buf.fill(0);

MemIo io(buf.data(), buf.size());
MemIo io(buf.data(), static_cast<long>(buf.size()));
ASSERT_FALSE(io.eof());
}

Expand All @@ -39,7 +39,7 @@ TEST(MemIo, seekBeyondBufferSizeReturns1AndSetsEofToTrue)
std::array<byte, 64> buf;
buf.fill(0);

MemIo io(buf.data(), buf.size());
MemIo io(buf.data(), static_cast<long>(buf.size()));
ASSERT_EQ(1, io.seek(65, BasicIo::beg));
ASSERT_TRUE(io.eof());
}
Expand All @@ -49,7 +49,7 @@ TEST(MemIo, seekBefore0Returns1ButItDoesNotSetEofToTrue)
std::array<byte, 64> buf;
buf.fill(0);

MemIo io(buf.data(), buf.size());
MemIo io(buf.data(), static_cast<long>(buf.size()));
ASSERT_EQ(1, io.seek(-1, BasicIo::beg));
ASSERT_FALSE(io.eof());
}
Expand All @@ -59,7 +59,7 @@ TEST(MemIo, seekBeyondBoundsDoesNotMoveThePosition)
std::array<byte, 64> buf;
buf.fill(0);

MemIo io(buf.data(), buf.size());
MemIo io(buf.data(), static_cast<long>(buf.size()));
ASSERT_EQ(0, io.tell());
ASSERT_EQ(1, io.seek(65, BasicIo::beg));
ASSERT_EQ(0, io.tell());
Expand All @@ -70,7 +70,7 @@ TEST(MemIo, seekInsideBoundsMoveThePosition)
std::array<byte, 64> buf;
buf.fill(0);

MemIo io(buf.data(), buf.size());
MemIo io(buf.data(), static_cast<long>(buf.size()));
ASSERT_EQ(0, io.tell());
ASSERT_EQ(0, io.seek(32, BasicIo::beg));
ASSERT_EQ(32, io.tell());
Expand All @@ -81,7 +81,7 @@ TEST(MemIo, seekInsideBoundsUsingBeg_resetsThePosition)
std::array<byte, 64> buf;
buf.fill(0);

MemIo io(buf.data(), buf.size());
MemIo io(buf.data(), static_cast<long>(buf.size()));
std::vector<std::int64_t> positions {0, 8, 16, 32, 64};
for(auto pos: positions) {
ASSERT_EQ(0, io.seek(pos, BasicIo::beg));
Expand All @@ -94,7 +94,7 @@ TEST(MemIo, seekInsideBoundsUsingCur_shiftThePosition)
std::array<byte, 64> buf;
buf.fill(0);

MemIo io(buf.data(), buf.size());
MemIo io(buf.data(), static_cast<long>(buf.size()));
std::vector<std::int64_t> shifts {4, 4, 8, 16, 32};
std::vector<std::int64_t> positions {4, 8, 16, 32, 64};
for (size_t i = 0; i < shifts.size(); ++i) {
Expand All @@ -108,7 +108,7 @@ TEST(MemIo, seekToEndPosition_doesNotTriggerEof)
std::array<byte, 64> buf;
buf.fill(0);

MemIo io(buf.data(), buf.size());
MemIo io(buf.data(), static_cast<long>(buf.size()));
ASSERT_EQ(0, io.tell());
ASSERT_EQ(0, io.seek(0, BasicIo::end));
ASSERT_EQ(64, io.tell());
Expand All @@ -120,7 +120,7 @@ TEST(MemIo, seekToEndPositionAndReadTriggersEof)
std::array<byte, 64> buf;
buf.fill(0);

MemIo io(buf.data(), buf.size());
MemIo io(buf.data(), static_cast<long>(buf.size()));
ASSERT_EQ(0, io.seek(0, BasicIo::end));
ASSERT_EQ(64, io.tell());

Expand All @@ -134,7 +134,7 @@ TEST(MemIo, readEmptyIoReturns0)
{
std::array<byte, 10> buf;
MemIo io;
ASSERT_EQ(0, io.read(buf.data(), buf.size()));
ASSERT_EQ(0, io.read(buf.data(), static_cast<long>(buf.size())));
}

TEST(MemIo, readLessBytesThanAvailableReturnsRequestedBytes)
Expand All @@ -143,7 +143,7 @@ TEST(MemIo, readLessBytesThanAvailableReturnsRequestedBytes)
buf1.fill(1);
buf2.fill(0);

MemIo io(buf1.data(), buf1.size());
MemIo io(buf1.data(), static_cast<long>(buf1.size()));
ASSERT_EQ(5, io.read(buf2.data(), 5));
}

Expand All @@ -153,7 +153,7 @@ TEST(MemIo, readSameBytesThanAvailableReturnsRequetedBytes)
buf1.fill(1);
buf2.fill(0);

MemIo io(buf1.data(), buf1.size());
MemIo io(buf1.data(), static_cast<long>(buf1.size()));
ASSERT_EQ(10, io.read(buf2.data(), 10));
}

Expand All @@ -163,6 +163,6 @@ TEST(MemIo, readMoreBytesThanAvailableReturnsAvailableBytes)
buf1.fill(1);
buf2.fill(0);

MemIo io(buf1.data(), buf1.size());
MemIo io(buf1.data(), static_cast<long>(buf1.size()));
ASSERT_EQ(10, io.read(buf2.data(), 15));
}

0 comments on commit 8cbbf11

Please sign in to comment.