aboutsummaryrefslogtreecommitdiff
path: root/tests/standard-version/driver.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-04-27 21:56:42 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-04-28 12:08:14 +0300
commit55f115d875bf70305ca43e93761395b4329a23a6 (patch)
tree9b1d1f5384a1d267c2d98c849c92fb29ada66ea8 /tests/standard-version/driver.cxx
parent5bb170316ebad036ee5b8b18dee7ce3d09c72df4 (diff)
Add standard_version_constraint::satisfies()
Diffstat (limited to 'tests/standard-version/driver.cxx')
-rw-r--r--tests/standard-version/driver.cxx19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/standard-version/driver.cxx b/tests/standard-version/driver.cxx
index e6a21ef..86d9621 100644
--- a/tests/standard-version/driver.cxx
+++ b/tests/standard-version/driver.cxx
@@ -76,12 +76,14 @@ version (const string& s, bool allow_earliest = true)
// argv[0] -b <version>
// argv[0] -c <version> <version>
// argv[0] -r
+// argv[0] -s <version> <constraint>
// argv[0]
//
// -a output 'y' for alpha-version, 'n' otherwise
// -b output 'y' for beta-version, 'n' otherwise
// -c output 0 if versions are equal, -1 if the first one is less, 1 otherwise
// -r create version constraints from STDIN lines, and print them to STDOUT
+// -s output 'y' if version satisfies constraint, 'n' otherwise
//
// If no options are specified, then create versions from STDIN lines, and
// print them to STDOUT.
@@ -100,18 +102,14 @@ try
if (o == "-a")
{
assert (argc == 3);
- char r (version (argv[2]).alpha ()
- ? 'y'
- : 'n');
+ char r (version (argv[2]).alpha () ? 'y' : 'n');
cout << r << endl;
}
else if (o == "-b")
{
assert (argc == 3);
- char r (version (argv[2]).beta ()
- ? 'y'
- : 'n');
+ char r (version (argv[2]).beta () ? 'y' : 'n');
cout << r << endl;
}
@@ -130,6 +128,15 @@ try
while (getline (cin, s))
cout << standard_version_constraint (s) << endl;
}
+ else if (o == "-s")
+ {
+ assert (argc == 4);
+
+ char r (standard_version_constraint (argv[3]).satisfies (
+ version (argv[2])) ? 'y' : 'n');
+
+ cout << r << endl;
+ }
else
assert (false);