reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 3bbe8afab3f132850052f6e09df08803a8cd693e
parent dd74b8859ec58d6ce5d38896635b1aa85fb7a368
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Sun, 31 Jan 2016 17:10:02 -0500

add a test case for (unsupported) decimal version schemes

Diffstat:
Msrc/version.cpp | 10++++++++++
Msrc/version.hpp | 2++
Mtest/helper/io.cpp | 7+++++++
Mtest/helper/io.hpp | 2++
Mtest/version.cpp | 6++++++
5 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/version.cpp b/src/version.cpp @@ -123,3 +123,13 @@ bool Version::operator<(const Version &o) const { return m_code < o.code(); } + +bool Version::operator==(const Version &o) const +{ + return m_code == o.code(); +} + +bool Version::operator!=(const Version &o) const +{ + return !(*this == o); +} diff --git a/src/version.hpp b/src/version.hpp @@ -48,6 +48,8 @@ public: const std::set<Path> &files() const { return m_files; } bool operator<(const Version &) const; + bool operator==(const Version &) const; + bool operator!=(const Version &) const; private: std::string m_name; diff --git a/test/helper/io.cpp b/test/helper/io.cpp @@ -1,6 +1,7 @@ #include "io.hpp" #include <path.hpp> +#include <version.hpp> using namespace std; @@ -21,3 +22,9 @@ ostream &operator<<(ostream &os, const set<Path> &list) return os; } + +ostream &operator<<(ostream &os, const Version &ver) +{ + os << ver.name(); + return os; +} diff --git a/test/helper/io.hpp b/test/helper/io.hpp @@ -5,8 +5,10 @@ #include <set> class Path; +class Version; std::ostream &operator<<(std::ostream &, const Path &); std::ostream &operator<<(std::ostream &, const std::set<Path> &); +std::ostream &operator<<(std::ostream &, const Version &); #endif diff --git a/test/version.cpp b/test/version.cpp @@ -59,6 +59,12 @@ TEST_CASE("version with 4 components", M) { REQUIRE(ver < Version("1.2.4")); } +TEST_CASE("decimal version", M) { + Version ver("5.05"); + REQUIRE(ver == Version("5.5")); + REQUIRE(ver < Version("5.50")); +} + TEST_CASE("4 digits version component", M) { Version ver("0.2015.12.25"); REQUIRE(ver.name() == "0.2015.12.25");