Skip to content

Commit

Permalink
Fix unit testing for Set_Label function
Browse files Browse the repository at this point in the history
  • Loading branch information
maron2000 committed Jan 13, 2025
1 parent 65c979c commit 5570874
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/drives_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ TEST(LWildFileCmp, LFNCompare)
TEST(Set_Label, Daggerfall)
{
std::string output = run_Set_Label("Daggerfall", false);
EXPECT_EQ("Daggerfall ", output);
EXPECT_EQ("Daggerfall", output);
}
TEST(Set_Label, DaggerfallCD)
{
std::string output = run_Set_Label("Daggerfall", true);
EXPECT_EQ("Daggerfall ", output);
EXPECT_EQ("Daggerfall", output);
}

TEST(Set_Label, LongerThan11)
Expand All @@ -130,49 +130,49 @@ TEST(Set_Label, LongerThan11CD)
TEST(Set_Label, ShorterThan8)
{
std::string output = run_Set_Label("a123456", false);
EXPECT_EQ("a123456 ", output);
EXPECT_EQ("a123456", output);
}
TEST(Set_Label, ShorterThan8CD)
{
std::string output = run_Set_Label("a123456", true);
EXPECT_EQ("a123456 ", output);
EXPECT_EQ("a123456", output);
}

// Tests that the CD-ROM version adds a trailing dot when
// input is 8 chars plus one dot (9 chars total)
TEST(Set_Label, EqualTo8)
{
std::string output = run_Set_Label("a1234567", false);
EXPECT_EQ("a1234567 ", output);
EXPECT_EQ("a1234567", output);
}
TEST(Set_Label, EqualTo8CD)
{
std::string output = run_Set_Label("a1234567", true);
EXPECT_EQ("a1234567 ", output);
EXPECT_EQ("a1234567", output);
}

// A test to ensure non-CD-ROM function strips trailing dot
TEST(Set_Label, StripEndingDot)
{
std::string output = run_Set_Label("a1234567.", false);
EXPECT_EQ("a1234567. ", output);
EXPECT_EQ("a1234567.", output);
}
TEST(Set_Label, NoStripEndingDotCD)
{
std::string output = run_Set_Label("a1234567.", true);
EXPECT_EQ("a1234567. ", output);
EXPECT_EQ("a1234567.", output);
}

// Just to make sure this function doesn't clean invalid DOS labels
TEST(Set_Label, InvalidCharsEndingDot)
{
std::string output = run_Set_Label("?*':&@(..", false);
EXPECT_EQ("?*':&@(.. ", output);
EXPECT_EQ("?*':&@(..", output);
}
TEST(Set_Label, InvalidCharsEndingDotCD)
{
std::string output = run_Set_Label("?*':&@(..", true);
EXPECT_EQ("?*':&@(.. ", output);
EXPECT_EQ("?*':&@(..", output);
}

} // namespace

0 comments on commit 5570874

Please sign in to comment.