mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-10-30 04:31:28 +01:00
fixed version comparisons, previously done lexicographically
This commit is contained in:
1 parent
6df1aba669
commit
9cd390b291
3 files changed
+80
-8
No files matched your search
@@ -16,4 +16,39 @@ TEST_CASE("check if version is semantic", "[version]") {
|
||||
CHECK(version.hasSemanticVersioning() == has_semantic_version);
|
||||
}
|
||||
|
||||
TEST_CASE("semantic version ordering compares numerically", "[version]") {
|
||||
Version v9("9.1.1 0x250512");
|
||||
Version v10("10.0.1 0x250512");
|
||||
|
||||
CHECK(v9 <= v10);
|
||||
CHECK_FALSE(v10 <= v9);
|
||||
}
|
||||
|
||||
TEST_CASE("semantic version compares extra suffix lexicographically",
|
||||
"[version]") {
|
||||
Version rc("10.1.1.rc 0x250512");
|
||||
Version zz("10.1.1.zz 0x250512");
|
||||
|
||||
CHECK(rc <= zz);
|
||||
CHECK_FALSE(zz <= rc);
|
||||
}
|
||||
|
||||
TEST_CASE(
|
||||
"semantic comparison falls back to date on malformed semantic version",
|
||||
"[version]") {
|
||||
Version malformed("10.1 0x250512");
|
||||
Version valid("10.1.1 0x250513");
|
||||
|
||||
CHECK(malformed <= valid);
|
||||
CHECK_FALSE(valid <= malformed);
|
||||
}
|
||||
|
||||
TEST_CASE("semantic version compares extra suffix and without", "[version]") {
|
||||
Version v1011rc("10.1.1.rc 0x250512");
|
||||
Version v1010("10.1.0 0x250512");
|
||||
|
||||
CHECK_FALSE(v1011rc <= v1010);
|
||||
CHECK(v1010 <= v1011rc);
|
||||
}
|
||||
|
||||
} // namespace sls
|
||||
Reference in new issue
Block a user