/*
* 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"));
}