Skip to content

Commit

Permalink
Fixed file transmission test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Małecki committed Feb 28, 2024
1 parent 2075a65 commit 278fc72
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/test_file_transmission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ TEST(Transmission, FileUpload)
std::cout << "Sockets closed, joining receiver thread\n";
client.join();

std::ifstream tarfile("file.target");
std::ifstream tarfile("file.target", std::ios::in | std::ios::binary);
EXPECT_EQ(!!tarfile, true);

tarfile.seekg(0, std::ios::end);
Expand All @@ -189,7 +189,11 @@ TEST(Transmission, FileUpload)

std::cout << "Comparing files\n";
// Compare files
tarfile.seekg(0, std::ios::beg);

// Theoretically it should work if you just rewind to 0, but
// on Windows this somehow doesn't work.
tarfile.close();
tarfile.open("file.target", std::ios::in | std::ios::binary);

ifile.close();
ifile.open("file.source", std::ios::in | std::ios::binary);
Expand Down

0 comments on commit 278fc72

Please sign in to comment.