summaryrefslogtreecommitdiff
path: root/cli-tests/inheritance/driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cli-tests/inheritance/driver.cxx')
-rw-r--r--cli-tests/inheritance/driver.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/cli-tests/inheritance/driver.cxx b/cli-tests/inheritance/driver.cxx
new file mode 100644
index 0000000..4acab0d
--- /dev/null
+++ b/cli-tests/inheritance/driver.cxx
@@ -0,0 +1,35 @@
+// file : inheritance/driver.cxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// license : MIT; see accompanying LICENSE file
+
+// Test option class inheritance.
+//
+
+#include <string>
+#include <cassert>
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+
+int
+main (int argc, char* argv[])
+{
+ const cli::options& d (options::description ());
+
+ assert (d.size () == 4);
+ assert (d[0].name () == "--very-long-flag");
+ assert (d[1].name () == "-i");
+ assert (d[2].name () == "-s");
+ assert (d[3].name () == "--string");
+
+ options o (argc, argv);
+
+ assert (o.very_long_flag ());
+ assert (o.s () == "short");
+ assert (o.i () == 123);
+ assert (o.string () == "long");
+
+ options::print_usage (cout);
+}