aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-19 00:21:58 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-19 00:21:58 +0000
commit31928b9011ec0585334e747a3a78981b53935666 (patch)
tree03087a980b3df9898521638dfa0d7b043546a8ee
parent5aafada448e858a6a4f821ea11f0151f118af606 (diff)
downloadpaludis-31928b9011ec0585334e747a3a78981b53935666.tar.gz
paludis-31928b9011ec0585334e747a3a78981b53935666.tar.xz
Add support for -scm versions. Rework version spec internals to be substantially cleaner. Make the tests a lot more extensive.
-rw-r--r--paludis/version_spec.cc266
-rw-r--r--paludis/version_spec.hh6
-rw-r--r--paludis/version_spec_TEST.cc179
3 files changed, 269 insertions, 182 deletions
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index c405bd1..5f2e0ba 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -19,7 +19,10 @@
#include <algorithm>
#include <paludis/util/exception.hh>
+#include <paludis/util/smart_record.hh>
#include <paludis/version_spec.hh>
+#include <vector>
+#include <limits>
using namespace paludis;
@@ -28,14 +31,39 @@ BadVersionSpecError::BadVersionSpecError(const std::string & name) throw () :
{
}
-enum SuffixPart
+namespace
{
- alpha,
- beta,
- pre,
- rc,
- none
-};
+ enum PartKind
+ {
+ alpha,
+ beta,
+ pre,
+ rc,
+ empty,
+ revision,
+ patch,
+ letter,
+ number,
+ scm
+ };
+
+ enum PartKeys
+ {
+ part_kind,
+ part_value,
+ last_part
+ };
+
+ struct PartTag :
+ SmartRecordTag<comparison_mode::FullComparisonTag, comparison_method::SmartRecordCompareByAllTag>,
+ SmartRecordKeys<PartKeys, last_part>,
+ SmartRecordKey<part_kind, PartKind>,
+ SmartRecordKey<part_value, unsigned long>
+ {
+ };
+
+ typedef MakeSmartRecord<PartTag>::Type Part;
+}
namespace paludis
{
@@ -49,26 +77,8 @@ namespace paludis
/// Our raw string representation.
std::string text;
- /// The x.y.z parts of our version (zero filled).
- long version_parts[VersionSpec::max_version_parts_count];
-
- /// The letter (1.2.3a -> a) part of our version.
- char letter_part;
-
- /// The suffix level (alpha, beta, pre, rc, none) part of our version.
- SuffixPart suffix_part;
-
- /// The suffix level of our version.
- unsigned long suffix_level_part;
-
- /// The patch level of our revision.
- long patch_level_part;
-
- /// The revision (-r1 -> 1) part of our version.
- unsigned long revision_part;
-
- /// If we are used in an =* comparison, the number of digits to consider
- unsigned long max_star_count;
+ /// Our parts.
+ std::vector<Part> parts;
};
}
@@ -80,26 +90,25 @@ VersionSpec::VersionSpec(const std::string & text) :
/* set us up with some sane defaults */
_imp->text = text;
- std::fill_n(&_imp->version_parts[0],
- VersionSpec::max_version_parts_count, 0);
- _imp->letter_part = '\0';
- _imp->revision_part = 0;
- _imp->suffix_part = none;
- _imp->suffix_level_part = 0;
- _imp->patch_level_part = -1;
/* parse */
- unsigned version_part_idx(0);
std::string::size_type p(0);
+ if (text == "scm")
+ {
+ _imp->parts.push_back(Part(scm, 0));
+ return;
+ }
+
/* numbers... */
+ unsigned long x(0);
while (p < text.length())
{
if (text.at(p) < '0' || text.at(p) > '9')
throw BadVersionSpecError(text);
- _imp->version_parts[version_part_idx] *= 10;
- _imp->version_parts[version_part_idx] += text.at(p) - '0';
+ x *= 10;
+ x += text.at(p) - '0';
if (++p >= text.length())
break;
@@ -107,68 +116,98 @@ VersionSpec::VersionSpec(const std::string & text) :
if ('.' == text.at(p))
{
++p;
- if (++version_part_idx >= VersionSpec::max_version_parts_count)
- throw BadVersionSpecError(text);
+ _imp->parts.push_back(Part(number, x));
+ x = 0;
}
if (text.at(p) < '0' || text.at(p) > '9')
break;
}
- _imp->max_star_count = version_part_idx + 1;
+ _imp->parts.push_back(Part(number, x));
+
+ while (! _imp->parts.empty())
+ {
+ if (0 == _imp->parts[_imp->parts.size() - 1].get<part_value>())
+ _imp->parts.pop_back();
+ else
+ break;
+ }
/* letter */
if (p < text.length())
if (text.at(p) >= 'a' && text.at(p) <= 'z')
- _imp->letter_part = text.at(p++);
+ _imp->parts.push_back(Part(letter, text.at(p++)));
/* suffix */
if (p < text.length())
do
{
+ PartKind k(empty);
if (0 == text.compare(p, 6, "_alpha"))
{
- _imp->suffix_part = alpha;
+ k = alpha;
p += 6;
}
else if (0 == text.compare(p, 5, "_beta"))
{
- _imp->suffix_part = beta;
+ k = beta;
p += 5;
}
else if (0 == text.compare(p, 4, "_pre"))
{
- _imp->suffix_part = pre;
+ k = pre;
p += 4;
}
else if (0 == text.compare(p, 3, "_rc"))
{
- _imp->suffix_part = rc;
+ k = rc;
p += 3;
}
else
break;
+ x = std::numeric_limits<unsigned long>::max();
for ( ; p < text.length() ; ++p)
{
if (text.at(p) < '0' || text.at(p) > '9')
break;
- _imp->suffix_level_part *= 10;
- _imp->suffix_level_part += text.at(p) - '0';
+ if (x == std::numeric_limits<unsigned long>::max())
+ x = 0;
+ x *= 10;
+ x += text.at(p) - '0';
}
+
+ _imp->parts.push_back(Part(k, x));
} while (false);
/* patch level */
if (p < text.length() && 0 == text.compare(p, 2, "_p"))
{
- _imp->patch_level_part = 0;
-
+ x = std::numeric_limits<unsigned long>::max();
for (p += 2 ; p < text.length() ; ++p)
{
if (text.at(p) < '0' || text.at(p) > '9')
break;
- _imp->patch_level_part *= 10;
- _imp->patch_level_part += text.at(p) - '0';
+ if (x == std::numeric_limits<unsigned long>::max())
+ x = 0;
+ x *= 10;
+ x += text.at(p) - '0';
}
+ _imp->parts.push_back(Part(patch, x));
+ }
+
+ /* scm */
+ if ((p < text.length()) && (0 == text.compare(p, 4, "-scm")))
+ {
+ p += 4;
+ _imp->parts.push_back(Part(scm, 0));
+ }
+ else
+ {
+ for (std::vector<Part>::iterator i(_imp->parts.begin()),
+ i_end(_imp->parts.end()) ; i != i_end ; ++i)
+ if (std::numeric_limits<unsigned long>::max() == i->get<part_value>())
+ i->set<part_value>(0);
}
/* revision */
@@ -176,14 +215,16 @@ VersionSpec::VersionSpec(const std::string & text) :
if (0 == text.compare(p, 2, "-r"))
{
p += 2;
+ x = 0;
while (p < text.length())
{
if (text.at(p) < '0' || text.at(p) > '9')
break;
- _imp->revision_part *= 10;
- _imp->revision_part += text.at(p) - '0';
+ x *= 10;
+ x += text.at(p) - '0';
++p;
}
+ _imp->parts.push_back(Part(revision, x));
}
@@ -197,16 +238,7 @@ VersionSpec::VersionSpec(const VersionSpec & other) :
ComparisonPolicyType(other)
{
_imp->text = other._imp->text;
- /* don't change this to std::copy_n, it's non-portable. */
- std::copy(&other._imp->version_parts[0],
- &other._imp->version_parts[max_version_parts_count] + 1,
- &_imp->version_parts[0]);
- _imp->letter_part = other._imp->letter_part;
- _imp->revision_part = other._imp->revision_part;
- _imp->suffix_part = other._imp->suffix_part;
- _imp->suffix_level_part = other._imp->suffix_level_part;
- _imp->patch_level_part = other._imp->patch_level_part;
- _imp->max_star_count = other._imp->max_star_count;
+ _imp->parts = other._imp->parts;
}
const VersionSpec &
@@ -215,16 +247,7 @@ VersionSpec::operator= (const VersionSpec & other)
if (this != &other)
{
_imp->text = other._imp->text;
- /* don't change this to std::copy_n, it's non-portable. */
- std::copy(&other._imp->version_parts[0],
- &other._imp->version_parts[max_version_parts_count] + 1,
- &_imp->version_parts[0]);
- _imp->letter_part = other._imp->letter_part;
- _imp->revision_part = other._imp->revision_part;
- _imp->suffix_part = other._imp->suffix_part;
- _imp->suffix_level_part = other._imp->suffix_level_part;
- _imp->patch_level_part = other._imp->patch_level_part;
- _imp->max_star_count = other._imp->max_star_count;
+ _imp->parts = other._imp->parts;
}
return *this;
}
@@ -236,60 +259,51 @@ VersionSpec::~VersionSpec()
int
VersionSpec::compare(const VersionSpec & other) const
{
- for (unsigned i(0) ; i < VersionSpec::max_version_parts_count ; ++i)
+ std::vector<Part>::const_iterator
+ v1(_imp->parts.begin()), v1_end(_imp->parts.end()),
+ v2(other._imp->parts.begin()), v2_end(other._imp->parts.end());
+
+ Part end_part(empty, 0);
+ while (true)
{
- if (_imp->version_parts[i] < other._imp->version_parts[i])
+ const Part * const p1(v1 == v1_end ? &end_part : &*v1++);
+ const Part * const p2(v2 == v2_end ? &end_part : &*v2++);
+ if (&end_part == p1 && &end_part == p2)
+ break;
+
+ if (*p1 < *p2)
return -1;
- else if (_imp->version_parts[i] > other._imp->version_parts[i])
+ if (*p1 > *p2)
return 1;
}
- if (_imp->letter_part < other._imp->letter_part)
- return -1;
- if (_imp->letter_part > other._imp->letter_part)
- return 1;
-
- if (_imp->suffix_part < other._imp->suffix_part)
- return -1;
- if (_imp->suffix_part > other._imp->suffix_part)
- return 1;
-
- if (_imp->suffix_level_part < other._imp->suffix_level_part)
- return -1;
- if (_imp->suffix_level_part > other._imp->suffix_level_part)
- return 1;
-
- if (_imp->patch_level_part < other._imp->patch_level_part)
- return -1;
- if (_imp->patch_level_part > other._imp->patch_level_part)
- return 1;
-
- if (_imp->revision_part < other._imp->revision_part)
- return -1;
- if (_imp->revision_part > other._imp->revision_part)
- return 1;
-
return 0;
}
bool
VersionSpec::tilde_compare(const VersionSpec & other) const
{
- for (unsigned i(0) ; i < VersionSpec::max_version_parts_count ; ++i)
- if (_imp->version_parts[i] != other._imp->version_parts[i])
- return false;
+ std::vector<Part>::const_iterator
+ v1(_imp->parts.begin()), v1_end(_imp->parts.end()),
+ v2(other._imp->parts.begin()), v2_end(other._imp->parts.end());
- if (_imp->letter_part != other._imp->letter_part)
- return false;
+ Part end_part(empty, 0);
+ while (true)
+ {
+ const Part * p1(v1 == v1_end ? &end_part : &*v1++);
+ while (p1 != &end_part && p1->get<part_kind>() == revision)
+ p1 = (v1 == v1_end ? &end_part : &*v1++);
- if (_imp->suffix_part != other._imp->suffix_part)
- return false;
+ const Part * p2(v2 == v2_end ? &end_part : &*v2++);
+ while (p2 != &end_part && p2->get<part_kind>() == revision)
+ p2 = (v2 == v2_end ? &end_part : &*v2++);
- if (_imp->suffix_level_part != other._imp->suffix_level_part)
- return false;
+ if (&end_part == p1 && &end_part == p2)
+ break;
- if (_imp->patch_level_part != other._imp->patch_level_part)
- return false;
+ if (*p1 != *p2)
+ return false;
+ }
return true;
}
@@ -304,14 +318,30 @@ std::size_t
VersionSpec::hash_value() const
{
/// \todo Improve this;
- return _imp->version_parts[0];
+ return _imp->parts[0].get<part_value>();
+}
+
+namespace
+{
+ struct IsRevisionPart
+ {
+ bool operator() (const Part & p) const
+ {
+ return p.get<part_kind>() == revision;
+ }
+ };
}
VersionSpec
VersionSpec::remove_revision() const
{
VersionSpec result(*this);
- result._imp->revision_part = 0;
+
+ // see EffSTL item 9
+ result._imp->parts.erase(std::remove_if(
+ result._imp->parts.begin(),
+ result._imp->parts.end(),
+ IsRevisionPart()));
std::string::size_type p;
if (std::string::npos != ((p = result._imp->text.rfind("-r"))))
@@ -324,7 +354,12 @@ VersionSpec::remove_revision() const
std::string
VersionSpec::revision_only() const
{
- return "r" + stringify(_imp->revision_part);
+ std::vector<Part>::const_iterator r(std::find_if(_imp->parts.begin(),
+ _imp->parts.end(), IsRevisionPart()));
+ if (r != _imp->parts.end())
+ return "r" + stringify(r->get<part_value>());
+ else
+ return "r0";
}
std::ostream &
@@ -333,3 +368,4 @@ paludis::operator<< (std::ostream & s, const VersionSpec & v)
s << v._imp->text;
return s;
}
+
diff --git a/paludis/version_spec.hh b/paludis/version_spec.hh
index 54282ad..913fd1d 100644
--- a/paludis/version_spec.hh
+++ b/paludis/version_spec.hh
@@ -61,12 +61,6 @@ namespace paludis
public:
/**
- * Maximum number of a.b.c.d parts allowed in a version number. We
- * use this to avoid having to dynamically allocate memory.
- */
- static const unsigned max_version_parts_count = 10;
-
- /**
* Constructor.
*/
VersionSpec(const std::string & text);
diff --git a/paludis/version_spec_TEST.cc b/paludis/version_spec_TEST.cc
index 37044c4..c1c8a3a 100644
--- a/paludis/version_spec_TEST.cc
+++ b/paludis/version_spec_TEST.cc
@@ -20,6 +20,8 @@
#include <paludis/version_spec.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
+#include <vector>
+#include <iterator>
using namespace test;
using namespace paludis;
@@ -115,67 +117,6 @@ namespace test_cases
} test_version_spec_parse;
/**
- * \test VersionSpec comparisons
- *
- * \ingroup Test
- */
- struct VersionSpecCompareTest : TestCase
- {
- VersionSpecCompareTest() : TestCase("version spec compare") {}
-
- void run()
- {
- TEST_CHECK(VersionSpec("1") < VersionSpec("2"));
- TEST_CHECK(VersionSpec("3.10g") < VersionSpec("3.10.18"));
- TEST_CHECK(VersionSpec("4.0.2_pre20051120") < VersionSpec("4.0.2_pre20051223"));
- TEST_CHECK(VersionSpec("1_alpha") < VersionSpec("1_beta"));
- TEST_CHECK(VersionSpec("1_beta") < VersionSpec("1_pre"));
- TEST_CHECK(VersionSpec("1_rc") < VersionSpec("1"));
- TEST_CHECK(VersionSpec("1") < VersionSpec("1_p0"));
- TEST_CHECK(VersionSpec("1_alpha2") < VersionSpec("1_beta1"));
- TEST_CHECK(VersionSpec("1_beta2") < VersionSpec("1_pre1"));
- TEST_CHECK(VersionSpec("1_rc3") < VersionSpec("1"));
- TEST_CHECK(VersionSpec("1") < VersionSpec("1_p2"));
-
- TEST_CHECK(! (VersionSpec("1") > VersionSpec("2")));
- TEST_CHECK(! (VersionSpec("3.10g") > VersionSpec("3.10.18")));
- TEST_CHECK(! (VersionSpec("4.0.2_pre20051120") > VersionSpec("4.0.2_pre20051223")));
- TEST_CHECK(! (VersionSpec("1_alpha") > VersionSpec("1_beta")));
- TEST_CHECK(! (VersionSpec("1_beta") > VersionSpec("1_pre")));
- TEST_CHECK(! (VersionSpec("1_rc") > VersionSpec("1")));
- TEST_CHECK(! (VersionSpec("1") > VersionSpec("1_p0")));
- TEST_CHECK(! (VersionSpec("1_alpha2") > VersionSpec("1_beta1")));
- TEST_CHECK(! (VersionSpec("1_beta2") > VersionSpec("1_pre1")));
- TEST_CHECK(! (VersionSpec("1_rc3") > VersionSpec("1")));
- TEST_CHECK(! (VersionSpec("1") > VersionSpec("1_p2")));
-
- TEST_CHECK(VersionSpec("2") > VersionSpec("1"));
- TEST_CHECK(VersionSpec("3.10.18") > VersionSpec("3.10g"));
- TEST_CHECK(VersionSpec("4.0.2_pre20051223") > VersionSpec("4.0.2_pre20051120"));
- TEST_CHECK(VersionSpec("1_beta") > VersionSpec("1_alpha"));
- TEST_CHECK(VersionSpec("1_pre") > VersionSpec("1_beta"));
- TEST_CHECK(VersionSpec("1") > VersionSpec("1_rc"));
- TEST_CHECK(VersionSpec("1_p0") > VersionSpec("1"));
- TEST_CHECK(VersionSpec("1_beta1") > VersionSpec("1_alpha2"));
- TEST_CHECK(VersionSpec("1_pre1") > VersionSpec("1_beta2"));
- TEST_CHECK(VersionSpec("1") > VersionSpec("1_rc3"));
- TEST_CHECK(VersionSpec("1_p2") > VersionSpec("1"));
-
- TEST_CHECK(! (VersionSpec("2") < VersionSpec("1")));
- TEST_CHECK(! (VersionSpec("3.10.18") < VersionSpec("3.10g")));
- TEST_CHECK(! (VersionSpec("4.0.2_pre20051223") < VersionSpec("4.0.2_pre20051120")));
- TEST_CHECK(! (VersionSpec("1_beta") < VersionSpec("1_alpha")));
- TEST_CHECK(! (VersionSpec("1_pre") < VersionSpec("1_beta")));
- TEST_CHECK(! (VersionSpec("1") < VersionSpec("1_rc")));
- TEST_CHECK(! (VersionSpec("1_p0") < VersionSpec("1")));
- TEST_CHECK(! (VersionSpec("1_beta1") < VersionSpec("1_alpha2")));
- TEST_CHECK(! (VersionSpec("1_pre1") < VersionSpec("1_beta2")));
- TEST_CHECK(! (VersionSpec("1") < VersionSpec("1_rc3")));
- TEST_CHECK(! (VersionSpec("1_p2") < VersionSpec("1")));
- }
- } test_version_spec_compare;
-
- /**
* \test VersionSpec star comparisons
*
* \ingroup Test
@@ -234,5 +175,121 @@ namespace test_cases
TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r99").revision_only(), "r99");
}
} test_version_revision_only;
+
+ /**
+ * \test VersionSpec ordering.
+ *
+ * \ingroup Test
+ */
+ struct VersionSpecCompareSCMTest : TestCase
+ {
+ VersionSpecCompareSCMTest() : TestCase("version spec compare") {}
+
+ virtual unsigned max_run_time() const
+ {
+ return 300;
+ }
+
+ void run()
+ {
+ TEST_CHECK(VersionSpec("1.0") == VersionSpec("1"));
+ TEST_CHECK(VersionSpec("1") == VersionSpec("1.0"));
+ TEST_CHECK(! (VersionSpec("1") < VersionSpec("1.0")));
+ TEST_CHECK(! (VersionSpec("1") > VersionSpec("1.0")));
+ TEST_CHECK(! (VersionSpec("1.0") < VersionSpec("1")));
+ TEST_CHECK(! (VersionSpec("1.0") > VersionSpec("1")));
+ TEST_CHECK(VersionSpec("1.0_alpha") == VersionSpec("1_alpha"));
+ TEST_CHECK(VersionSpec("1_alpha") == VersionSpec("1.0_alpha"));
+ TEST_CHECK(! (VersionSpec("1_alpha") < VersionSpec("1.0_alpha")));
+ TEST_CHECK(! (VersionSpec("1_alpha") > VersionSpec("1.0_alpha")));
+ TEST_CHECK(! (VersionSpec("1.0_alpha") < VersionSpec("1_alpha")));
+ TEST_CHECK(! (VersionSpec("1.0_alpha") > VersionSpec("1_alpha")));
+
+ std::vector<VersionSpec> v;
+ v.push_back(VersionSpec("1_alpha"));
+ v.push_back(VersionSpec("1_alpha10"));
+ v.push_back(VersionSpec("1_alpha10-r1"));
+ v.push_back(VersionSpec("1_alpha10_p1"));
+ v.push_back(VersionSpec("1_alpha10_p1-r1"));
+ v.push_back(VersionSpec("1_alpha11"));
+ v.push_back(VersionSpec("1_beta"));
+ v.push_back(VersionSpec("1_beta10"));
+ v.push_back(VersionSpec("1_beta10-r1"));
+ v.push_back(VersionSpec("1_beta10_p1"));
+ v.push_back(VersionSpec("1_beta10_p1-r1"));
+ v.push_back(VersionSpec("1_beta11"));
+ v.push_back(VersionSpec("1_pre"));
+ v.push_back(VersionSpec("1_pre10"));
+ v.push_back(VersionSpec("1_pre10-r1"));
+ v.push_back(VersionSpec("1_pre10_p1"));
+ v.push_back(VersionSpec("1_pre10_p1-r1"));
+ v.push_back(VersionSpec("1_pre11"));
+ v.push_back(VersionSpec("1_rc"));
+ v.push_back(VersionSpec("1_rc10"));
+ v.push_back(VersionSpec("1_rc10-r1"));
+ v.push_back(VersionSpec("1_rc10_p1"));
+ v.push_back(VersionSpec("1_rc10_p1-r1"));
+ v.push_back(VersionSpec("1_rc11"));
+ v.push_back(VersionSpec("1"));
+ v.push_back(VersionSpec("1-r1"));
+ v.push_back(VersionSpec("1_p1"));
+ v.push_back(VersionSpec("1p"));
+ v.push_back(VersionSpec("1.1_alpha3"));
+ v.push_back(VersionSpec("1.1"));
+ v.push_back(VersionSpec("1.1-r1"));
+ v.push_back(VersionSpec("1.1.1"));
+ v.push_back(VersionSpec("1.1.1-scm"));
+ v.push_back(VersionSpec("1.1.2"));
+ v.push_back(VersionSpec("1.1-scm"));
+ v.push_back(VersionSpec("1.1-scm-r1"));
+ v.push_back(VersionSpec("1.2_alpha"));
+ v.push_back(VersionSpec("1.2_alpha-scm"));
+ v.push_back(VersionSpec("1.2_beta"));
+ v.push_back(VersionSpec("1.2_beta10"));
+ v.push_back(VersionSpec("1.2_beta10_p1"));
+ v.push_back(VersionSpec("1.2_beta10_p1-scm"));
+ v.push_back(VersionSpec("1.2_beta10-scm"));
+ v.push_back(VersionSpec("1.2_beta11"));
+ v.push_back(VersionSpec("1.2_beta11-scm"));
+ v.push_back(VersionSpec("1.2_beta-scm"));
+ v.push_back(VersionSpec("1.2"));
+ v.push_back(VersionSpec("1.2-r1"));
+ v.push_back(VersionSpec("1.2-scm"));
+ v.push_back(VersionSpec("1.2-scm-r1"));
+ v.push_back(VersionSpec("1-scm"));
+ v.push_back(VersionSpec("2_alpha"));
+ v.push_back(VersionSpec("scm"));
+
+ std::vector<VersionSpec>::iterator v1(v.begin()), v_end(v.end());
+ for ( ; v1 != v_end ; ++v1)
+ {
+ TestMessageSuffix s1("v1:" + stringify(*v1), false);
+ std::vector<VersionSpec>::iterator v2(v.begin());
+ for ( ; v2 != v_end ; ++v2)
+ {
+ TestMessageSuffix s2("v2:" + stringify(*v2), false);
+ if (std::distance(v.begin(), v1) < std::distance(v.begin(), v2))
+ {
+ TEST_CHECK(*v1 < *v2);
+ TEST_CHECK(*v2 > *v1);
+ TEST_CHECK(*v1 != *v2);
+ TEST_CHECK(*v2 != *v1);
+ }
+ else if (std::distance(v.begin(), v1) > std::distance(v.begin(), v2))
+ {
+ TEST_CHECK(*v2 < *v1);
+ TEST_CHECK(*v1 > *v2);
+ TEST_CHECK(*v2 != *v1);
+ TEST_CHECK(*v1 != *v2);
+ }
+ else
+ {
+ TEST_CHECK(*v2 == *v1);
+ TEST_CHECK(*v1 == *v2);
+ }
+ }
+ }
+ }
+ } test_version_spec_compare;
}