Skip to content

Commit

Permalink
Split tests a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianFeldmann committed Oct 16, 2024
1 parent 0e57c6d commit d8100bc
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions YUViewUnitTest/filesource/DataSourceLocalFileTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ TEST(DataSourceLocalFileTest, OpenFileThatDoesNotExist)
filesource::DataSourceLocalFile file("/path/to/file/that/does/not/exist");
EXPECT_FALSE(file.isOk());
EXPECT_FALSE(file);
EXPECT_TRUE(file.filePath().empty());
EXPECT_EQ(file.getInfoList().size(), 0u);
EXPECT_FALSE(file.atEnd());
EXPECT_EQ(file.position(), 0);
Expand All @@ -55,19 +56,16 @@ TEST(DataSourceLocalFileTest, OpenFileThatDoesNotExist)

ByteVector dummyVector;
EXPECT_EQ(file.read(dummyVector, 378), 0);
EXPECT_EQ(dummyVector.size(), 0);
}

TEST(DataSourceLocalFileTest, OpenFileThatExists_TestReadingOfData)
TEST(DataSourceLocalFileTest, OpenFileThatExists_TestRetrievalOfFileInfo)
{
yuviewTest::TemporaryFile tempFile(DUMMY_DATA);

filesource::DataSourceLocalFile file(tempFile.getFilePath());
EXPECT_TRUE(file.isOk());
EXPECT_TRUE(file);

EXPECT_EQ(file.filePath(), tempFile.getFilePath());
EXPECT_FALSE(file.atEnd());
EXPECT_EQ(file.position(), 0);
EXPECT_EQ(file.fileSize().value(), 8);

const auto debugTest = file.getInfoList();
Expand All @@ -76,6 +74,19 @@ TEST(DataSourceLocalFileTest, OpenFileThatExists_TestReadingOfData)
tempFile.getFilePath().string(),
"The absolute path of the local file"),
InfoItem("File Size"sv, "8"sv)));
}

TEST(DataSourceLocalFileTest, OpenFileThatExists_TestReadingOfData)
{
yuviewTest::TemporaryFile tempFile(DUMMY_DATA);

filesource::DataSourceLocalFile file(tempFile.getFilePath());
EXPECT_TRUE(file.isOk());
EXPECT_TRUE(file);

EXPECT_EQ(file.filePath(), tempFile.getFilePath());
EXPECT_FALSE(file.atEnd());
EXPECT_EQ(file.position(), 0);

ByteVector buffer;
EXPECT_EQ(file.read(buffer, 5), 5);
Expand Down

0 comments on commit d8100bc

Please sign in to comment.