diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-06-02 17:22:12 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-06-02 17:22:12 +0200 |
commit | ed60746355044dd39acd82b8f42c4d9886914567 (patch) | |
tree | a958825cb9bca8960eafb41c373d91e22ca9e4ed /tests/specifier/driver.cxx | |
parent | 62166bfe7031522bd851eb5d7047a19182e24a45 (diff) |
Implement generation of specifier functions (--generate-specifier)
These functions determine whether the option was specified on the command
line. New test: specifier.
Diffstat (limited to 'tests/specifier/driver.cxx')
-rw-r--r-- | tests/specifier/driver.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/specifier/driver.cxx b/tests/specifier/driver.cxx new file mode 100644 index 0000000..9f9005a --- /dev/null +++ b/tests/specifier/driver.cxx @@ -0,0 +1,30 @@ +// file : tests/specifier/driver.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +// Test specifier functions. +// + +#include <string> +#include <cassert> + +#include "test.hxx" + +using namespace std; + +int +main (int argc, char* argv[]) +{ + options o (argc, argv); + + assert (o.a ()); + assert (o.b () == 1 && !o.b_specified ()); + assert (o.c () == "foo" && o.c_specified ()); + + o.b_specified (true); + o.c_specified (false); + + assert (o.b_specified ()); + assert (!o.c_specified ()); +} |