diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-05-04 23:42:51 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-05-05 16:02:10 +0300 |
commit | 166c3167bc608a63e2312930a9b722f8d697d2c5 (patch) | |
tree | 086b2b42f34414b45919ea1a7bf42ffb18f887d8 /tests/standard-version/driver.cxx | |
parent | b5b66e6a831cf68b7da764235f669fad758491fb (diff) |
Add support for standard version constraint shortcut operators
Diffstat (limited to 'tests/standard-version/driver.cxx')
-rw-r--r-- | tests/standard-version/driver.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/standard-version/driver.cxx b/tests/standard-version/driver.cxx index c6f9c11..1eb1bc8 100644 --- a/tests/standard-version/driver.cxx +++ b/tests/standard-version/driver.cxx @@ -76,6 +76,32 @@ version (const string& s, assert (r == v); } + if (!r.stub ()) + { + auto max_ver = [&v] (char c) -> string + { + string e (v.epoch != 0 ? '+' + to_string (v.epoch) + '-' : string ()); + + return c == '~' || v.major () == 0 + ? e + to_string (v.major ()) + '.' + to_string (v.minor () + 1) + ".0-" + : e + to_string (v.major () + 1) + ".0.0-"; + }; + + if (v.minor () != 999) + { + standard_version_constraint c1 ("~" + s); + standard_version_constraint c2 ('[' + s + ' ' + max_ver ('~') + ')'); + assert (c1 == c2); + } + + if ((v.major () == 0 && v.minor () != 999) || + (v.major () != 0 && v.major () != 999)) + { + standard_version_constraint c1 ("^" + s); + standard_version_constraint c2 ('[' + s + ' ' + max_ver ('^') + ')'); + assert (c1 == c2); + } + } } catch (const invalid_argument& e) { |