Make Version more space efficient
This commit is contained in:
@@ -559,4 +559,47 @@ TEST_CASE("testUnimportantVersionParts", "[Version]")
|
||||
REQUIRE(Version("1.0.0.3") == Version("1.0.0.3.0.0.0"));
|
||||
REQUIRE(Version("1.0.0.3") == Version("1.0.0.3.0.00.0"));
|
||||
REQUIRE(Version("1.0.0.3") == Version("1.00.0.3"));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("testCopyConstructorAndAssignment", "[Version]")
|
||||
{
|
||||
Version original("1.5.3");
|
||||
Version copyConstructed(original);
|
||||
REQUIRE(copyConstructed == original);
|
||||
REQUIRE(static_cast<const std::string&>(copyConstructed) == static_cast<const std::string&>(original));
|
||||
|
||||
Version copyAssigned("2.0");
|
||||
copyAssigned = original;
|
||||
REQUIRE(copyAssigned == original);
|
||||
REQUIRE(static_cast<const std::string&>(copyAssigned) == static_cast<const std::string&>(original));
|
||||
|
||||
Version extended("1.2.3-ALPHA-B99-T11");
|
||||
Version cpConstructedExtended(extended);
|
||||
REQUIRE(cpConstructedExtended.Timestamp() == 11);
|
||||
REQUIRE(cpConstructedExtended == extended);
|
||||
|
||||
Version extended3 = extended;
|
||||
REQUIRE(extended3.Timestamp() == 11);
|
||||
REQUIRE(extended3 == extended);
|
||||
}
|
||||
|
||||
TEST_CASE("testMoveConstructorAndAssignment", "[Version]")
|
||||
{
|
||||
Version original("3.1.4");
|
||||
Version movedConstructed(std::move(original));
|
||||
REQUIRE(static_cast<const std::string&>(movedConstructed) == "3.1.4");
|
||||
|
||||
Version another("0.9.9");
|
||||
another = std::move(movedConstructed);
|
||||
REQUIRE(static_cast<const std::string&>(another) == "3.1.4");
|
||||
|
||||
Version extended("1.2.3-ALPHA-B99-T11");
|
||||
Version mvConstructedExtended(std::move(extended));
|
||||
REQUIRE(mvConstructedExtended.Timestamp() == 11);
|
||||
REQUIRE(mvConstructedExtended != extended);
|
||||
|
||||
Version extended3 = std::move(mvConstructedExtended);
|
||||
REQUIRE(extended3.Timestamp() == 11);
|
||||
REQUIRE(extended3 != extended);
|
||||
REQUIRE(extended3 != mvConstructedExtended);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user