diff options
Diffstat (limited to 'tests/cxx/parser/validation/built-in/qname/driver.cxx')
-rw-r--r-- | tests/cxx/parser/validation/built-in/qname/driver.cxx | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/tests/cxx/parser/validation/built-in/qname/driver.cxx b/tests/cxx/parser/validation/built-in/qname/driver.cxx deleted file mode 100644 index 6da6f2f..0000000 --- a/tests/cxx/parser/validation/built-in/qname/driver.cxx +++ /dev/null @@ -1,105 +0,0 @@ -// file : tests/cxx/parser/validation/built-in/qname/driver.cxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -// Test the built-in QName type validation. -// -#include <cassert> - -#include <xsd/cxx/parser/validating/exceptions.hxx> -#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx> - -using namespace xsd::cxx::parser::validating; - -bool -test_post_fail (qname_pimpl<char>& p) -{ - try - { - p._post (); - } - catch (invalid_value<char> const&) - { - return true; - } - - return false; -} - -int -main () -{ - typedef xsd::cxx::parser::qname<char> qname; - - // Good. - // - { - qname_pimpl<char> p; - p.pre (); - p._pre (); - p._characters (" xsi"); - p._characters (":"); - p._characters ("schemaLocation"); - p._post (); - assert (p.post_qname () == qname ("xsi", "schemaLocation")); - } - - { - qname_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("schemaLocation"); - p._post (); - assert (p.post_qname () == qname ("schemaLocation")); - } - - - // Bad - // - { - qname_pimpl<char> p; - p.pre (); - p._pre (); - //p._characters (""); - assert (test_post_fail (p)); - } - - { - qname_pimpl<char> p; - p.pre (); - p._pre (); - p._characters (":"); - assert (test_post_fail (p)); - } - - { - qname_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("xsi:"); - assert (test_post_fail (p)); - } - - { - qname_pimpl<char> p; - p.pre (); - p._pre (); - p._characters (":schemaLocation"); - assert (test_post_fail (p)); - } - - { - qname_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("x?i:schemaLocation"); - assert (test_post_fail (p)); - } - - { - qname_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("xsi:schema Location"); - assert (test_post_fail (p)); - } -} |