diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-02-24 15:16:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-02-24 15:16:26 +0200 |
commit | 707cc94fe52463870a9c6c8e2e66eaaa389e601d (patch) | |
tree | 13e10ff28bf4455d915f9d59b401bdbb62a393cb /tests/cxx/parser/validation/built-in/uri/driver.cxx |
Start tracking XSD/e with git after version 3.0.03.0.0
Diffstat (limited to 'tests/cxx/parser/validation/built-in/uri/driver.cxx')
-rw-r--r-- | tests/cxx/parser/validation/built-in/uri/driver.cxx | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/cxx/parser/validation/built-in/uri/driver.cxx b/tests/cxx/parser/validation/built-in/uri/driver.cxx new file mode 100644 index 0000000..5d1f91a --- /dev/null +++ b/tests/cxx/parser/validation/built-in/uri/driver.cxx @@ -0,0 +1,66 @@ +// file : tests/cxx/parser/validation/built-in/uri/driver.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test the built-in anyURI type validation. +// +#include <string> +#include <cassert> + +// Let the runtime header sort out which version (stl/no-stl) to +// include. +// +#include <xsde/cxx/parser/validating/xml-schema-pimpl.hxx> + +using namespace xsde::cxx::parser; +using namespace xsde::cxx::parser::validating; + +int +main () +{ + using std::string; + + // Good. + // + { + context c (0); + uri_pimpl p; + p.pre (); + p._pre_impl (c); + p._characters (" "); + p._post (); + assert (!c.error_type () && p.post_uri () == string ("")); + } + + { + context c (0); + uri_pimpl p; + p.pre (); + p._pre_impl (c); + p._characters ("relative"); + p._post (); + assert (!c.error_type () && p.post_uri () == string ("relative")); + } + + { + context c (0); + uri_pimpl p; + p.pre (); + p._pre_impl (c); + p._characters ("#id"); + p._post (); + assert (!c.error_type () && p.post_uri () == string ("#id")); + } + + { + context c (0); + uri_pimpl p; + p.pre (); + p._pre_impl (c); + p._characters ("http://www.example.com/foo#bar"); + p._post (); + assert (!c.error_type () && + p.post_uri () == string ("http://www.example.com/foo#bar")); + } +} |