Organized tests according to folders where they are defined
This commit is contained in:
68
tests/Base/UnitFormatter.cpp
Normal file
68
tests/Base/UnitFormatter.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include "Base/UnitFormatter.hpp"
|
||||
|
||||
using namespace units::literals;
|
||||
|
||||
TEST_CASE("testUnitFormatterWithTrailingZeros", "[UnitFormatter]")
|
||||
{
|
||||
OpenVulkano::UnitFormatter metricFormatter(true, 2, false);
|
||||
OpenVulkano::UnitFormatter imperialFormatter(false, 2, false);
|
||||
|
||||
units::length::meter_t positiveDistance = 1500.0_m;
|
||||
units::length::meter_t smallDistance = 0.5_m;
|
||||
units::length::meter_t negativeDistance = -100.0_m;
|
||||
units::length::meter_t smallDistanceMetric = 0.05_m;
|
||||
units::length::meter_t smallDistanceImperial = 0.03_m;
|
||||
units::area::square_meter_t smallArea(0.005);
|
||||
units::area::square_meter_t negativeArea(-50.0);
|
||||
|
||||
REQUIRE(metricFormatter.Format(positiveDistance) == "1.50 km");
|
||||
REQUIRE(metricFormatter.Format(smallDistance) == "0.50 m");
|
||||
REQUIRE(metricFormatter.Format(negativeDistance) == "-100.00 m");
|
||||
REQUIRE(metricFormatter.Format(smallArea) == "0.01 m²");
|
||||
REQUIRE(metricFormatter.Format(negativeArea) == "-50.00 m²");
|
||||
REQUIRE(imperialFormatter.Format(smallDistance) == "1.64 ft");
|
||||
REQUIRE(imperialFormatter.Format(negativeDistance) == "-328.08 ft");
|
||||
REQUIRE(imperialFormatter.Format(smallArea) == "0.05 ft²");
|
||||
REQUIRE(imperialFormatter.Format(negativeArea) == "-538.20 ft²");
|
||||
REQUIRE(metricFormatter.Format(smallDistanceMetric) == "50.00 mm");
|
||||
REQUIRE(imperialFormatter.Format(smallDistanceImperial) == "1.18 in");
|
||||
}
|
||||
|
||||
TEST_CASE("testUnitFormatterWithoutTrailingZeros", "[UnitFormatter]")
|
||||
{
|
||||
OpenVulkano::UnitFormatter metricFormatter(true, 2);
|
||||
OpenVulkano::UnitFormatter imperialFormatter(false, 2);
|
||||
|
||||
units::length::meter_t positiveDistance = 1500.0_m;
|
||||
units::length::meter_t smallDistance = 0.5_m;
|
||||
units::length::meter_t negativeDistance = -100.0_m;
|
||||
units::length::meter_t smallDistanceMetric = 0.05_m;
|
||||
units::length::meter_t smallDistanceImperial = 0.03_m;
|
||||
units::length::meter_t mediumDistanceMetric = 0.5_m;
|
||||
units::length::meter_t largeDistanceMetric = 100.0_m;
|
||||
units::area::square_meter_t smallArea(0.005);
|
||||
units::area::square_meter_t negativeArea(-50.0);
|
||||
|
||||
REQUIRE(metricFormatter.Format(positiveDistance) == "1.5 km");
|
||||
REQUIRE(metricFormatter.Format(smallDistance) == "0.5 m");
|
||||
REQUIRE(metricFormatter.Format(negativeDistance) == "-100 m");
|
||||
REQUIRE(metricFormatter.Format(smallArea) == "0.01 m²");
|
||||
REQUIRE(metricFormatter.Format(negativeArea) == "-50 m²");
|
||||
REQUIRE(imperialFormatter.Format(smallDistance) == "1.64 ft");
|
||||
REQUIRE(imperialFormatter.Format(negativeDistance) == "-328.08 ft");
|
||||
REQUIRE(imperialFormatter.Format(smallArea) == "0.05 ft²");
|
||||
REQUIRE(imperialFormatter.Format(negativeArea) == "-538.2 ft²");
|
||||
REQUIRE(metricFormatter.Format(smallDistanceMetric) == "50 mm");
|
||||
REQUIRE(imperialFormatter.Format(smallDistanceImperial) == "1.18 in");
|
||||
REQUIRE(metricFormatter.Format(smallDistanceMetric) == "50 mm");
|
||||
REQUIRE(metricFormatter.Format(mediumDistanceMetric) == "0.5 m");
|
||||
REQUIRE(metricFormatter.Format(largeDistanceMetric) == "100 m");
|
||||
}
|
||||
262
tests/Base/Utils.cpp
Normal file
262
tests/Base/Utils.cpp
Normal file
@@ -0,0 +1,262 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include "Base/Utils.hpp"
|
||||
|
||||
enum class AnEnum
|
||||
{
|
||||
Zero = 0,
|
||||
One = 1,
|
||||
Max = 100
|
||||
};
|
||||
|
||||
using namespace OpenVulkano;
|
||||
|
||||
TEST_CASE("EnumAsInt", "[Utils]")
|
||||
{
|
||||
REQUIRE(Utils::EnumAsInt(AnEnum::Zero) == 0);
|
||||
REQUIRE(Utils::EnumAsInt(AnEnum::One) == 1);
|
||||
REQUIRE(Utils::EnumAsInt(AnEnum::Max) == 100);
|
||||
|
||||
enum class EdgeEnum : int64_t
|
||||
{
|
||||
Min = INT64_MIN,
|
||||
Max = INT64_MAX
|
||||
};
|
||||
REQUIRE(Utils::EnumAsInt(EdgeEnum::Min) == INT64_MIN);
|
||||
REQUIRE(Utils::EnumAsInt(EdgeEnum::Max) == INT64_MAX);
|
||||
}
|
||||
|
||||
TEST_CASE("Align", "[Utils]")
|
||||
{
|
||||
REQUIRE(Utils::Align(1, 4) == 4);
|
||||
REQUIRE(Utils::Align(2, 4) == 4);
|
||||
REQUIRE(Utils::Align(3, 4) == 4);
|
||||
REQUIRE(Utils::Align(4, 4) == 4);
|
||||
REQUIRE(Utils::Align(5, 4) == 8);
|
||||
REQUIRE(Utils::Align(6, 4) == 8);
|
||||
REQUIRE(Utils::Align(7, 4) == 8);
|
||||
REQUIRE(Utils::Align(8, 4) == 8);
|
||||
|
||||
REQUIRE(Utils::Align(0, 8) == 0);
|
||||
REQUIRE(Utils::Align(SIZE_MAX, 8) == 0); // it is natural for this condition due to overflow
|
||||
|
||||
REQUIRE(Utils::Align(5, 1) == 5);
|
||||
REQUIRE(Utils::Align(123456789, 1) == 123456789);
|
||||
|
||||
REQUIRE(Utils::Align(10, 16) == 16);
|
||||
REQUIRE(Utils::Align(15, 16) == 16);
|
||||
}
|
||||
|
||||
TEST_CASE("AlignPage", "[Utils]")
|
||||
{
|
||||
REQUIRE(Utils::AlignPage(1000) == 4096);
|
||||
REQUIRE(Utils::AlignPage(5000) == 8192);
|
||||
|
||||
REQUIRE(Utils::AlignPage(0) == 0);
|
||||
REQUIRE(Utils::AlignPage(SIZE_MAX) == Utils::Align(SIZE_MAX, 4096));
|
||||
}
|
||||
|
||||
TEST_CASE("IsPow2", "[Utils]")
|
||||
{
|
||||
REQUIRE(Utils::IsPow2<uint32_t>(1));
|
||||
REQUIRE(Utils::IsPow2<uint32_t>(2));
|
||||
REQUIRE(Utils::IsPow2<uint32_t>(16));
|
||||
REQUIRE_FALSE(Utils::IsPow2<uint32_t>(6));
|
||||
|
||||
REQUIRE(Utils::IsPow2<uint32_t>(0));
|
||||
REQUIRE(Utils::IsPow2<uint64_t>(1ULL << 63));
|
||||
}
|
||||
|
||||
TEST_CASE("Log2OfPow2", "[Utils]")
|
||||
{
|
||||
REQUIRE(Utils::Log2OfPow2<uint32_t>(1) == 0);
|
||||
REQUIRE(Utils::Log2OfPow2<uint32_t>(2) == 1);
|
||||
REQUIRE(Utils::Log2OfPow2<uint32_t>(16) == 4);
|
||||
|
||||
REQUIRE(Utils::Log2OfPow2<uint64_t>(1ULL << 63) == 63);
|
||||
}
|
||||
|
||||
TEST_CASE("OctToInt", "[Utils]")
|
||||
{
|
||||
REQUIRE(Utils::OctToInt("7") == 7);
|
||||
REQUIRE(Utils::OctToInt("10") == 8);
|
||||
REQUIRE(Utils::OctToInt("1234") == 668);
|
||||
REQUIRE(Utils::OctToInt("777") == 511);
|
||||
REQUIRE(Utils::OctToInt("1000") == 512);
|
||||
|
||||
REQUIRE(Utils::OctToInt("000") == 0);
|
||||
REQUIRE(Utils::OctToInt("07777") == 4095);
|
||||
|
||||
REQUIRE(Utils::OctToInt("9") == -1);
|
||||
REQUIRE(Utils::OctToInt("A") == -1);
|
||||
REQUIRE(Utils::OctToInt("") == 0);
|
||||
|
||||
REQUIRE(Utils::OctToInt(" 1234 ") == 668);
|
||||
}
|
||||
|
||||
TEST_CASE("StartsWith", "[Utils]")
|
||||
{
|
||||
REQUIRE(Utils::StartsWith("abcdef", "abc"));
|
||||
REQUIRE(Utils::StartsWith("abcdef", "a"));
|
||||
REQUIRE(Utils::StartsWith("abcdef", ""));
|
||||
|
||||
REQUIRE_FALSE(Utils::StartsWith("abcdef", "abcdz"));
|
||||
REQUIRE_FALSE(Utils::StartsWith("a", "aa"));
|
||||
REQUIRE_FALSE(Utils::StartsWith("", "a"));
|
||||
REQUIRE(Utils::StartsWith("abcdef", "abcdef"));
|
||||
}
|
||||
|
||||
TEST_CASE("EndsWith", "[Utils]")
|
||||
{
|
||||
REQUIRE(Utils::EndsWith("abcdef", "def"));
|
||||
REQUIRE(Utils::EndsWith("abcdef", "f"));
|
||||
REQUIRE(Utils::EndsWith("abcdef", ""));
|
||||
|
||||
REQUIRE_FALSE(Utils::EndsWith("abcdef", "abcdeh"));
|
||||
REQUIRE_FALSE(Utils::EndsWith("a", "aa"));
|
||||
REQUIRE(Utils::EndsWith("abcdef", "abcdef"));
|
||||
}
|
||||
|
||||
TEST_CASE("SplitAtLastOccurrence Extended", "[Utils]")
|
||||
{
|
||||
auto result = Utils::SplitAtLastOccurrence("folder/file.txt", '/');
|
||||
REQUIRE(result.first == "folder");
|
||||
REQUIRE(result.second == "file.txt");
|
||||
|
||||
result = Utils::SplitAtLastOccurrence("test.ext", '.');
|
||||
REQUIRE(result.first == "test");
|
||||
REQUIRE(result.second == "ext");
|
||||
|
||||
result = Utils::SplitAtLastOccurrence("nochar", '/');
|
||||
REQUIRE(result.first == "nochar");
|
||||
REQUIRE(result.second == "");
|
||||
|
||||
result = Utils::SplitAtLastOccurrence("/leading/slash", '/');
|
||||
REQUIRE(result.first == "/leading");
|
||||
REQUIRE(result.second == "slash");
|
||||
|
||||
result = Utils::SplitAtLastOccurrence("/leadingonly/", '/');
|
||||
REQUIRE(result.first == "/leadingonly");
|
||||
REQUIRE(result.second == "");
|
||||
|
||||
result = Utils::SplitAtLastOccurrence("onlyslash/", '/');
|
||||
REQUIRE(result.first == "onlyslash");
|
||||
REQUIRE(result.second == "");
|
||||
}
|
||||
|
||||
TEST_CASE("Split", "[Utils]")
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
|
||||
result = Utils::Split("a,b,c", ',');
|
||||
REQUIRE(result.size() == 3);
|
||||
REQUIRE(result[0] == "a");
|
||||
REQUIRE(result[1] == "b");
|
||||
REQUIRE(result[2] == "c");
|
||||
|
||||
result = Utils::Split("one|two|three", '|');
|
||||
REQUIRE(result.size() == 3);
|
||||
REQUIRE(result[0] == "one");
|
||||
REQUIRE(result[1] == "two");
|
||||
REQUIRE(result[2] == "three");
|
||||
|
||||
result = Utils::Split("", ',');
|
||||
REQUIRE(result.empty());
|
||||
|
||||
result = Utils::Split("no separator here", ',');
|
||||
REQUIRE(result.size() == 1);
|
||||
REQUIRE(result[0] == "no separator here");
|
||||
|
||||
result = Utils::Split("a,,b,,c", ',');
|
||||
REQUIRE(result.size() == 3);
|
||||
REQUIRE(result[0] == "a");
|
||||
REQUIRE(result[1] == "b");
|
||||
REQUIRE(result[2] == "c");
|
||||
|
||||
result = Utils::Split(",a,b,c,", ',');
|
||||
REQUIRE(result.size() == 3);
|
||||
REQUIRE(result[0] == "a");
|
||||
REQUIRE(result[1] == "b");
|
||||
REQUIRE(result[2] == "c");
|
||||
|
||||
result = Utils::Split(",,,,,", ',');
|
||||
REQUIRE(result.empty());
|
||||
|
||||
result = Utils::Split("a", ',');
|
||||
REQUIRE(result.size() == 1);
|
||||
REQUIRE(result[0] == "a");
|
||||
|
||||
result = Utils::Split(",,", ',');
|
||||
REQUIRE(result.empty());
|
||||
|
||||
result = Utils::Split(",", ',');
|
||||
REQUIRE(result.empty());
|
||||
|
||||
result = Utils::Split("a,", ',');
|
||||
REQUIRE(result.size() == 1);
|
||||
REQUIRE(result[0] == "a");
|
||||
}
|
||||
|
||||
TEST_CASE("Split with non-null-terminated strings", "[Utils]")
|
||||
{
|
||||
std::string_view input;
|
||||
std::vector<std::string> result;
|
||||
|
||||
input = { "a,b,c|", 5 };
|
||||
result = Utils::Split(input, ',');
|
||||
|
||||
REQUIRE(result.size() == 3);
|
||||
REQUIRE(result[0] == "a");
|
||||
REQUIRE(result[1] == "b");
|
||||
REQUIRE(result[2] == "c");
|
||||
|
||||
input = { "one|two|three>", 13 };
|
||||
result = Utils::Split(input, '|');
|
||||
REQUIRE(result.size() == 3);
|
||||
REQUIRE(result[0] == "one");
|
||||
REQUIRE(result[1] == "two");
|
||||
REQUIRE(result[2] == "three");
|
||||
|
||||
input = { "no separator here|", 17 };
|
||||
result = Utils::Split(input, ',');
|
||||
REQUIRE(result.size() == 1);
|
||||
REQUIRE(result[0] == "no separator here");
|
||||
|
||||
input = { "a,,b,,c|", 7 };
|
||||
result = Utils::Split(input, ',');
|
||||
REQUIRE(result.size() == 3);
|
||||
REQUIRE(result[0] == "a");
|
||||
REQUIRE(result[1] == "b");
|
||||
REQUIRE(result[2] == "c");
|
||||
|
||||
input = { ",a,b,c,|", 7 };
|
||||
result = Utils::Split(input, ',');
|
||||
REQUIRE(result.size() == 3);
|
||||
REQUIRE(result[0] == "a");
|
||||
REQUIRE(result[1] == "b");
|
||||
REQUIRE(result[2] == "c");
|
||||
|
||||
input = { ",,,,|", 4 };
|
||||
result = Utils::Split(input, ',');
|
||||
REQUIRE(result.empty());
|
||||
|
||||
input = { "a|", 1 };
|
||||
result = Utils::Split(input, ',');
|
||||
REQUIRE(result.size() == 1);
|
||||
REQUIRE(result[0] == "a");
|
||||
|
||||
input = { "a,|", 2 };
|
||||
result = Utils::Split(input, ',');
|
||||
REQUIRE(result.size() == 1);
|
||||
REQUIRE(result[0] == "a");
|
||||
|
||||
input = { ",,,|", 3 };
|
||||
result = Utils::Split(input, ',');
|
||||
REQUIRE(result.empty());
|
||||
}
|
||||
562
tests/Base/Version.cpp
Normal file
562
tests/Base/Version.cpp
Normal file
@@ -0,0 +1,562 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include "Base/Version.hpp"
|
||||
|
||||
using namespace OpenVulkano;
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::string VERSION_1 = "1", VERSION_1_0 = "1.0", VERSION_V1_0 = "v1.0", VERSION_V2_0 = "v2.0", VERSION_2_0_SNAPSHOT = "2.0-SNAPSHOT";
|
||||
const std::string VERSION_1_2_SNAPSHOT = "1.2-SNAPSHOT", VERSION_1_2 = "1.2", VERSION_1_2_BETA = "1.2-Beta", VERSION_1_2_BETA2 = "1.2-BETA2";
|
||||
const std::string VERSION_1_2_SNAPSHOT_BUILD_5 = "1.2-SNAPSHOT-Build5", VERSION_1_2_SNAPSHOT_BUILD_8 = "1.2-SNAPSHOT-Build=8";
|
||||
const std::string VERSION_1_2_SNAPSHOT_TIME_201703081212 = "1.2-SNAPSHOT-T201703081212", VERSION_1_2_SNAPSHOT_TIME_201603081212 = "1.2-SNAPSHOT-Timestamp=201603081212";
|
||||
const Version version_1 = Version(VERSION_1), version_1_0 = Version(VERSION_1_0), version_v1_0 = Version(VERSION_V1_0), version_1_2_it = Version(VERSION_1_2, true);
|
||||
const Version version_1_2_snapshot = Version(VERSION_1_2_SNAPSHOT), version_1_2 = Version(VERSION_1_2), version_1_2_snapshot_it = Version(VERSION_1_2_SNAPSHOT, true);
|
||||
const Version version_1_2_beta = Version(VERSION_1_2_BETA), version_1_2_beta2 = Version(VERSION_1_2_BETA2), version_v2_0 = Version(VERSION_V2_0);
|
||||
const Version version_2_0_snapshot = Version(VERSION_2_0_SNAPSHOT);
|
||||
const Version version_1_2_snapshot_b_5 = Version(VERSION_1_2_SNAPSHOT_BUILD_5), version_1_2_snapshot_b_8 = Version(VERSION_1_2_SNAPSHOT_BUILD_8);
|
||||
const Version version_1_2_snapshot_t_201703081212 = Version(VERSION_1_2_SNAPSHOT_TIME_201703081212), version_1_2_snapshot_t_201603081212 = Version(VERSION_1_2_SNAPSHOT_TIME_201603081212);
|
||||
}
|
||||
|
||||
TEST_CASE("testSpecialVersion", "[Version]")
|
||||
{
|
||||
REQUIRE("1.8.0" == static_cast<const std::string&>(Version("1.8.0")));
|
||||
REQUIRE("1.8-alpha-snapshot" == static_cast<const std::string&>(Version("1.8-alpha-snapshot")));
|
||||
}
|
||||
|
||||
TEST_CASE("testNewerThan", "[Version]")
|
||||
{
|
||||
REQUIRE(version_1_2 > version_1);
|
||||
REQUIRE(version_1_2 > version_1_0);
|
||||
REQUIRE(version_1_2 > version_v1_0);
|
||||
/*REQUIRE(version_1_2 > version_1_2_snapshot);
|
||||
REQUIRE(version_1_2 > version_1_2_beta);
|
||||
REQUIRE(version_1_2 > version_1_2_beta2);*/
|
||||
REQUIRE(version_1_2_it > version_1);
|
||||
REQUIRE(version_1_2_it > version_1_0);
|
||||
REQUIRE(version_1_2_it > version_v1_0);
|
||||
/*REQUIRE(version_1_2_it > version_1_2_snapshot);
|
||||
REQUIRE(version_1_2_it > version_1_2_beta);
|
||||
REQUIRE(version_1_2_it > version_1_2_beta2);
|
||||
REQUIRE(version_1_2_snapshot > version_1);
|
||||
REQUIRE(version_1_2_snapshot > version_1_0);
|
||||
REQUIRE(version_1_2_snapshot > version_v1_0);
|
||||
REQUIRE(version_1_2_snapshot > version_1_2_beta);
|
||||
REQUIRE(version_1_2_snapshot > version_1_2_beta2);
|
||||
REQUIRE(version_1_2_snapshot_it > version_1);
|
||||
REQUIRE(version_1_2_snapshot_it > version_1_0);
|
||||
REQUIRE(version_1_2_snapshot_it > version_v1_0);
|
||||
REQUIRE(version_1_2_snapshot_it > version_1_2_snapshot);
|
||||
REQUIRE(version_1_2_snapshot_it > version_1_2_beta);
|
||||
REQUIRE(version_1_2_snapshot_it > version_1_2_beta2);
|
||||
REQUIRE(version_1_2_beta > version_1);
|
||||
REQUIRE(version_1_2_beta > version_1_0);
|
||||
REQUIRE(version_1_2_beta > version_v1_0);
|
||||
REQUIRE(version_1_2_beta2 > version_1);
|
||||
REQUIRE(version_1_2_beta2 > version_1_0);
|
||||
REQUIRE(version_1_2_beta2 > version_v1_0);
|
||||
REQUIRE(version_1_2_beta2 > version_1_2_beta);
|
||||
REQUIRE(version_2_0_snapshot > version_1_2);
|
||||
REQUIRE(version_v2_0 > version_2_0_snapshot);
|
||||
REQUIRE(version_1_2_snapshot_b_8 > version_1_2_snapshot_b_5);
|
||||
REQUIRE(version_1_2_snapshot_t_201703081212 > version_1_2_snapshot_t_201603081212);*/
|
||||
REQUIRE_FALSE(version_1 > version_1);
|
||||
REQUIRE_FALSE(version_1 > version_1_0);
|
||||
REQUIRE_FALSE(version_1 > version_v1_0);
|
||||
REQUIRE_FALSE(version_1 > version_1_2);
|
||||
REQUIRE_FALSE(version_1 > version_1_2_it);
|
||||
REQUIRE_FALSE(version_1 > version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1 > version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1 > version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1 > version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1 > version_v2_0);
|
||||
REQUIRE_FALSE(version_1_0 > version_1);
|
||||
REQUIRE_FALSE(version_1_0 > version_1_0);
|
||||
REQUIRE_FALSE(version_1_0 > version_v1_0);
|
||||
REQUIRE_FALSE(version_1_0 > version_1_2);
|
||||
REQUIRE_FALSE(version_1_0 > version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_0 > version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_0 > version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_0 > version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_0 > version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1_0 > version_v2_0);
|
||||
REQUIRE_FALSE(version_v1_0 > version_1_2);
|
||||
REQUIRE_FALSE(version_v1_0 > version_1_2_it);
|
||||
REQUIRE_FALSE(version_v1_0 > version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_v1_0 > version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_v1_0 > version_1);
|
||||
REQUIRE_FALSE(version_v1_0 > version_1_0);
|
||||
REQUIRE_FALSE(version_v1_0 > version_v1_0);
|
||||
REQUIRE_FALSE(version_v1_0 > version_1_2_beta);
|
||||
REQUIRE_FALSE(version_v1_0 > version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_v1_0 > version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot > version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_snapshot > version_1_2);
|
||||
REQUIRE_FALSE(version_1_2_snapshot > version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2_snapshot > version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_2_snapshot > version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2 > version_1_2);
|
||||
REQUIRE_FALSE(version_1_2 > version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2 > version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_2 > version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_it > version_1_2);
|
||||
REQUIRE_FALSE(version_1_2_it > version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2_it > version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_2_it > version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it > version_1_2);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it > version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it > version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it > version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_beta > version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_beta > version_1_2);
|
||||
REQUIRE_FALSE(version_1_2_beta > version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2_beta > version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_2_beta > version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2_beta > version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1_2_beta > version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_beta2 > version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_beta2 > version_1_2);
|
||||
REQUIRE_FALSE(version_1_2_beta2 > version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2_beta2 > version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_2_beta2 > version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1_2_beta2 > version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_b_5 > version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_t_201703081212 > version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_2_0_snapshot > version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot > version_1_2_snapshot_b_5);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_b_5 > version_1_2_snapshot_b_8);
|
||||
REQUIRE_FALSE(version_1_2_snapshot > version_1_2_snapshot_t_201703081212);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_t_201603081212 > version_1_2_snapshot_t_201703081212);
|
||||
}
|
||||
|
||||
TEST_CASE("testNewerOrEqualThan", "[Version]")
|
||||
{
|
||||
REQUIRE(version_1 >= version_1);
|
||||
REQUIRE(version_1 >= version_1_0);
|
||||
REQUIRE(version_1 >= version_v1_0);
|
||||
REQUIRE(version_1_0 >= version_1);
|
||||
REQUIRE(version_1_0 >= version_1_0);
|
||||
REQUIRE(version_1_0 >= version_v1_0);
|
||||
REQUIRE(version_v1_0 >= version_1);
|
||||
REQUIRE(version_v1_0 >= version_1_0);
|
||||
REQUIRE(version_v1_0 >= version_v1_0);
|
||||
REQUIRE(version_1_2 >= version_1);
|
||||
REQUIRE(version_1_2 >= version_1_0);
|
||||
REQUIRE(version_1_2 >= version_v1_0);
|
||||
REQUIRE(version_1_2 >= version_1_2_snapshot);
|
||||
REQUIRE(version_1_2 >= version_1_2);
|
||||
REQUIRE(version_1_2 >= version_1_2_it);
|
||||
REQUIRE(version_1_2 >= version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_2 >= version_1_2_beta);
|
||||
REQUIRE(version_1_2 >= version_1_2_beta2);
|
||||
REQUIRE(version_1_2_it >= version_1);
|
||||
REQUIRE(version_1_2_it >= version_1_0);
|
||||
REQUIRE(version_1_2_it >= version_v1_0);
|
||||
REQUIRE(version_1_2_it >= version_1_2_snapshot);
|
||||
REQUIRE(version_1_2_it >= version_1_2);
|
||||
REQUIRE(version_1_2_it >= version_1_2_it);
|
||||
REQUIRE(version_1_2_it >= version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_2_it >= version_1_2_beta);
|
||||
REQUIRE(version_1_2_it >= version_1_2_beta2);
|
||||
REQUIRE(version_1_2_snapshot >= version_1_2_snapshot);
|
||||
REQUIRE(version_1_2_snapshot >= version_1);
|
||||
REQUIRE(version_1_2_snapshot >= version_1_0);
|
||||
REQUIRE(version_1_2_snapshot >= version_v1_0);
|
||||
REQUIRE(version_1_2_snapshot >= version_1_2_beta);
|
||||
REQUIRE(version_1_2_snapshot >= version_1_2_beta2);
|
||||
REQUIRE(version_1_2_snapshot_it >= version_1_2);
|
||||
REQUIRE(version_1_2_snapshot_it >= version_1_2_it);
|
||||
REQUIRE(version_1_2_snapshot_it >= version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_2_snapshot_it >= version_1);
|
||||
REQUIRE(version_1_2_snapshot_it >= version_1_0);
|
||||
REQUIRE(version_1_2_snapshot_it >= version_v1_0);
|
||||
REQUIRE(version_1_2_snapshot_it >= version_1_2_snapshot);
|
||||
REQUIRE(version_1_2_snapshot_it >= version_1_2_beta);
|
||||
REQUIRE(version_1_2_snapshot_it >= version_1_2_beta2);
|
||||
REQUIRE(version_1_2_beta >= version_1);
|
||||
REQUIRE(version_1_2_beta >= version_1_0);
|
||||
REQUIRE(version_1_2_beta >= version_v1_0);
|
||||
REQUIRE(version_1_2_beta >= version_1_2_beta);
|
||||
REQUIRE(version_1_2_beta2 >= version_1);
|
||||
REQUIRE(version_1_2_beta2 >= version_1_0);
|
||||
REQUIRE(version_1_2_beta2 >= version_v1_0);
|
||||
REQUIRE(version_1_2_beta2 >= version_1_2_beta);
|
||||
REQUIRE(version_1_2_beta2 >= version_1_2_beta2);
|
||||
REQUIRE(version_2_0_snapshot >= version_1_2);
|
||||
REQUIRE(version_v2_0 >= version_1);
|
||||
REQUIRE(version_v2_0 >= version_1_0);
|
||||
REQUIRE(version_v2_0 >= version_v1_0);
|
||||
REQUIRE(version_v2_0 >= version_1_2_snapshot);
|
||||
REQUIRE(version_v2_0 >= version_1_2);
|
||||
REQUIRE(version_v2_0 >= version_1_2_it);
|
||||
REQUIRE(version_v2_0 >= version_1_2_snapshot_it);
|
||||
REQUIRE(version_v2_0 >= version_1_2_beta);
|
||||
REQUIRE(version_v2_0 >= version_1_2_beta2);
|
||||
REQUIRE(version_v2_0 >= version_2_0_snapshot);
|
||||
REQUIRE(version_v2_0 >= version_v2_0);
|
||||
REQUIRE_FALSE(version_1 >= version_1_2);
|
||||
REQUIRE_FALSE(version_1 >= version_1_2_it);
|
||||
REQUIRE_FALSE(version_1 >= version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1 >= version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1 >= version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1 >= version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1 >= version_v2_0);
|
||||
REQUIRE_FALSE(version_1_0 >= version_1_2);
|
||||
REQUIRE_FALSE(version_1_0 >= version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_0 >= version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_0 >= version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_0 >= version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_0 >= version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1_0 >= version_v2_0);
|
||||
REQUIRE_FALSE(version_v1_0 >= version_1_2);
|
||||
REQUIRE_FALSE(version_v1_0 >= version_1_2_it);
|
||||
REQUIRE_FALSE(version_v1_0 >= version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_v1_0 >= version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_v1_0 >= version_1_2_beta);
|
||||
REQUIRE_FALSE(version_v1_0 >= version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_v1_0 >= version_v2_0);
|
||||
/*REQUIRE_FALSE(version_1_2_snapshot >= version_1_2);
|
||||
REQUIRE_FALSE(version_1_2_snapshot >= version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2_snapshot >= version_1_2_snapshot_it);*/
|
||||
REQUIRE_FALSE(version_1_2_snapshot >= version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2 >= version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it >= version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_it >= version_v2_0);
|
||||
/*REQUIRE_FALSE(version_1_2_beta >= version_1_2);
|
||||
REQUIRE_FALSE(version_1_2_beta >= version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1_2_beta >= version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2_beta >= version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_beta >= version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_2_beta >= version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_beta2 >= version_1_2);
|
||||
REQUIRE_FALSE(version_1_2_beta2 >= version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2_beta2 >= version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_beta2 >= version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_2_beta2 >= version_v2_0);
|
||||
REQUIRE_FALSE(version_2_0_snapshot >= version_v2_0);*/
|
||||
}
|
||||
|
||||
TEST_CASE("testOlderThan", "[Version]")
|
||||
{
|
||||
REQUIRE(version_1 < version_1_2);
|
||||
REQUIRE(version_1 < version_1_2_it);
|
||||
REQUIRE(version_1 < version_1_2_snapshot);
|
||||
REQUIRE(version_1 < version_1_2_snapshot_it);
|
||||
REQUIRE(version_1 < version_1_2_beta);
|
||||
REQUIRE(version_1 < version_1_2_beta2);
|
||||
REQUIRE(version_1 < version_v2_0);
|
||||
REQUIRE(version_1_0 < version_1_2);
|
||||
REQUIRE(version_1_0 < version_1_2_it);
|
||||
REQUIRE(version_1_0 < version_1_2_snapshot);
|
||||
REQUIRE(version_1_0 < version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_0 < version_1_2_beta);
|
||||
REQUIRE(version_1_0 < version_1_2_beta2);
|
||||
REQUIRE(version_1_0 < version_v2_0);
|
||||
REQUIRE(version_v1_0 < version_1_2);
|
||||
REQUIRE(version_v1_0 < version_1_2_it);
|
||||
REQUIRE(version_v1_0 < version_1_2_snapshot);
|
||||
REQUIRE(version_v1_0 < version_1_2_snapshot_it);
|
||||
REQUIRE(version_v1_0 < version_1_2_beta);
|
||||
REQUIRE(version_v1_0 < version_1_2_beta2);
|
||||
REQUIRE(version_v1_0 < version_v2_0);
|
||||
/*REQUIRE(version_1_2_snapshot < version_1_2);
|
||||
REQUIRE(version_1_2_snapshot < version_1_2_it);
|
||||
REQUIRE(version_1_2_snapshot < version_1_2_snapshot_it);*/
|
||||
REQUIRE(version_1_2_snapshot < version_v2_0);
|
||||
REQUIRE(version_1_2 < version_v2_0);
|
||||
REQUIRE(version_1_2_snapshot_it < version_v2_0);
|
||||
REQUIRE(version_1_2_it < version_v2_0);
|
||||
/*REQUIRE(version_1_2_beta < version_1_2);
|
||||
REQUIRE(version_1_2_beta < version_1_2_beta2);
|
||||
REQUIRE(version_1_2_beta < version_1_2_it);
|
||||
REQUIRE(version_1_2_beta < version_1_2_snapshot);
|
||||
REQUIRE(version_1_2_beta < version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_2_beta < version_v2_0);
|
||||
REQUIRE(version_1_2_beta2 < version_1_2);
|
||||
REQUIRE(version_1_2_beta2 < version_1_2_it);
|
||||
REQUIRE(version_1_2_beta2 < version_1_2_snapshot);
|
||||
REQUIRE(version_1_2_beta2 < version_1_2_snapshot_it);*/
|
||||
REQUIRE(version_1_2_beta2 < version_v2_0);
|
||||
//REQUIRE(version_2_0_snapshot < version_v2_0);
|
||||
REQUIRE_FALSE(version_1 < version_1);
|
||||
REQUIRE_FALSE(version_1 < version_1_0);
|
||||
REQUIRE_FALSE(version_1 < version_v1_0);
|
||||
REQUIRE_FALSE(version_1_0 < version_1);
|
||||
REQUIRE_FALSE(version_1_0 < version_1_0);
|
||||
REQUIRE_FALSE(version_1_0 < version_v1_0);
|
||||
REQUIRE_FALSE(version_v1_0 < version_1);
|
||||
REQUIRE_FALSE(version_v1_0 < version_1_0);
|
||||
REQUIRE_FALSE(version_v1_0 < version_v1_0);
|
||||
REQUIRE_FALSE(version_1_2 < version_1);
|
||||
REQUIRE_FALSE(version_1_2 < version_1_0);
|
||||
REQUIRE_FALSE(version_1_2 < version_v1_0);
|
||||
REQUIRE_FALSE(version_1_2 < version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2 < version_1_2);
|
||||
REQUIRE_FALSE(version_1_2 < version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2 < version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_2 < version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2 < version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1_2_it < version_1);
|
||||
REQUIRE_FALSE(version_1_2_it < version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_it < version_v1_0);
|
||||
REQUIRE_FALSE(version_1_2_it < version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_it < version_1_2);
|
||||
REQUIRE_FALSE(version_1_2_it < version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2_it < version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_2_it < version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2_it < version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1_2_snapshot < version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_snapshot < version_1);
|
||||
REQUIRE_FALSE(version_1_2_snapshot < version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot < version_v1_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot < version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2_snapshot < version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it < version_1_2);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it < version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it < version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it < version_1);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it < version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it < version_v1_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it < version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it < version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it < version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1_2_beta < version_1);
|
||||
REQUIRE_FALSE(version_1_2_beta < version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_beta < version_v1_0);
|
||||
REQUIRE_FALSE(version_1_2_beta < version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2_beta2 < version_1);
|
||||
REQUIRE_FALSE(version_1_2_beta2 < version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_beta2 < version_v1_0);
|
||||
REQUIRE_FALSE(version_1_2_beta2 < version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2_beta2 < version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_2_0_snapshot < version_1_2);
|
||||
REQUIRE_FALSE(version_v2_0 < version_1);
|
||||
REQUIRE_FALSE(version_v2_0 < version_1_0);
|
||||
REQUIRE_FALSE(version_v2_0 < version_v1_0);
|
||||
REQUIRE_FALSE(version_v2_0 < version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_v2_0 < version_1_2);
|
||||
REQUIRE_FALSE(version_v2_0 < version_1_2_it);
|
||||
REQUIRE_FALSE(version_v2_0 < version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_v2_0 < version_1_2_beta);
|
||||
REQUIRE_FALSE(version_v2_0 < version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_v2_0 < version_v2_0);
|
||||
}
|
||||
|
||||
TEST_CASE("testOlderOrEqualThan", "[Version]")
|
||||
{
|
||||
REQUIRE(version_1 <= version_1);
|
||||
REQUIRE(version_1 <= version_1_0);
|
||||
REQUIRE(version_1 <= version_v1_0);
|
||||
REQUIRE(version_1 <= version_1_2);
|
||||
REQUIRE(version_1 <= version_1_2_it);
|
||||
REQUIRE(version_1 <= version_1_2_snapshot);
|
||||
REQUIRE(version_1 <= version_1_2_snapshot_it);
|
||||
REQUIRE(version_1 <= version_1_2_beta);
|
||||
REQUIRE(version_1 <= version_1_2_beta2);
|
||||
REQUIRE(version_1 <= version_v2_0);
|
||||
REQUIRE(version_1_0 <= version_1);
|
||||
REQUIRE(version_1_0 <= version_1_0);
|
||||
REQUIRE(version_1_0 <= version_v1_0);
|
||||
REQUIRE(version_1_0 <= version_1_2);
|
||||
REQUIRE(version_1_0 <= version_1_2_it);
|
||||
REQUIRE(version_1_0 <= version_1_2_snapshot);
|
||||
REQUIRE(version_1_0 <= version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_0 <= version_1_2_beta);
|
||||
REQUIRE(version_1_0 <= version_1_2_beta2);
|
||||
REQUIRE(version_1_0 <= version_v2_0);
|
||||
REQUIRE(version_v1_0 <= version_1_2);
|
||||
REQUIRE(version_v1_0 <= version_1_2_it);
|
||||
REQUIRE(version_v1_0 <= version_1_2_snapshot);
|
||||
REQUIRE(version_v1_0 <= version_1_2_snapshot_it);
|
||||
REQUIRE(version_v1_0 <= version_1);
|
||||
REQUIRE(version_v1_0 <= version_1_0);
|
||||
REQUIRE(version_v1_0 <= version_v1_0);
|
||||
REQUIRE(version_v1_0 <= version_1_2_beta);
|
||||
REQUIRE(version_v1_0 <= version_1_2_beta2);
|
||||
REQUIRE(version_v1_0 <= version_v2_0);
|
||||
REQUIRE(version_1_2_snapshot <= version_1_2_snapshot);
|
||||
REQUIRE(version_1_2_snapshot <= version_1_2);
|
||||
REQUIRE(version_1_2_snapshot <= version_1_2_it);
|
||||
REQUIRE(version_1_2_snapshot <= version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_2_snapshot <= version_v2_0);
|
||||
REQUIRE(version_1_2 <= version_1_2);
|
||||
REQUIRE(version_1_2 <= version_1_2_it);
|
||||
REQUIRE(version_1_2 <= version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_2 <= version_v2_0);
|
||||
REQUIRE(version_1_2_it <= version_1_2);
|
||||
REQUIRE(version_1_2_it <= version_1_2_it);
|
||||
REQUIRE(version_1_2_it <= version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_2_it <= version_v2_0);
|
||||
REQUIRE(version_1_2_snapshot_it <= version_1_2);
|
||||
REQUIRE(version_1_2_snapshot_it <= version_1_2_it);
|
||||
REQUIRE(version_1_2_snapshot_it <= version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_2_snapshot_it <= version_v2_0);
|
||||
REQUIRE(version_1_2_beta <= version_1_2_snapshot);
|
||||
REQUIRE(version_1_2_beta <= version_1_2);
|
||||
REQUIRE(version_1_2_beta <= version_1_2_it);
|
||||
REQUIRE(version_1_2_beta <= version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_2_beta <= version_1_2_beta);
|
||||
REQUIRE(version_1_2_beta <= version_1_2_beta2);
|
||||
REQUIRE(version_1_2_beta <= version_v2_0);
|
||||
REQUIRE(version_1_2_beta2 <= version_1_2_snapshot);
|
||||
REQUIRE(version_1_2_beta2 <= version_1_2);
|
||||
REQUIRE(version_1_2_beta2 <= version_1_2_it);
|
||||
REQUIRE(version_1_2_beta2 <= version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_2_beta2 <= version_1_2_beta2);
|
||||
REQUIRE(version_1_2_beta2 <= version_v2_0);
|
||||
REQUIRE(version_2_0_snapshot <= version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2 <= version_1);
|
||||
REQUIRE_FALSE(version_1_2 <= version_1_0);
|
||||
REQUIRE_FALSE(version_1_2 <= version_v1_0);
|
||||
/*REQUIRE_FALSE(version_1_2 <= version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2 <= version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2 <= version_1_2_beta2);*/
|
||||
REQUIRE_FALSE(version_1_2_it <= version_1);
|
||||
REQUIRE_FALSE(version_1_2_it <= version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_it <= version_v1_0);
|
||||
/*REQUIRE_FALSE(version_1_2_it <= version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_it <= version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2_it <= version_1_2_beta2);*/
|
||||
REQUIRE_FALSE(version_1_2_snapshot <= version_1);
|
||||
REQUIRE_FALSE(version_1_2_snapshot <= version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot <= version_v1_0);
|
||||
/*REQUIRE_FALSE(version_1_2_snapshot <= version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2_snapshot <= version_1_2_beta2);*/
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it <= version_1);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it <= version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it <= version_v1_0);
|
||||
/*REQUIRE_FALSE(version_1_2_snapshot_it <= version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it <= version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it <= version_1_2_beta2);*/
|
||||
REQUIRE_FALSE(version_1_2_beta <= version_1);
|
||||
REQUIRE_FALSE(version_1_2_beta <= version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_beta <= version_v1_0);
|
||||
REQUIRE_FALSE(version_1_2_beta2 <= version_1);
|
||||
REQUIRE_FALSE(version_1_2_beta2 <= version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_beta2 <= version_v1_0);
|
||||
//REQUIRE_FALSE(version_1_2_beta2 <= version_1_2_beta);
|
||||
REQUIRE_FALSE(version_2_0_snapshot <= version_1_2);
|
||||
}
|
||||
|
||||
TEST_CASE("testEquals", "[Version]")
|
||||
{
|
||||
REQUIRE(version_1 == version_1_0);
|
||||
REQUIRE(version_1 == version_v1_0);
|
||||
REQUIRE(version_1_0 == version_1);
|
||||
REQUIRE(version_1_0 == version_v1_0);
|
||||
REQUIRE(version_v1_0 == version_1);
|
||||
REQUIRE(version_v1_0 == version_1_0);
|
||||
REQUIRE(version_1_2 == version_1_2_it);
|
||||
REQUIRE(version_1_2 == version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_2_it == version_1_2);
|
||||
REQUIRE(version_1_2_it == version_1_2_snapshot_it);
|
||||
REQUIRE(version_1_2_snapshot_it == version_1_2);
|
||||
REQUIRE(version_1_2_snapshot_it == version_1_2_it);
|
||||
REQUIRE_FALSE(version_1 == version_1_2);
|
||||
REQUIRE_FALSE(version_1 == version_1_2_it);
|
||||
REQUIRE_FALSE(version_1 == version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1 == version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1 == version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1 == version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1 == version_v2_0);
|
||||
REQUIRE_FALSE(version_1_0 == version_1_2);
|
||||
REQUIRE_FALSE(version_1_0 == version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_0 == version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_0 == version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_0 == version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_0 == version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_1_0 == version_v2_0);
|
||||
REQUIRE_FALSE(version_v1_0 == version_1_2);
|
||||
REQUIRE_FALSE(version_v1_0 == version_1_2_it);
|
||||
REQUIRE_FALSE(version_v1_0 == version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_v1_0 == version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_v1_0 == version_1_2_beta);
|
||||
REQUIRE_FALSE(version_v1_0 == version_1_2_beta2);
|
||||
REQUIRE_FALSE(version_v1_0 == version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2 == version_1);
|
||||
REQUIRE_FALSE(version_1_2 == version_1_0);
|
||||
REQUIRE_FALSE(version_1_2 == version_v1_0);
|
||||
/*REQUIRE_FALSE(version_1_2 == version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2 == version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2 == version_1_2_beta2);*/
|
||||
REQUIRE_FALSE(version_1_2 == version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_it == version_1);
|
||||
REQUIRE_FALSE(version_1_2_it == version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_it == version_v1_0);
|
||||
/*REQUIRE_FALSE(version_1_2_it == version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_it == version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2_it == version_1_2_beta2);*/
|
||||
REQUIRE_FALSE(version_1_2_it == version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot == version_1);
|
||||
REQUIRE_FALSE(version_1_2_snapshot == version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot == version_v1_0);
|
||||
/*REQUIRE_FALSE(version_1_2_snapshot == version_1_2);
|
||||
REQUIRE_FALSE(version_1_2_snapshot == version_1_2_it);
|
||||
REQUIRE_FALSE(version_1_2_snapshot == version_1_2_snapshot_it);
|
||||
REQUIRE_FALSE(version_1_2_snapshot == version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2_snapshot == version_1_2_beta2);*/
|
||||
REQUIRE_FALSE(version_1_2_snapshot == version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it == version_1);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it == version_1_0);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it == version_v1_0);
|
||||
/*REQUIRE_FALSE(version_1_2_snapshot_it == version_1_2_snapshot);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it == version_1_2_beta);
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it == version_1_2_beta2);*/
|
||||
REQUIRE_FALSE(version_1_2_snapshot_it == version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_beta == version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_beta2 == version_v2_0);
|
||||
REQUIRE_FALSE(version_1_2_beta2 == version_2_0_snapshot);
|
||||
//REQUIRE_FALSE(version_v2_0 == version_2_0_snapshot);
|
||||
REQUIRE(version_1 == Version(VERSION_1));
|
||||
REQUIRE(version_1_0 == Version(VERSION_1_0));
|
||||
REQUIRE(version_1 == Version(VERSION_1_0));
|
||||
REQUIRE(version_v1_0 == Version(VERSION_V1_0));
|
||||
REQUIRE(version_1_2 == Version(VERSION_1_2));
|
||||
REQUIRE(version_1_2_snapshot == Version(VERSION_1_2_SNAPSHOT));
|
||||
REQUIRE(version_1_2_beta == Version(VERSION_1_2_BETA));
|
||||
REQUIRE(version_1_2_beta2 == Version(VERSION_1_2_BETA2));
|
||||
REQUIRE(version_v2_0 == Version(VERSION_V2_0));
|
||||
REQUIRE(version_1_2_it == Version(VERSION_1_2));
|
||||
//REQUIRE_FALSE(version_1_2_snapshot_it == Version(VERSION_1_2_SNAPSHOT));
|
||||
REQUIRE(version_1 == Version(VERSION_1, true));
|
||||
REQUIRE(version_1_0 == Version(VERSION_1_0, true));
|
||||
REQUIRE(version_v1_0 == Version(VERSION_V1_0, true));
|
||||
REQUIRE(version_1_2 == Version(VERSION_1_2, true));
|
||||
//REQUIRE_FALSE(version_1_2_snapshot == Version(VERSION_1_2_SNAPSHOT, true));
|
||||
REQUIRE(version_1_2_it == Version(VERSION_1_2, true));
|
||||
REQUIRE(version_1_2_snapshot_it == Version(VERSION_1_2_SNAPSHOT, true));
|
||||
}
|
||||
|
||||
TEST_CASE("testToString", "[Version]")
|
||||
{
|
||||
REQUIRE(VERSION_1 == static_cast<const std::string&>(version_1));
|
||||
REQUIRE(VERSION_1_0 == static_cast<const std::string&>(version_1_0));
|
||||
REQUIRE(VERSION_V1_0 == static_cast<const std::string&>(version_v1_0));
|
||||
REQUIRE(VERSION_1_2 == static_cast<const std::string&>(version_1_2));
|
||||
REQUIRE(VERSION_1_2 == static_cast<const std::string&>(version_1_2_it));
|
||||
REQUIRE(VERSION_1_2_SNAPSHOT == static_cast<const std::string&>(version_1_2_snapshot));
|
||||
REQUIRE(VERSION_1_2_SNAPSHOT == static_cast<const std::string&>(version_1_2_snapshot_it));
|
||||
REQUIRE(VERSION_1_2_BETA == static_cast<const std::string&>(version_1_2_beta));
|
||||
REQUIRE(VERSION_1_2_BETA2 == static_cast<const std::string&>(version_1_2_beta2));
|
||||
REQUIRE("v2.0" == static_cast<const std::string&>(version_v2_0));
|
||||
REQUIRE(VERSION_2_0_SNAPSHOT == static_cast<const std::string&>(version_2_0_snapshot));
|
||||
REQUIRE_FALSE(VERSION_1_0 == static_cast<const std::string&>(version_v1_0));
|
||||
REQUIRE_FALSE(VERSION_1_0 == static_cast<const std::string&>(version_1));
|
||||
REQUIRE_FALSE(VERSION_1_0 == static_cast<const std::string&>(version_1_2));
|
||||
REQUIRE_FALSE("2.0" == static_cast<const std::string&>(version_v2_0));
|
||||
}
|
||||
|
||||
TEST_CASE("testUnimportantVersionParts", "[Version]")
|
||||
{
|
||||
REQUIRE(Version("1.0.0.3") == Version("1.0.0.3.0"));
|
||||
REQUIRE(Version("1.0.0.3") == Version("1.0.0.3.0.0"));
|
||||
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"));
|
||||
}
|
||||
Reference in New Issue
Block a user