From 5e527213a2430bb3018e5eebd909aef294edf9b5 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 18 Dec 2020 18:48:46 +0300 Subject: Switch to build2 --- xsd-tests/cxx/tree/any-type/buildfile | 26 ++ xsd-tests/cxx/tree/any-type/driver.cxx | 144 +++++++ xsd-tests/cxx/tree/any-type/output | 73 ++++ xsd-tests/cxx/tree/any-type/test.xml | 26 ++ xsd-tests/cxx/tree/any-type/test.xsd | 19 + xsd-tests/cxx/tree/binary/cdr/buildfile | 25 ++ xsd-tests/cxx/tree/binary/cdr/driver.cxx | 143 +++++++ xsd-tests/cxx/tree/binary/cdr/test.xml | 93 +++++ xsd-tests/cxx/tree/binary/cdr/test.xsd | 123 ++++++ xsd-tests/cxx/tree/binary/polymorphic/buildfile | 27 ++ xsd-tests/cxx/tree/binary/polymorphic/driver.cxx | 164 ++++++++ xsd-tests/cxx/tree/binary/polymorphic/test.xml | 92 +++++ xsd-tests/cxx/tree/binary/polymorphic/test.xsd | 125 ++++++ xsd-tests/cxx/tree/binary/xdr-ordered/buildfile | 28 ++ xsd-tests/cxx/tree/binary/xdr-ordered/driver.cxx | 206 +++++++++ xsd-tests/cxx/tree/binary/xdr-ordered/test.xml | 93 +++++ xsd-tests/cxx/tree/binary/xdr-ordered/test.xsd | 123 ++++++ xsd-tests/cxx/tree/binary/xdr/buildfile | 27 ++ xsd-tests/cxx/tree/binary/xdr/driver.cxx | 204 +++++++++ xsd-tests/cxx/tree/binary/xdr/test.xml | 93 +++++ xsd-tests/cxx/tree/binary/xdr/test.xsd | 123 ++++++ xsd-tests/cxx/tree/buildfile | 6 + xsd-tests/cxx/tree/built-in/.gitignore | 1 + xsd-tests/cxx/tree/built-in/buildfile | 25 ++ xsd-tests/cxx/tree/built-in/driver.cxx | 93 +++++ xsd-tests/cxx/tree/built-in/testscript | 394 ++++++++++++++++++ xsd-tests/cxx/tree/built-in/types.xsd | 460 +++++++++++++++++++++ xsd-tests/cxx/tree/chameleon/.gitignore | 1 + xsd-tests/cxx/tree/chameleon/buildfile | 24 ++ xsd-tests/cxx/tree/chameleon/driver.cxx | 35 ++ xsd-tests/cxx/tree/chameleon/includee.xsd | 13 + xsd-tests/cxx/tree/chameleon/includer.xsd | 12 + xsd-tests/cxx/tree/chameleon/output | 3 + xsd-tests/cxx/tree/chameleon/test.xml | 8 + xsd-tests/cxx/tree/comparison/buildfile | 22 + xsd-tests/cxx/tree/comparison/driver.cxx | 38 ++ xsd-tests/cxx/tree/comparison/test.xml | 19 + xsd-tests/cxx/tree/comparison/test.xsd | 30 ++ xsd-tests/cxx/tree/compilation/buildfile | 20 + xsd-tests/cxx/tree/compilation/driver.cxx | 116 ++++++ xsd-tests/cxx/tree/compilation/test.xsd | 12 + xsd-tests/cxx/tree/complex/ctor/buildfile | 25 ++ xsd-tests/cxx/tree/complex/ctor/driver.cxx | 122 ++++++ xsd-tests/cxx/tree/complex/ctor/test.xsd | 182 ++++++++ xsd-tests/cxx/tree/containment/buildfile | 20 + xsd-tests/cxx/tree/containment/driver.cxx | 118 ++++++ xsd-tests/cxx/tree/containment/test.xsd | 59 +++ xsd-tests/cxx/tree/default/general/buildfile | 26 ++ xsd-tests/cxx/tree/default/general/driver.cxx | 37 ++ xsd-tests/cxx/tree/default/general/output | 15 + xsd-tests/cxx/tree/default/general/test.xml | 16 + xsd-tests/cxx/tree/default/general/test.xsd | 241 +++++++++++ xsd-tests/cxx/tree/default/omit/buildfile | 27 ++ xsd-tests/cxx/tree/default/omit/driver.cxx | 46 +++ xsd-tests/cxx/tree/default/omit/output | 19 + xsd-tests/cxx/tree/default/omit/test.xml | 9 + xsd-tests/cxx/tree/default/omit/test.xsd | 30 ++ xsd-tests/cxx/tree/detach/buildfile | 21 + xsd-tests/cxx/tree/detach/driver.cxx | 108 +++++ xsd-tests/cxx/tree/detach/test.xsd | 32 ++ xsd-tests/cxx/tree/dom-association/buildfile | 27 ++ xsd-tests/cxx/tree/dom-association/dom-parse.cxx | 95 +++++ xsd-tests/cxx/tree/dom-association/dom-parse.hxx | 23 ++ xsd-tests/cxx/tree/dom-association/driver.cxx | 71 ++++ xsd-tests/cxx/tree/dom-association/output | 0 xsd-tests/cxx/tree/dom-association/test.xml | 7 + xsd-tests/cxx/tree/dom-association/test.xsd | 12 + .../cxx/tree/encoding/char/iso-8859-1/buildfile | 25 ++ .../cxx/tree/encoding/char/iso-8859-1/driver.cxx | 74 ++++ xsd-tests/cxx/tree/encoding/char/iso-8859-1/output | 10 + .../cxx/tree/encoding/char/iso-8859-1/test.xml | 14 + .../cxx/tree/encoding/char/iso-8859-1/test.xsd | 31 ++ xsd-tests/cxx/tree/encoding/char/lcp/buildfile | 24 ++ xsd-tests/cxx/tree/encoding/char/lcp/driver.cxx | 40 ++ xsd-tests/cxx/tree/encoding/char/lcp/output | 4 + xsd-tests/cxx/tree/encoding/char/lcp/test.xml | 7 + xsd-tests/cxx/tree/encoding/char/lcp/test.xsd | 12 + xsd-tests/cxx/tree/encoding/char/utf-8/buildfile | 24 ++ xsd-tests/cxx/tree/encoding/char/utf-8/driver.cxx | 63 +++ xsd-tests/cxx/tree/encoding/char/utf-8/output | 9 + xsd-tests/cxx/tree/encoding/char/utf-8/test.xml | 13 + xsd-tests/cxx/tree/encoding/char/utf-8/test.xsd | 31 ++ xsd-tests/cxx/tree/encoding/wchar/buildfile | 25 ++ xsd-tests/cxx/tree/encoding/wchar/driver.cxx | 55 +++ xsd-tests/cxx/tree/encoding/wchar/output | 10 + xsd-tests/cxx/tree/encoding/wchar/test.xml | 14 + xsd-tests/cxx/tree/encoding/wchar/test.xsd | 33 ++ xsd-tests/cxx/tree/enumeration/ctor/buildfile | 22 + xsd-tests/cxx/tree/enumeration/ctor/driver.cxx | 30 ++ xsd-tests/cxx/tree/enumeration/ctor/test.xsd | 41 ++ .../cxx/tree/enumeration/inheritance/buildfile | 23 ++ .../cxx/tree/enumeration/inheritance/driver.cxx | 53 +++ xsd-tests/cxx/tree/enumeration/inheritance/output | 1 + .../cxx/tree/enumeration/inheritance/test.xml | 3 + .../cxx/tree/enumeration/inheritance/test.xsd | 22 + xsd-tests/cxx/tree/float/buildfile | 24 ++ xsd-tests/cxx/tree/float/driver.cxx | 53 +++ xsd-tests/cxx/tree/float/output | 35 ++ xsd-tests/cxx/tree/float/test.xml | 35 ++ xsd-tests/cxx/tree/float/test.xsd | 74 ++++ xsd-tests/cxx/tree/list/ctor/buildfile | 22 + xsd-tests/cxx/tree/list/ctor/driver.cxx | 50 +++ xsd-tests/cxx/tree/list/ctor/test.xsd | 18 + .../cxx/tree/name-clash/inheritance/buildfile | 23 ++ .../cxx/tree/name-clash/inheritance/driver.cxx | 35 ++ xsd-tests/cxx/tree/name-clash/inheritance/output | 3 + xsd-tests/cxx/tree/name-clash/inheritance/test.xml | 8 + xsd-tests/cxx/tree/name-clash/inheritance/test.xsd | 53 +++ xsd-tests/cxx/tree/naming/camel/buildfile | 25 ++ xsd-tests/cxx/tree/naming/camel/driver.cxx | 154 +++++++ xsd-tests/cxx/tree/naming/camel/test.xsd | 31 ++ xsd-tests/cxx/tree/naming/java/buildfile | 25 ++ xsd-tests/cxx/tree/naming/java/driver.cxx | 153 +++++++ xsd-tests/cxx/tree/naming/java/test.xsd | 31 ++ xsd-tests/cxx/tree/naming/knr/buildfile | 25 ++ xsd-tests/cxx/tree/naming/knr/driver.cxx | 154 +++++++ xsd-tests/cxx/tree/naming/knr/test.xsd | 31 ++ xsd-tests/cxx/tree/order/buildfile | 37 ++ xsd-tests/cxx/tree/order/driver.cxx | 64 +++ xsd-tests/cxx/tree/order/output | 92 +++++ xsd-tests/cxx/tree/order/test.xml | 71 ++++ xsd-tests/cxx/tree/order/test.xsd | 130 ++++++ .../cxx/tree/polymorphism/comparison/buildfile | 25 ++ .../cxx/tree/polymorphism/comparison/driver.cxx | 85 ++++ .../cxx/tree/polymorphism/comparison/test.xml | 7 + .../cxx/tree/polymorphism/comparison/test.xsd | 39 ++ xsd-tests/cxx/tree/polymorphism/ostream/buildfile | 26 ++ xsd-tests/cxx/tree/polymorphism/ostream/driver.cxx | 34 ++ xsd-tests/cxx/tree/polymorphism/ostream/output | 18 + xsd-tests/cxx/tree/polymorphism/ostream/test.xml | 10 + xsd-tests/cxx/tree/polymorphism/ostream/test.xsd | 62 +++ .../cxx/tree/polymorphism/same-type/buildfile | 25 ++ .../cxx/tree/polymorphism/same-type/driver.cxx | 35 ++ xsd-tests/cxx/tree/polymorphism/same-type/output | 9 + xsd-tests/cxx/tree/polymorphism/same-type/test.xml | 10 + xsd-tests/cxx/tree/polymorphism/same-type/test.xsd | 21 + xsd-tests/cxx/tree/prefix/.gitignore | 2 + xsd-tests/cxx/tree/prefix/bar.xsd | 34 ++ xsd-tests/cxx/tree/prefix/buildfile | 31 ++ xsd-tests/cxx/tree/prefix/driver.cxx | 34 ++ xsd-tests/cxx/tree/prefix/foo.xsd | 16 + xsd-tests/cxx/tree/prefix/output | 18 + xsd-tests/cxx/tree/prefix/test.xml | 19 + xsd-tests/cxx/tree/prefix/test.xsd | 40 ++ xsd-tests/cxx/tree/test-template/buildfile | 23 ++ xsd-tests/cxx/tree/test-template/driver.cxx | 35 ++ xsd-tests/cxx/tree/test-template/output | 2 + xsd-tests/cxx/tree/test-template/test.xml | 7 + xsd-tests/cxx/tree/test-template/test.xsd | 12 + xsd-tests/cxx/tree/types-only/buildfile | 20 + xsd-tests/cxx/tree/types-only/driver.cxx | 30 ++ xsd-tests/cxx/tree/types-only/test.xsd | 52 +++ xsd-tests/cxx/tree/union/ctor/buildfile | 22 + xsd-tests/cxx/tree/union/ctor/driver.cxx | 30 ++ xsd-tests/cxx/tree/union/ctor/test.xsd | 14 + xsd-tests/cxx/tree/wildcard/buildfile | 27 ++ xsd-tests/cxx/tree/wildcard/driver.cxx | 203 +++++++++ xsd-tests/cxx/tree/wildcard/output | 24 ++ xsd-tests/cxx/tree/wildcard/test.xml | 19 + xsd-tests/cxx/tree/wildcard/test.xsd | 18 + 160 files changed, 8004 insertions(+) create mode 100644 xsd-tests/cxx/tree/any-type/buildfile create mode 100644 xsd-tests/cxx/tree/any-type/driver.cxx create mode 100644 xsd-tests/cxx/tree/any-type/output create mode 100644 xsd-tests/cxx/tree/any-type/test.xml create mode 100644 xsd-tests/cxx/tree/any-type/test.xsd create mode 100644 xsd-tests/cxx/tree/binary/cdr/buildfile create mode 100644 xsd-tests/cxx/tree/binary/cdr/driver.cxx create mode 100644 xsd-tests/cxx/tree/binary/cdr/test.xml create mode 100644 xsd-tests/cxx/tree/binary/cdr/test.xsd create mode 100644 xsd-tests/cxx/tree/binary/polymorphic/buildfile create mode 100644 xsd-tests/cxx/tree/binary/polymorphic/driver.cxx create mode 100644 xsd-tests/cxx/tree/binary/polymorphic/test.xml create mode 100644 xsd-tests/cxx/tree/binary/polymorphic/test.xsd create mode 100644 xsd-tests/cxx/tree/binary/xdr-ordered/buildfile create mode 100644 xsd-tests/cxx/tree/binary/xdr-ordered/driver.cxx create mode 100644 xsd-tests/cxx/tree/binary/xdr-ordered/test.xml create mode 100644 xsd-tests/cxx/tree/binary/xdr-ordered/test.xsd create mode 100644 xsd-tests/cxx/tree/binary/xdr/buildfile create mode 100644 xsd-tests/cxx/tree/binary/xdr/driver.cxx create mode 100644 xsd-tests/cxx/tree/binary/xdr/test.xml create mode 100644 xsd-tests/cxx/tree/binary/xdr/test.xsd create mode 100644 xsd-tests/cxx/tree/buildfile create mode 100644 xsd-tests/cxx/tree/built-in/.gitignore create mode 100644 xsd-tests/cxx/tree/built-in/buildfile create mode 100644 xsd-tests/cxx/tree/built-in/driver.cxx create mode 100644 xsd-tests/cxx/tree/built-in/testscript create mode 100644 xsd-tests/cxx/tree/built-in/types.xsd create mode 100644 xsd-tests/cxx/tree/chameleon/.gitignore create mode 100644 xsd-tests/cxx/tree/chameleon/buildfile create mode 100644 xsd-tests/cxx/tree/chameleon/driver.cxx create mode 100644 xsd-tests/cxx/tree/chameleon/includee.xsd create mode 100644 xsd-tests/cxx/tree/chameleon/includer.xsd create mode 100644 xsd-tests/cxx/tree/chameleon/output create mode 100644 xsd-tests/cxx/tree/chameleon/test.xml create mode 100644 xsd-tests/cxx/tree/comparison/buildfile create mode 100644 xsd-tests/cxx/tree/comparison/driver.cxx create mode 100644 xsd-tests/cxx/tree/comparison/test.xml create mode 100644 xsd-tests/cxx/tree/comparison/test.xsd create mode 100644 xsd-tests/cxx/tree/compilation/buildfile create mode 100644 xsd-tests/cxx/tree/compilation/driver.cxx create mode 100644 xsd-tests/cxx/tree/compilation/test.xsd create mode 100644 xsd-tests/cxx/tree/complex/ctor/buildfile create mode 100644 xsd-tests/cxx/tree/complex/ctor/driver.cxx create mode 100644 xsd-tests/cxx/tree/complex/ctor/test.xsd create mode 100644 xsd-tests/cxx/tree/containment/buildfile create mode 100644 xsd-tests/cxx/tree/containment/driver.cxx create mode 100644 xsd-tests/cxx/tree/containment/test.xsd create mode 100644 xsd-tests/cxx/tree/default/general/buildfile create mode 100644 xsd-tests/cxx/tree/default/general/driver.cxx create mode 100644 xsd-tests/cxx/tree/default/general/output create mode 100644 xsd-tests/cxx/tree/default/general/test.xml create mode 100644 xsd-tests/cxx/tree/default/general/test.xsd create mode 100644 xsd-tests/cxx/tree/default/omit/buildfile create mode 100644 xsd-tests/cxx/tree/default/omit/driver.cxx create mode 100644 xsd-tests/cxx/tree/default/omit/output create mode 100644 xsd-tests/cxx/tree/default/omit/test.xml create mode 100644 xsd-tests/cxx/tree/default/omit/test.xsd create mode 100644 xsd-tests/cxx/tree/detach/buildfile create mode 100644 xsd-tests/cxx/tree/detach/driver.cxx create mode 100644 xsd-tests/cxx/tree/detach/test.xsd create mode 100644 xsd-tests/cxx/tree/dom-association/buildfile create mode 100644 xsd-tests/cxx/tree/dom-association/dom-parse.cxx create mode 100644 xsd-tests/cxx/tree/dom-association/dom-parse.hxx create mode 100644 xsd-tests/cxx/tree/dom-association/driver.cxx create mode 100644 xsd-tests/cxx/tree/dom-association/output create mode 100644 xsd-tests/cxx/tree/dom-association/test.xml create mode 100644 xsd-tests/cxx/tree/dom-association/test.xsd create mode 100644 xsd-tests/cxx/tree/encoding/char/iso-8859-1/buildfile create mode 100644 xsd-tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx create mode 100644 xsd-tests/cxx/tree/encoding/char/iso-8859-1/output create mode 100644 xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xml create mode 100644 xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xsd create mode 100644 xsd-tests/cxx/tree/encoding/char/lcp/buildfile create mode 100644 xsd-tests/cxx/tree/encoding/char/lcp/driver.cxx create mode 100644 xsd-tests/cxx/tree/encoding/char/lcp/output create mode 100644 xsd-tests/cxx/tree/encoding/char/lcp/test.xml create mode 100644 xsd-tests/cxx/tree/encoding/char/lcp/test.xsd create mode 100644 xsd-tests/cxx/tree/encoding/char/utf-8/buildfile create mode 100644 xsd-tests/cxx/tree/encoding/char/utf-8/driver.cxx create mode 100644 xsd-tests/cxx/tree/encoding/char/utf-8/output create mode 100644 xsd-tests/cxx/tree/encoding/char/utf-8/test.xml create mode 100644 xsd-tests/cxx/tree/encoding/char/utf-8/test.xsd create mode 100644 xsd-tests/cxx/tree/encoding/wchar/buildfile create mode 100644 xsd-tests/cxx/tree/encoding/wchar/driver.cxx create mode 100644 xsd-tests/cxx/tree/encoding/wchar/output create mode 100644 xsd-tests/cxx/tree/encoding/wchar/test.xml create mode 100644 xsd-tests/cxx/tree/encoding/wchar/test.xsd create mode 100644 xsd-tests/cxx/tree/enumeration/ctor/buildfile create mode 100644 xsd-tests/cxx/tree/enumeration/ctor/driver.cxx create mode 100644 xsd-tests/cxx/tree/enumeration/ctor/test.xsd create mode 100644 xsd-tests/cxx/tree/enumeration/inheritance/buildfile create mode 100644 xsd-tests/cxx/tree/enumeration/inheritance/driver.cxx create mode 100644 xsd-tests/cxx/tree/enumeration/inheritance/output create mode 100644 xsd-tests/cxx/tree/enumeration/inheritance/test.xml create mode 100644 xsd-tests/cxx/tree/enumeration/inheritance/test.xsd create mode 100644 xsd-tests/cxx/tree/float/buildfile create mode 100644 xsd-tests/cxx/tree/float/driver.cxx create mode 100644 xsd-tests/cxx/tree/float/output create mode 100644 xsd-tests/cxx/tree/float/test.xml create mode 100644 xsd-tests/cxx/tree/float/test.xsd create mode 100644 xsd-tests/cxx/tree/list/ctor/buildfile create mode 100644 xsd-tests/cxx/tree/list/ctor/driver.cxx create mode 100644 xsd-tests/cxx/tree/list/ctor/test.xsd create mode 100644 xsd-tests/cxx/tree/name-clash/inheritance/buildfile create mode 100644 xsd-tests/cxx/tree/name-clash/inheritance/driver.cxx create mode 100644 xsd-tests/cxx/tree/name-clash/inheritance/output create mode 100644 xsd-tests/cxx/tree/name-clash/inheritance/test.xml create mode 100644 xsd-tests/cxx/tree/name-clash/inheritance/test.xsd create mode 100644 xsd-tests/cxx/tree/naming/camel/buildfile create mode 100644 xsd-tests/cxx/tree/naming/camel/driver.cxx create mode 100644 xsd-tests/cxx/tree/naming/camel/test.xsd create mode 100644 xsd-tests/cxx/tree/naming/java/buildfile create mode 100644 xsd-tests/cxx/tree/naming/java/driver.cxx create mode 100644 xsd-tests/cxx/tree/naming/java/test.xsd create mode 100644 xsd-tests/cxx/tree/naming/knr/buildfile create mode 100644 xsd-tests/cxx/tree/naming/knr/driver.cxx create mode 100644 xsd-tests/cxx/tree/naming/knr/test.xsd create mode 100644 xsd-tests/cxx/tree/order/buildfile create mode 100644 xsd-tests/cxx/tree/order/driver.cxx create mode 100644 xsd-tests/cxx/tree/order/output create mode 100644 xsd-tests/cxx/tree/order/test.xml create mode 100644 xsd-tests/cxx/tree/order/test.xsd create mode 100644 xsd-tests/cxx/tree/polymorphism/comparison/buildfile create mode 100644 xsd-tests/cxx/tree/polymorphism/comparison/driver.cxx create mode 100644 xsd-tests/cxx/tree/polymorphism/comparison/test.xml create mode 100644 xsd-tests/cxx/tree/polymorphism/comparison/test.xsd create mode 100644 xsd-tests/cxx/tree/polymorphism/ostream/buildfile create mode 100644 xsd-tests/cxx/tree/polymorphism/ostream/driver.cxx create mode 100644 xsd-tests/cxx/tree/polymorphism/ostream/output create mode 100644 xsd-tests/cxx/tree/polymorphism/ostream/test.xml create mode 100644 xsd-tests/cxx/tree/polymorphism/ostream/test.xsd create mode 100644 xsd-tests/cxx/tree/polymorphism/same-type/buildfile create mode 100644 xsd-tests/cxx/tree/polymorphism/same-type/driver.cxx create mode 100644 xsd-tests/cxx/tree/polymorphism/same-type/output create mode 100644 xsd-tests/cxx/tree/polymorphism/same-type/test.xml create mode 100644 xsd-tests/cxx/tree/polymorphism/same-type/test.xsd create mode 100644 xsd-tests/cxx/tree/prefix/.gitignore create mode 100644 xsd-tests/cxx/tree/prefix/bar.xsd create mode 100644 xsd-tests/cxx/tree/prefix/buildfile create mode 100644 xsd-tests/cxx/tree/prefix/driver.cxx create mode 100644 xsd-tests/cxx/tree/prefix/foo.xsd create mode 100644 xsd-tests/cxx/tree/prefix/output create mode 100644 xsd-tests/cxx/tree/prefix/test.xml create mode 100644 xsd-tests/cxx/tree/prefix/test.xsd create mode 100644 xsd-tests/cxx/tree/test-template/buildfile create mode 100644 xsd-tests/cxx/tree/test-template/driver.cxx create mode 100644 xsd-tests/cxx/tree/test-template/output create mode 100644 xsd-tests/cxx/tree/test-template/test.xml create mode 100644 xsd-tests/cxx/tree/test-template/test.xsd create mode 100644 xsd-tests/cxx/tree/types-only/buildfile create mode 100644 xsd-tests/cxx/tree/types-only/driver.cxx create mode 100644 xsd-tests/cxx/tree/types-only/test.xsd create mode 100644 xsd-tests/cxx/tree/union/ctor/buildfile create mode 100644 xsd-tests/cxx/tree/union/ctor/driver.cxx create mode 100644 xsd-tests/cxx/tree/union/ctor/test.xsd create mode 100644 xsd-tests/cxx/tree/wildcard/buildfile create mode 100644 xsd-tests/cxx/tree/wildcard/driver.cxx create mode 100644 xsd-tests/cxx/tree/wildcard/output create mode 100644 xsd-tests/cxx/tree/wildcard/test.xml create mode 100644 xsd-tests/cxx/tree/wildcard/test.xsd (limited to 'xsd-tests/cxx/tree') diff --git a/xsd-tests/cxx/tree/any-type/buildfile b/xsd-tests/cxx/tree/any-type/buildfile new file mode 100644 index 0000000..c65c403 --- /dev/null +++ b/xsd-tests/cxx/tree/any-type/buildfile @@ -0,0 +1,26 @@ +# file : cxx/tree/any-type/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --generate-any-type \ + --generate-ostream \ + --generate-comparison \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/any-type/driver.cxx b/xsd-tests/cxx/tree/any-type/driver.cxx new file mode 100644 index 0000000..a8fccf6 --- /dev/null +++ b/xsd-tests/cxx/tree/any-type/driver.cxx @@ -0,0 +1,144 @@ +// file : cxx/tree/any-type/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test anyType and anySimpleType content extraction. +// + +#include // std::auto_ptr/unique_ptr +#include // std::move +#include +#include + +#include +#include + +#include "test.hxx" // Get XSD_CXX11 defined. + +#include + +using namespace std; +using namespace test; +using namespace xercesc; + +namespace xml = xsd::cxx::xml; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + XMLPlatformUtils::Initialize (); + + try + { + // Test parsing + // + XSD_AUTO_PTR r (root (argv[1])); + + // Test API. + // + { + assert (type::a_default_value ().text_content () == "default value"); + } + + { + xml_schema::simple_type x ("fox"); + assert (x.text_content () == "fox"); + x.text_content ("foo"); + assert (x.text_content () == "foo"); + x.text_content ().clear (); + assert (x.text_content () == ""); + x.text_content () = "baz"; + r->s ().push_back (x); + } + + { + xml_schema::type x; + + DOMDocument& doc (x.dom_content_document ()); + + // Copy. + // + DOMElement* e (doc.createElement (xml::string ("dummy").c_str ())); + e->setAttribute (xml::string ("x").c_str (), + xml::string ("foo").c_str ()); + e->setTextContent (xml::string ("data").c_str ()); + x.dom_content ().set (*e); + e->release (); + + r->t ().push_back (x); + } + + { + XSD_AUTO_PTR x (new xml_schema::type); + + DOMDocument& doc (x->dom_content_document ()); + + // Assume ownership. + // + DOMElement* e (doc.createElement (xml::string ("dummy").c_str ())); + e->setAttribute (xml::string ("x").c_str (), + xml::string ("foo").c_str ()); + e->setTextContent (xml::string ("data").c_str ()); + x->dom_content ().set (e); + +#ifdef XSD_CXX11 + r->t ().push_back (std::move (x)); +#else + r->t ().push_back (x); +#endif + } + + // Test printing. + // + cout << *r << endl + << endl; + + // Test serialization. + // + xml_schema::namespace_infomap map; + + map["t"].name = "test"; + map["t"].schema = "test.xsd"; + map["o"].name = "other"; + + stringstream iostr; + root (iostr, *r, map); + + cout << iostr.str () << endl + << endl; + + { + XSD_AUTO_PTR r1 (root (iostr, argv[1])); + + // Xerces-C++ mis-indentation of mixed content messes this up. + // assert (*r == *r); + + stringstream iostr; + root (iostr, *r1, map); + + cout << iostr.str () << endl + << endl; + } + + // Test comparison. + // + assert (*r == *r); + + // Test copy c-tor. + // + type copy (*r); + assert (copy == *r); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } + + XMLPlatformUtils::Terminate (); +} diff --git a/xsd-tests/cxx/tree/any-type/output b/xsd-tests/cxx/tree/any-type/output new file mode 100644 index 0000000..580e7db --- /dev/null +++ b/xsd-tests/cxx/tree/any-type/output @@ -0,0 +1,73 @@ + +t: +t: +t: +t: +t: +t: +t: +t: +s: +s: simple +s: baz +l: one two three +a: any simple content + + + + + + any + any + + + nested 1 + nested 2 + + more + + mi + nested 1x + nested 2ed + content + + data + data + + simple + baz + one two three + + + + + + + + any + any + + + nested 1 + nested 2 + + more + + mi + + nested 1x + + nested 2ed + + content + + + data + data + + simple + baz + one two three + + + diff --git a/xsd-tests/cxx/tree/any-type/test.xml b/xsd-tests/cxx/tree/any-type/test.xml new file mode 100644 index 0000000..7c9035a --- /dev/null +++ b/xsd-tests/cxx/tree/any-type/test.xml @@ -0,0 +1,26 @@ + + + + + any + any + + + nested 1 + nested 2 + + more + + minested 1xnested 2edcontent + + + simple + + one two three + + diff --git a/xsd-tests/cxx/tree/any-type/test.xsd b/xsd-tests/cxx/tree/any-type/test.xsd new file mode 100644 index 0000000..37dcc8d --- /dev/null +++ b/xsd-tests/cxx/tree/any-type/test.xsd @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/binary/cdr/buildfile b/xsd-tests/cxx/tree/binary/cdr/buildfile new file mode 100644 index 0000000..7a1c5b4 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/cdr/buildfile @@ -0,0 +1,25 @@ +# file : cxx/tree/binary/cdr/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} +import libs += libace%lib{ACE} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-insertion 'ACE_OutputCDR' \ + --generate-extraction 'ACE_InputCDR' \ + --generate-comparison \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/binary/cdr/driver.cxx b/xsd-tests/cxx/tree/binary/cdr/driver.cxx new file mode 100644 index 0000000..fe74bb5 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/cdr/driver.cxx @@ -0,0 +1,143 @@ +// file : tests/cxx/tree/binary/cdr/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test non-polymorphic binary serialization to ACE CDR. +// + +#include // std::auto_ptr/unique_ptr +#include +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + // Save to a CDR stream. + // + ACE_OutputCDR ace_ocdr; + xml_schema::ostream ocdr (ace_ocdr); + ocdr << *r; + + // Load from a CDR stream. + // + ACE_InputCDR ace_icdr (ace_ocdr); + xml_schema::istream icdr (ace_icdr); + XSD_AUTO_PTR c (new type (icdr)); + + // Compare the two. + // + assert (r->list () == c->list ()); + assert (r->union_ () == c->union_ ()); + assert (r->enumeration () == c->enumeration ()); + + type::complex_sequence rs (r->complex ()), cs (c->complex ()); + + for (type::complex_iterator ri (rs.begin ()), ci (cs.begin ()); + ri != rs.end () && ci != rs.end (); ++ri, ++ci) + { + assert (ri->a () == ci->a ()); + if (ri->b ()) + assert (ri->b () == ci->b ()); + assert (ri->c () == ci->c ()); + + assert (ri->x () == ci->x ()); + if (ri->y ()) + assert (ri->y () == ci->y ()); + } + + // integers + // + assert (r->byte () == c->byte ()); + assert (r->unsigned_byte () == c->unsigned_byte ()); + assert (r->short_ () == c->short_ ()); + assert (r->unsigned_short () == c->unsigned_short ()); + assert (r->int_ () == c->int_ ()); + assert (r->unsigned_int () == c->unsigned_int ()); + assert (r->long_ () == c->long_ ()); + assert (r->unsigned_long () == c->unsigned_long ()); + assert (r->integer () == c->integer ()); + assert (r->non_positive_integer () == c->non_positive_integer ()); + assert (r->non_negative_integer () == c->non_negative_integer ()); + assert (r->positive_integer () == c->positive_integer ()); + assert (r->negative_integer () == c->negative_integer ()); + + // boolean + // + assert (r->boolean () == c->boolean ()); + + // floats + // + assert (r->float_ () == c->float_ ()); + assert (r->double_ () == c->double_ ()); + assert (r->decimal () == c->decimal ()); + + // strings + // + assert (r->string () == c->string ()); + assert (r->normalized_string () == c->normalized_string ()); + assert (r->token () == c->token ()); + assert (r->name () == c->name ()); + assert (r->name_token () == c->name_token ()); + assert (r->name_tokens () == c->name_tokens ()); + assert (r->ncname () == c->ncname ()); + assert (r->language () == c->language ()); + + // qualified name + // + assert (r->qname () == c->qname ()); + + // ID/IDREF + // + assert (r->id () == c->id ()); + assert (r->id_ref () == c->id_ref ()); + assert (r->id_refs () == c->id_refs ()); + + // URI + // + assert (r->any_uri () == c->any_uri ()); + + // binary + // + assert (r->base64_binary () == c->base64_binary ()); + assert (r->hex_binary () == c->hex_binary ()); + + // date/time + // + assert (r->day () == c->day ()); + assert (r->month () == c->month ()); + assert (r->year () == c->year ()); + assert (r->month_day () == c->month_day ()); + assert (r->year_month () == c->year_month ()); + assert (r->date () == c->date ()); + assert (r->time () == c->time ()); + assert (r->date_time () == c->date_time ()); + assert (r->duration () == c->duration ()); + + // anySimpleType + // + assert (!r->any_simple_type_attr ().text_content ().empty ()); + assert (r->any_simple_type_attr () == c->any_simple_type_attr ()); + + assert (!r->any_simple_type ().text_content ().empty ()); + assert (r->any_simple_type () == c->any_simple_type ()); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/binary/cdr/test.xml b/xsd-tests/cxx/tree/binary/cdr/test.xml new file mode 100644 index 0000000..5cedd98 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/cdr/test.xml @@ -0,0 +1,93 @@ + + + 1 2 3 + + abc + + left + + + aaa + + + aaa + bbb + c + cc + ccc + + + + + 65 + 66 + -222 + 57005 + -57005 + 3735928559 + -3735928559 + 16045690984833335023 + -3735928559 + -3735928559 + 3735928559 + 3735928559 + -3735928559 + + + + true + + + + 1234.1234 + 12345678.12345678 + 1234567812345678.1234567812345678 + + + + string + normalized string + one two three + name + name-token + name tokens + ncname + en-us + + + xsi:schemaLocation + + + + elements1 + elements2 + elements1 + elements1 elements2 + + + + http://www.codesynthesis.com + + + + YmFzZTY0IGJpbmFyeQ== + 6865782052696E617279 + + + + 2001-10-26+02:00 + 2001-10-26T21:32:52+02:00 + P1Y2M3DT5H20M30S + ---01+02:00 + --11+02:00 + --11-02+02:00 + 2001+02:00 + 2001-11+02:00 + + + any simple content in element + + diff --git a/xsd-tests/cxx/tree/binary/cdr/test.xsd b/xsd-tests/cxx/tree/binary/cdr/test.xsd new file mode 100644 index 0000000..0629e94 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/cdr/test.xsd @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/binary/polymorphic/buildfile b/xsd-tests/cxx/tree/binary/polymorphic/buildfile new file mode 100644 index 0000000..d34ef27 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/polymorphic/buildfile @@ -0,0 +1,27 @@ +# file : cxx/tree/binary/polymorphic/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} +import libs += libace%lib{ACE} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-polymorphic \ + --root-element-last \ + --generate-insertion 'ACE_OutputCDR' \ + --generate-extraction 'ACE_InputCDR' \ + --generate-comparison \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/binary/polymorphic/driver.cxx b/xsd-tests/cxx/tree/binary/polymorphic/driver.cxx new file mode 100644 index 0000000..15ebf17 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/polymorphic/driver.cxx @@ -0,0 +1,164 @@ +// file : tests/cxx/tree/binary/polymorphic/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test polymorphic binary serialization. +// + +#include // std::auto_ptr/unique_ptr +#include +#include +#include + +#include // ACE_HEX_DUMP + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + // Save to a CDR stream. + // + ACE_OutputCDR ace_ocdr; + xml_schema::ostream ocdr (ace_ocdr); + ocdr << *r; + + /* + // Print the binary representation. + // + cerr << "binary representation size: " << ace_ocdr.total_length () << endl; + + for (const ACE_Message_Block* mb = ace_ocdr.begin (); + mb != 0; + mb = mb->cont ()) + { + ACE_HEX_DUMP ((LM_DEBUG, mb->rd_ptr (), mb->length ())); + } + */ + + // Load from a CDR stream. + // + ACE_InputCDR ace_icdr (ace_ocdr); + xml_schema::istream icdr (ace_icdr); + XSD_AUTO_PTR c (new type (icdr)); + + // Compare the two. + // + assert (r->list () == c->list ()); + assert (r->union_ () == c->union_ ()); + assert (r->enumeration () == c->enumeration ()); + + { + complex& rc (dynamic_cast (r->base ())); + complex& cc (dynamic_cast (c->base ())); + + assert (rc.a () == cc.a ()); + if (rc.b ()) + assert (rc.b () == cc.b ()); + assert (rc.c () == cc.c ()); + + assert (rc.x () == cc.x ()); + if (rc.y ()) + assert (rc.y () == cc.y ()); + } + + { + complex& rc (dynamic_cast (r->sbase ())); + complex& cc (dynamic_cast (c->sbase ())); + + assert (rc.a () == cc.a ()); + if (rc.b ()) + assert (rc.b () == cc.b ()); + assert (rc.c () == cc.c ()); + + assert (rc.x () == cc.x ()); + if (rc.y ()) + assert (rc.y () == cc.y ()); + } + + // integers + // + assert (r->byte () == c->byte ()); + assert (r->unsigned_byte () == c->unsigned_byte ()); + assert (r->short_ () == c->short_ ()); + assert (r->unsigned_short () == c->unsigned_short ()); + assert (r->int_ () == c->int_ ()); + assert (r->unsigned_int () == c->unsigned_int ()); + assert (r->long_ () == c->long_ ()); + assert (r->unsigned_long () == c->unsigned_long ()); + assert (r->integer () == c->integer ()); + assert (r->non_positive_integer () == c->non_positive_integer ()); + assert (r->non_negative_integer () == c->non_negative_integer ()); + assert (r->positive_integer () == c->positive_integer ()); + assert (r->negative_integer () == c->negative_integer ()); + + // boolean + // + assert (r->boolean () == c->boolean ()); + + // floats + // + assert (r->float_ () == c->float_ ()); + assert (r->double_ () == c->double_ ()); + assert (r->decimal () == c->decimal ()); + + // strings + // + assert (r->string () == c->string ()); + assert (r->normalized_string () == c->normalized_string ()); + assert (r->token () == c->token ()); + assert (r->name () == c->name ()); + assert (r->name_token () == c->name_token ()); + assert (r->name_tokens () == c->name_tokens ()); + assert (r->ncname () == c->ncname ()); + assert (r->language () == c->language ()); + + // qualified name + // + assert (r->qname () == c->qname ()); + + // ID/IDREF + // + assert (r->id () == c->id ()); + assert (r->id_ref () == c->id_ref ()); + assert (r->id_refs () == c->id_refs ()); + + // URI + // + assert (r->any_uri () == c->any_uri ()); + + // binary + // + assert (r->base64_binary () == c->base64_binary ()); + assert (r->hex_binary () == c->hex_binary ()); + + // date/time + // + assert (r->date () == c->date ()); + assert (r->date_time () == c->date_time ()); + assert (r->duration () == c->duration ()); + assert (r->day () == c->day ()); + assert (r->month () == c->month ()); + assert (r->month_day () == c->month_day ()); + assert (r->year () == c->year ()); + assert (r->year_month () == c->year_month ()); + assert (r->time () == c->time ()); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/binary/polymorphic/test.xml b/xsd-tests/cxx/tree/binary/polymorphic/test.xml new file mode 100644 index 0000000..ad3a403 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/polymorphic/test.xml @@ -0,0 +1,92 @@ + + + 1 2 3 + + abc + + left + + + aaa + + + + aaa + bbb + c + cc + ccc + + + + + 65 + 66 + -222 + 57005 + -57005 + 3735928559 + -3735928559 + 16045690984833335023 + -3735928559 + -3735928559 + 3735928559 + 3735928559 + -3735928559 + + + + true + + + + 1234.1234 + 12345678.12345678 + 1234567812345678.1234567812345678 + + + + string + normalized string + one two three + name + name-token + name tokens + ncname + en-us + + + xsi:schemaLocation + + + + elements1 + elements2 + elements1 + elements1 elements2 + + + + http://www.codesynthesis.com + + + + YmFzZTY0IGJpbmFyeQ== + 6865782052696E617279 + + + + 2001-10-26+02:00 + 2001-10-26T21:32:52+02:00 + P1Y2M3DT5H20M30S + ---01+02:00 + --11+02:00 + --11-02+02:00 + 2001+02:00 + 2001-11+02:00 + + + + diff --git a/xsd-tests/cxx/tree/binary/polymorphic/test.xsd b/xsd-tests/cxx/tree/binary/polymorphic/test.xsd new file mode 100644 index 0000000..8c214e5 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/polymorphic/test.xsd @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/binary/xdr-ordered/buildfile b/xsd-tests/cxx/tree/binary/xdr-ordered/buildfile new file mode 100644 index 0000000..09414c7 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/xdr-ordered/buildfile @@ -0,0 +1,28 @@ +# file : cxx/tree/binary/xdr-ordered/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +if ($cxx.target.class == 'linux') + import libs += libtirpc%lib{tirpc} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-insertion 'XDR' \ + --generate-extraction 'XDR' \ + --generate-comparison \ + --ordered-type-all \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/binary/xdr-ordered/driver.cxx b/xsd-tests/cxx/tree/binary/xdr-ordered/driver.cxx new file mode 100644 index 0000000..d61a645 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/xdr-ordered/driver.cxx @@ -0,0 +1,206 @@ +// file : tests/cxx/tree/binary/xdr-ordered/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test non-polymorphic ordered binary serialization to XDR. +// +// Note: just a copy of xdr test with --ordered-type-all option. +// + +#include // std::auto_ptr/unique_ptr +#include // std::memcpy +#include +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +extern "C" int +overflow (void* p, char* buf, int in) +{ + xml_schema::buffer* dst (reinterpret_cast (p)); + + size_t n (static_cast (in)), size (dst->size ()); + dst->size (size + n); + memcpy (dst->data () + size, buf, n); + + return static_cast (n); +} + +struct underflow_info +{ + xml_schema::buffer* buf; + std::size_t pos; +}; + +extern "C" int +underflow (void* p, char* buf, int in) +{ + underflow_info* ui (reinterpret_cast (p)); + + size_t n (static_cast (in)), size (ui->buf->size () - ui->pos); + n = size > n ? n : size; + + memcpy (buf, ui->buf->data () + ui->pos, n); + ui->pos += n; + + return static_cast (n); +} + +// The xdrrec_create function (used below) has slightly different +// prototypes on different platforms. To make this test portable +// we will need to cast the actual function to the following common +// prototype. +// +extern "C" +typedef void (*xdrrec_create_p) ( + XDR*, + unsigned int write_size, + unsigned int read_size, + void* user_data, + int (*read) (void* user_data, char* buf, int n), + int (*write) (void* user_data, char* buf, int n)); + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + xdrrec_create_p xdrrec_create_ = + reinterpret_cast (::xdrrec_create); + + // Save to an XDR stream. + // + XDR xdr; + xml_schema::buffer buf; + xdrrec_create_ (&xdr, 0, 0, reinterpret_cast (&buf), 0, &overflow); + xdr.x_op = XDR_ENCODE; + xsd::cxx::tree::ostream oxdr (xdr); + oxdr << *r; + xdrrec_endofrecord (&xdr, true); // flush the data + xdr_destroy (&xdr); + + // Load from an XDR stream. + // + underflow_info ui; + ui.buf = &buf; + ui.pos = 0; + xdrrec_create_ (&xdr, 0, 0, reinterpret_cast (&ui), &underflow, 0); + xdr.x_op = XDR_DECODE; + xdrrec_skiprecord (&xdr); + xsd::cxx::tree::istream ixdr (xdr); + XSD_AUTO_PTR c (new type (ixdr)); + xdr_destroy (&xdr); + + // Compare the two. + // + assert (r->list () == c->list ()); + assert (r->union_ () == c->union_ ()); + assert (r->enumeration () == c->enumeration ()); + + type::complex_sequence rs (r->complex ()), cs (c->complex ()); + + for (type::complex_iterator ri (rs.begin ()), ci (cs.begin ()); + ri != rs.end () && ci != rs.end (); ++ri, ++ci) + { + assert (ri->a () == ci->a ()); + if (ri->b ()) + assert (ri->b () == ci->b ()); + assert (ri->c () == ci->c ()); + + assert (ri->x () == ci->x ()); + if (ri->y ()) + assert (ri->y () == ci->y ()); + } + + // integers + // + assert (r->byte () == c->byte ()); + assert (r->unsigned_byte () == c->unsigned_byte ()); + assert (r->short_ () == c->short_ ()); + assert (r->unsigned_short () == c->unsigned_short ()); + assert (r->int_ () == c->int_ ()); + assert (r->unsigned_int () == c->unsigned_int ()); + assert (r->long_ () == c->long_ ()); + assert (r->unsigned_long () == c->unsigned_long ()); + assert (r->integer () == c->integer ()); + assert (r->non_positive_integer () == c->non_positive_integer ()); + assert (r->non_negative_integer () == c->non_negative_integer ()); + assert (r->positive_integer () == c->positive_integer ()); + assert (r->negative_integer () == c->negative_integer ()); + + // boolean + // + assert (r->boolean () == c->boolean ()); + + // floats + // + assert (r->float_ () == c->float_ ()); + assert (r->double_ () == c->double_ ()); + assert (r->decimal () == c->decimal ()); + + // strings + // + assert (r->string () == c->string ()); + assert (r->normalized_string () == c->normalized_string ()); + assert (r->token () == c->token ()); + assert (r->name () == c->name ()); + assert (r->name_token () == c->name_token ()); + assert (r->name_tokens () == c->name_tokens ()); + assert (r->ncname () == c->ncname ()); + assert (r->language () == c->language ()); + + // qualified name + // + assert (r->qname () == c->qname ()); + + // ID/IDREF + // + assert (r->id () == c->id ()); + assert (r->id_ref () == c->id_ref ()); + assert (r->id_refs () == c->id_refs ()); + + // URI + // + assert (r->any_uri () == c->any_uri ()); + + // binary + // + assert (r->base64_binary () == c->base64_binary ()); + assert (r->hex_binary () == c->hex_binary ()); + + // date/time + // + assert (r->date () == c->date ()); + assert (r->date_time () == c->date_time ()); + assert (r->duration () == c->duration ()); + assert (r->day () == c->day ()); + assert (r->month () == c->month ()); + assert (r->month_day () == c->month_day ()); + assert (r->year () == c->year ()); + assert (r->year_month () == c->year_month ()); + assert (r->time () == c->time ()); + + // anySimpleType + // + assert (!r->any_simple_type_attr ().text_content ().empty ()); + assert (r->any_simple_type_attr () == c->any_simple_type_attr ()); + + assert (!r->any_simple_type ().text_content ().empty ()); + assert (r->any_simple_type () == c->any_simple_type ()); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/binary/xdr-ordered/test.xml b/xsd-tests/cxx/tree/binary/xdr-ordered/test.xml new file mode 100644 index 0000000..5cedd98 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/xdr-ordered/test.xml @@ -0,0 +1,93 @@ + + + 1 2 3 + + abc + + left + + + aaa + + + aaa + bbb + c + cc + ccc + + + + + 65 + 66 + -222 + 57005 + -57005 + 3735928559 + -3735928559 + 16045690984833335023 + -3735928559 + -3735928559 + 3735928559 + 3735928559 + -3735928559 + + + + true + + + + 1234.1234 + 12345678.12345678 + 1234567812345678.1234567812345678 + + + + string + normalized string + one two three + name + name-token + name tokens + ncname + en-us + + + xsi:schemaLocation + + + + elements1 + elements2 + elements1 + elements1 elements2 + + + + http://www.codesynthesis.com + + + + YmFzZTY0IGJpbmFyeQ== + 6865782052696E617279 + + + + 2001-10-26+02:00 + 2001-10-26T21:32:52+02:00 + P1Y2M3DT5H20M30S + ---01+02:00 + --11+02:00 + --11-02+02:00 + 2001+02:00 + 2001-11+02:00 + + + any simple content in element + + diff --git a/xsd-tests/cxx/tree/binary/xdr-ordered/test.xsd b/xsd-tests/cxx/tree/binary/xdr-ordered/test.xsd new file mode 100644 index 0000000..0629e94 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/xdr-ordered/test.xsd @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/binary/xdr/buildfile b/xsd-tests/cxx/tree/binary/xdr/buildfile new file mode 100644 index 0000000..b8fc2f4 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/xdr/buildfile @@ -0,0 +1,27 @@ +# file : cxx/tree/binary/xdr/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +if ($cxx.target.class == 'linux') + import libs += libtirpc%lib{tirpc} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-insertion 'XDR' \ + --generate-extraction 'XDR' \ + --generate-comparison \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/binary/xdr/driver.cxx b/xsd-tests/cxx/tree/binary/xdr/driver.cxx new file mode 100644 index 0000000..04606ea --- /dev/null +++ b/xsd-tests/cxx/tree/binary/xdr/driver.cxx @@ -0,0 +1,204 @@ +// file : tests/cxx/tree/binary/xdr/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test non-polymorphic binary serialization to XDR. +// + +#include // std::auto_ptr/unique_ptr +#include // std::memcpy +#include +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +extern "C" int +overflow (void* p, char* buf, int in) +{ + xml_schema::buffer* dst (reinterpret_cast (p)); + + size_t n (static_cast (in)), size (dst->size ()); + dst->size (size + n); + memcpy (dst->data () + size, buf, n); + + return static_cast (n); +} + +struct underflow_info +{ + xml_schema::buffer* buf; + std::size_t pos; +}; + +extern "C" int +underflow (void* p, char* buf, int in) +{ + underflow_info* ui (reinterpret_cast (p)); + + size_t n (static_cast (in)), size (ui->buf->size () - ui->pos); + n = size > n ? n : size; + + memcpy (buf, ui->buf->data () + ui->pos, n); + ui->pos += n; + + return static_cast (n); +} + +// The xdrrec_create function (used below) has slightly different +// prototypes on different platforms. To make this test portable +// we will need to cast the actual function to the following common +// prototype. +// +extern "C" +typedef void (*xdrrec_create_p) ( + XDR*, + unsigned int write_size, + unsigned int read_size, + void* user_data, + int (*read) (void* user_data, char* buf, int n), + int (*write) (void* user_data, char* buf, int n)); + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + xdrrec_create_p xdrrec_create_ = + reinterpret_cast (::xdrrec_create); + + // Save to an XDR stream. + // + XDR xdr; + xml_schema::buffer buf; + xdrrec_create_ (&xdr, 0, 0, reinterpret_cast (&buf), 0, &overflow); + xdr.x_op = XDR_ENCODE; + xsd::cxx::tree::ostream oxdr (xdr); + oxdr << *r; + xdrrec_endofrecord (&xdr, true); // flush the data + xdr_destroy (&xdr); + + // Load from an XDR stream. + // + underflow_info ui; + ui.buf = &buf; + ui.pos = 0; + xdrrec_create_ (&xdr, 0, 0, reinterpret_cast (&ui), &underflow, 0); + xdr.x_op = XDR_DECODE; + xdrrec_skiprecord (&xdr); + xsd::cxx::tree::istream ixdr (xdr); + XSD_AUTO_PTR c (new type (ixdr)); + xdr_destroy (&xdr); + + // Compare the two. + // + assert (r->list () == c->list ()); + assert (r->union_ () == c->union_ ()); + assert (r->enumeration () == c->enumeration ()); + + type::complex_sequence rs (r->complex ()), cs (c->complex ()); + + for (type::complex_iterator ri (rs.begin ()), ci (cs.begin ()); + ri != rs.end () && ci != rs.end (); ++ri, ++ci) + { + assert (ri->a () == ci->a ()); + if (ri->b ()) + assert (ri->b () == ci->b ()); + assert (ri->c () == ci->c ()); + + assert (ri->x () == ci->x ()); + if (ri->y ()) + assert (ri->y () == ci->y ()); + } + + // integers + // + assert (r->byte () == c->byte ()); + assert (r->unsigned_byte () == c->unsigned_byte ()); + assert (r->short_ () == c->short_ ()); + assert (r->unsigned_short () == c->unsigned_short ()); + assert (r->int_ () == c->int_ ()); + assert (r->unsigned_int () == c->unsigned_int ()); + assert (r->long_ () == c->long_ ()); + assert (r->unsigned_long () == c->unsigned_long ()); + assert (r->integer () == c->integer ()); + assert (r->non_positive_integer () == c->non_positive_integer ()); + assert (r->non_negative_integer () == c->non_negative_integer ()); + assert (r->positive_integer () == c->positive_integer ()); + assert (r->negative_integer () == c->negative_integer ()); + + // boolean + // + assert (r->boolean () == c->boolean ()); + + // floats + // + assert (r->float_ () == c->float_ ()); + assert (r->double_ () == c->double_ ()); + assert (r->decimal () == c->decimal ()); + + // strings + // + assert (r->string () == c->string ()); + assert (r->normalized_string () == c->normalized_string ()); + assert (r->token () == c->token ()); + assert (r->name () == c->name ()); + assert (r->name_token () == c->name_token ()); + assert (r->name_tokens () == c->name_tokens ()); + assert (r->ncname () == c->ncname ()); + assert (r->language () == c->language ()); + + // qualified name + // + assert (r->qname () == c->qname ()); + + // ID/IDREF + // + assert (r->id () == c->id ()); + assert (r->id_ref () == c->id_ref ()); + assert (r->id_refs () == c->id_refs ()); + + // URI + // + assert (r->any_uri () == c->any_uri ()); + + // binary + // + assert (r->base64_binary () == c->base64_binary ()); + assert (r->hex_binary () == c->hex_binary ()); + + // date/time + // + assert (r->date () == c->date ()); + assert (r->date_time () == c->date_time ()); + assert (r->duration () == c->duration ()); + assert (r->day () == c->day ()); + assert (r->month () == c->month ()); + assert (r->month_day () == c->month_day ()); + assert (r->year () == c->year ()); + assert (r->year_month () == c->year_month ()); + assert (r->time () == c->time ()); + + // anySimpleType + // + assert (!r->any_simple_type_attr ().text_content ().empty ()); + assert (r->any_simple_type_attr () == c->any_simple_type_attr ()); + + assert (!r->any_simple_type ().text_content ().empty ()); + assert (r->any_simple_type () == c->any_simple_type ()); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/binary/xdr/test.xml b/xsd-tests/cxx/tree/binary/xdr/test.xml new file mode 100644 index 0000000..5cedd98 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/xdr/test.xml @@ -0,0 +1,93 @@ + + + 1 2 3 + + abc + + left + + + aaa + + + aaa + bbb + c + cc + ccc + + + + + 65 + 66 + -222 + 57005 + -57005 + 3735928559 + -3735928559 + 16045690984833335023 + -3735928559 + -3735928559 + 3735928559 + 3735928559 + -3735928559 + + + + true + + + + 1234.1234 + 12345678.12345678 + 1234567812345678.1234567812345678 + + + + string + normalized string + one two three + name + name-token + name tokens + ncname + en-us + + + xsi:schemaLocation + + + + elements1 + elements2 + elements1 + elements1 elements2 + + + + http://www.codesynthesis.com + + + + YmFzZTY0IGJpbmFyeQ== + 6865782052696E617279 + + + + 2001-10-26+02:00 + 2001-10-26T21:32:52+02:00 + P1Y2M3DT5H20M30S + ---01+02:00 + --11+02:00 + --11-02+02:00 + 2001+02:00 + 2001-11+02:00 + + + any simple content in element + + diff --git a/xsd-tests/cxx/tree/binary/xdr/test.xsd b/xsd-tests/cxx/tree/binary/xdr/test.xsd new file mode 100644 index 0000000..0629e94 --- /dev/null +++ b/xsd-tests/cxx/tree/binary/xdr/test.xsd @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/buildfile b/xsd-tests/cxx/tree/buildfile new file mode 100644 index 0000000..cfaf0bd --- /dev/null +++ b/xsd-tests/cxx/tree/buildfile @@ -0,0 +1,6 @@ +# file : cxx/tree/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +# Exclude tests which depend on not yet packaged libraries. +# +./: {*/ -binary/} diff --git a/xsd-tests/cxx/tree/built-in/.gitignore b/xsd-tests/cxx/tree/built-in/.gitignore new file mode 100644 index 0000000..f86b7a2 --- /dev/null +++ b/xsd-tests/cxx/tree/built-in/.gitignore @@ -0,0 +1 @@ +types.?xx diff --git a/xsd-tests/cxx/tree/built-in/buildfile b/xsd-tests/cxx/tree/built-in/buildfile new file mode 100644 index 0000000..8ee8585 --- /dev/null +++ b/xsd-tests/cxx/tree/built-in/buildfile @@ -0,0 +1,25 @@ +# file : cxx/tree/build-in/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -types} {hxx ixx cxx}{types} $libs testscript + +<{hxx ixx cxx}{types}>: xsd{types} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-ostream \ + --generate-serialization \ + --char-type char \ + --generate-default-ctor \ + --generate-from-base-ctor \ + --root-element-all \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/built-in/driver.cxx b/xsd-tests/cxx/tree/built-in/driver.cxx new file mode 100644 index 0000000..4141290 --- /dev/null +++ b/xsd-tests/cxx/tree/built-in/driver.cxx @@ -0,0 +1,93 @@ +// file : cxx/tree/built-in/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test built-in type mapping. +// + +#include // std::auto_ptr/unique_ptr +#include +#include + + +#include "types.hxx" + +using std::cerr; +using std::endl; + +int +main (int argc, char* argv[]) +{ + if (argc != 4) + { + cerr << "usage: " << argv[0] << " elements.xml attributes.xml inherited.xml" << endl; + return 1; + } + + XSD_AUTO_PTR elements ( + xmlns::test::elements (argv[1])); + + XSD_AUTO_PTR attributes ( + xmlns::test::attributes (argv[2])); + + XSD_AUTO_PTR inherited ( + xmlns::test::inherited (argv[3])); + + cerr << "elements:" << *elements << endl + << endl + << "attributes:" << *attributes << endl + << endl + << "inherited:" << *inherited << endl; + + // Test parsing/serialization. + // + + xml_schema::namespace_infomap map; + + map["test"].name = "http://www.codesynthesis.com/xmlns/test"; + map["test"].schema = "types.xsd"; + + { + std::ostringstream ostr; + xmlns::test::elements (ostr, *elements, map); + + std::istringstream istr (ostr.str ()); + XSD_AUTO_PTR elements1 ( + xmlns::test::elements (istr)); + + std::ostringstream ostr1; + xmlns::test::elements (ostr1, *elements1, map); + + if (ostr.str () != ostr1.str ()) + return 1; + } + + { + std::ostringstream ostr; + xmlns::test::attributes (ostr, *attributes, map); + + std::istringstream istr (ostr.str ()); + XSD_AUTO_PTR attributes1 ( + xmlns::test::attributes (istr)); + + std::ostringstream ostr1; + xmlns::test::attributes (ostr1, *attributes1, map); + + if (ostr.str () != ostr1.str ()) + return 1; + } + + { + std::ostringstream ostr; + xmlns::test::inherited (ostr, *inherited, map); + + std::istringstream istr (ostr.str ()); + XSD_AUTO_PTR inherited1 ( + xmlns::test::inherited (istr)); + + std::ostringstream ostr1; + xmlns::test::inherited (ostr1, *inherited1, map); + + if (ostr.str () != ostr1.str ()) + return 1; + } +} diff --git a/xsd-tests/cxx/tree/built-in/testscript b/xsd-tests/cxx/tree/built-in/testscript new file mode 100644 index 0000000..4dae039 --- /dev/null +++ b/xsd-tests/cxx/tree/built-in/testscript @@ -0,0 +1,394 @@ +# file : cxx/tree/any-type/testscript +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +: types +: +{ + cat <=elements.xml; + + + + + 65 + 66 + -222 + 57005 + -57005 + 3735928559 + -3735928559 + 16045690984833335023 + -3735928559 + -3735928559 + 3735928559 + 3735928559 + -3735928559 + + + + true + + + + 1234.1234 + 12345678.12345678 + 12345678.12345678 + + + + string + normalized + string + + one + two three + name + name-token + name tokens + ncname + en-us + + + xsi:schemaLocation + + + + elements1 + elements2 + elements1 + elements1 elements2 + + + + http://www.codesynthesis.com + + + + YmFzZTY0IGJpbmFyeQ== + 6865782052696E617279 + + + + 2001-10-26+02:00 + 2001-10-26T21:32:52+02:00 + P1Y2M3DT5H20M30S + ---01+02:00 + --11+02:00 + --11-02+02:00 + 2001+02:00 + 2001-11+02:00 + + + + + + + + EOI + + cat <=attributes.xml; + + + EOI + + cat <=inherited.xml; + + + + + 65 + 66 + -222 + 57005 + -57005 + 3735928559 + -3735928559 + 16045690984833335023 + -3735928559 + -3735928559 + 3735928559 + 3735928559 + -3735928559 + + + + true + + + + 1234.1234 + 12345678.12345678 + 12345678.12345678 + + + + string + normalized + string + + one + two three + name + name-token + name tokens + ncname + en-us + + + xsi:schemaLocation + + + + elements1 + elements2 + elements1 + elements1 elements2 + + + + http://www.codesynthesis.com + + + + YmFzZTY0IGJpbmFyeQ== + 6865782052696E617279 + + + + 2001-10-26+02:00 + 2001-10-26T21:32:52+02:00 + P1Y2M3DT5H20M30S + ---01+02:00 + --11+02:00 + --11-02+02:00 + 2001+02:00 + 2001-11+02:00 + + + + + + + + EOI + + ln -s $src_base/types.xsd ./; + + $* elements.xml attributes.xml inherited.xml 2>>EOE + elements: + byte: A + unsigned_byte: B + short: -222 + unsigned_short: 57005 + int: -57005 + unsigned_int: 3735928559 + long: -3735928559 + unsigned_long: 16045690984833335023 + integer: -3735928559 + non_positive_integer: -3735928559 + non_negative_integer: 3735928559 + positive_integer: 3735928559 + negative_integer: -3735928559 + boolean: 1 + float: 1234.12 + double: 1.23457e+07 + decimal: 1.23457e+07 + string: string + normalized_string: normalized string + token: one two three + name: name + name_token: name-token + name_tokens: name tokens + ncname: ncname + language: en-us + qname: http://www.w3.org/2001/XMLSchema-instance#schemaLocation + id: elements1 + id: elements2 + id_ref: elements1 + id_refs: elements1 elements2 + any_uri: http://www.codesynthesis.com + base64_binary: YmFzZTY0IGJpbmFyeQ== + + hex_binary: 6865782052696E617279 + date: 2001-10-26+02:00 + date_time: 2001-10-26T21:32:52.000000+02:00 + duration: P1Y2M3DT5H20M30.000000S + day: 01+02:00 + month: 11+02:00 + month_day: 11-02+02:00 + year: 2001+02:00 + year_month: 2001-11+02:00 + time: 21:32:52.000000+02:00 + + attributes: + byte: A + unsigned_byte: B + short: -222 + unsigned_short: 57005 + int: -57005 + unsigned_int: 3735928559 + long: -3735928559 + unsigned_long: 16045690984833335023 + integer: -3735928559 + non_positive_integer: -3735928559 + non_negative_integer: 3735928559 + positive_integer: 3735928559 + negative_integer: -3735928559 + boolean: 0 + float: 1234.12 + double: 1.23457e+07 + decimal: 1.23457e+07 + string: string + normalized_string: normalized string + token: one two three + name: name + name_token: name-token + name_tokens: name tokens + ncname: ncname + language: en-us + qname: http://www.w3.org/2001/XMLSchema-instance#schemaLocation + id: attributes + id_ref: attributes + id_refs: attributes + any_uri: http://www.codesynthesis.com + base64_binary: YmFzZTY0IGJpbmFyeQ== + + hex_binary: 6865782052696E617279 + date: 2001-10-26+02:00 + date_time: 2001-10-26T21:32:52.000000+02:00 + duration: P1Y2M3DT5H20M30.000000S + day: 01+02:00 + month: 11+02:00 + month_day: 11-02+02:00 + year: 2001+02:00 + year_month: 2001-11+02:00 + time: 21:32:52.000000+02:00 + + inherited: + byte: A + unsigned_byte: B + short: -222 + unsigned_short: 57005 + int: -57005 + unsigned_int: 3735928559 + long: -3735928559 + unsigned_long: 16045690984833335023 + integer: -3735928559 + non_positive_integer: -3735928559 + non_negative_integer: 3735928559 + positive_integer: 3735928559 + negative_integer: -3735928559 + boolean: 1 + float: 1234.12 + double: 1.23457e+07 + decimal: 1.23457e+07 + string: string + normalized_string: normalized string + token: one two three + name: name + name_token: name-token + name_tokens: name tokens + ncname: ncname + language: en-us + qname: http://www.w3.org/2001/XMLSchema-instance#schemaLocation + id: elements1 + id: elements2 + id_ref: elements1 + id_refs: elements1 elements2 + any_uri: http://www.codesynthesis.com + base64_binary: YmFzZTY0IGJpbmFyeQ== + + hex_binary: 6865782052696E617279 + date: 2001-10-26+02:00 + date_time: 2001-10-26T21:32:52.000000+02:00 + duration: P1Y2M3DT5H20M30.000000S + day: 01+02:00 + month: 11+02:00 + month_day: 11-02+02:00 + year: 2001+02:00 + year_month: 2001-11+02:00 + time: 21:32:52.000000+02:00 + EOE +} diff --git a/xsd-tests/cxx/tree/built-in/types.xsd b/xsd-tests/cxx/tree/built-in/types.xsd new file mode 100644 index 0000000..22582cb --- /dev/null +++ b/xsd-tests/cxx/tree/built-in/types.xsd @@ -0,0 +1,460 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/chameleon/.gitignore b/xsd-tests/cxx/tree/chameleon/.gitignore new file mode 100644 index 0000000..4ec7484 --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/.gitignore @@ -0,0 +1 @@ +includer.?xx diff --git a/xsd-tests/cxx/tree/chameleon/buildfile b/xsd-tests/cxx/tree/chameleon/buildfile new file mode 100644 index 0000000..cec3b01 --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/buildfile @@ -0,0 +1,24 @@ +# file : cxx/tree/chameleon/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -includer} {hxx ixx cxx}{includer} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{includer}>: xsd{includer includee} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-ostream \ + --root-element root \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/chameleon/driver.cxx b/xsd-tests/cxx/tree/chameleon/driver.cxx new file mode 100644 index 0000000..c22ca55 --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/driver.cxx @@ -0,0 +1,35 @@ +// file : cxx/tree/chameleon/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test chameleon inclusion. +// + +#include // std::auto_ptr/unique_ptr +#include + +#include "includer.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + cout << *r << endl; + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/chameleon/includee.xsd b/xsd-tests/cxx/tree/chameleon/includee.xsd new file mode 100644 index 0000000..531a7d0 --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/includee.xsd @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/chameleon/includer.xsd b/xsd-tests/cxx/tree/chameleon/includer.xsd new file mode 100644 index 0000000..a1c850a --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/includer.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/chameleon/output b/xsd-tests/cxx/tree/chameleon/output new file mode 100644 index 0000000..c40f715 --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/output @@ -0,0 +1,3 @@ + +a: a +b: b diff --git a/xsd-tests/cxx/tree/chameleon/test.xml b/xsd-tests/cxx/tree/chameleon/test.xml new file mode 100644 index 0000000..12ff279 --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/test.xml @@ -0,0 +1,8 @@ + + + a + b + + diff --git a/xsd-tests/cxx/tree/comparison/buildfile b/xsd-tests/cxx/tree/comparison/buildfile new file mode 100644 index 0000000..507a703 --- /dev/null +++ b/xsd-tests/cxx/tree/comparison/buildfile @@ -0,0 +1,22 @@ +# file : cxx/tree/comparison/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-comparison \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/comparison/driver.cxx b/xsd-tests/cxx/tree/comparison/driver.cxx new file mode 100644 index 0000000..aa7b66d --- /dev/null +++ b/xsd-tests/cxx/tree/comparison/driver.cxx @@ -0,0 +1,38 @@ +// file : cxx/tree/comparison/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test generated comparison operators. +// + +#include // std::auto_ptr/unique_ptr +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + type::complex_sequence s (r->complex ()); + + assert (s[0] == s[0]); + assert (s[0] != s[1]); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/comparison/test.xml b/xsd-tests/cxx/tree/comparison/test.xml new file mode 100644 index 0000000..b5d8158 --- /dev/null +++ b/xsd-tests/cxx/tree/comparison/test.xml @@ -0,0 +1,19 @@ + + + + 123 + abc + abc + def + + + + 123 + abc + abc + xyz + + + diff --git a/xsd-tests/cxx/tree/comparison/test.xsd b/xsd-tests/cxx/tree/comparison/test.xsd new file mode 100644 index 0000000..c234add --- /dev/null +++ b/xsd-tests/cxx/tree/comparison/test.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/compilation/buildfile b/xsd-tests/cxx/tree/compilation/buildfile new file mode 100644 index 0000000..bec2b4b --- /dev/null +++ b/xsd-tests/cxx/tree/compilation/buildfile @@ -0,0 +1,20 @@ +# file : cxx/tree/compilation/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/compilation/driver.cxx b/xsd-tests/cxx/tree/compilation/driver.cxx new file mode 100644 index 0000000..5c5ab39 --- /dev/null +++ b/xsd-tests/cxx/tree/compilation/driver.cxx @@ -0,0 +1,116 @@ +// file : cxx/tree/compilation/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Make sure the runtime library compiles by explicitly instantiating +// all the types. +// + +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +template class xsd::cxx::tree::simple_type; + +// String types. +// +template class xsd::cxx::tree::string< char, xml_schema::simple_type >; +template class xsd::cxx::tree::normalized_string< char, xml_schema::string >; +template class xsd::cxx::tree::token< char, xml_schema::normalized_string >; +template class xsd::cxx::tree::name< char, xml_schema::token >; +template class xsd::cxx::tree::nmtoken< char, xml_schema::token >; +template class xsd::cxx::tree::nmtokens< char, xml_schema::simple_type, xml_schema::nmtoken >; +template class xsd::cxx::tree::ncname< char, xml_schema::name >; +template class xsd::cxx::tree::language< char, xml_schema::token >; + +// ID/IDREF. +// +template class xsd::cxx::tree::id< char, xml_schema::ncname >; +template class xsd::cxx::tree::idref< char, xml_schema::ncname, xml_schema::type >; +template class xsd::cxx::tree::idrefs< char, xml_schema::simple_type, xml_schema::idref >; + +// URI. +// +template class xsd::cxx::tree::uri< char, xml_schema::simple_type >; + +// Qualified name. +// +template class xsd::cxx::tree::qname< char, xml_schema::simple_type, xml_schema::uri, xml_schema::ncname >; + +// Binary. +// +template class xsd::cxx::tree::buffer< char >; +template class xsd::cxx::tree::base64_binary< char, xml_schema::simple_type >; +template class xsd::cxx::tree::hex_binary< char, xml_schema::simple_type >; + +// Date/time. +// +template class xsd::cxx::tree::date< char, xml_schema::simple_type >; +template class xsd::cxx::tree::date_time< char, xml_schema::simple_type >; +template class xsd::cxx::tree::duration< char, xml_schema::simple_type >; +template class xsd::cxx::tree::gday< char, xml_schema::simple_type >; +template class xsd::cxx::tree::gmonth< char, xml_schema::simple_type >; +template class xsd::cxx::tree::gmonth_day< char, xml_schema::simple_type >; +template class xsd::cxx::tree::gyear< char, xml_schema::simple_type >; +template class xsd::cxx::tree::gyear_month< char, xml_schema::simple_type >; +template class xsd::cxx::tree::time< char, xml_schema::simple_type >; + +// Entity. +// +template class xsd::cxx::tree::entity< char, xml_schema::ncname >; +template class xsd::cxx::tree::entities< char, xml_schema::simple_type, xml_schema::entity >; + +// Namespace information and list stream. Used in +// serialization functions. +// +template class xsd::cxx::xml::dom::namespace_info < char >; +template class xsd::cxx::xml::dom::namespace_infomap < char >; +template class xsd::cxx::tree::list_stream < char >; + +// Flags and properties. +// +template class xsd::cxx::tree::properties< char >; + +// Exceptions. +// +template class xsd::cxx::tree::exception< char >; +template class xsd::cxx::tree::parsing< char >; +template class xsd::cxx::tree::expected_element< char >; +template class xsd::cxx::tree::unexpected_element< char >; +template class xsd::cxx::tree::expected_attribute< char >; +template class xsd::cxx::tree::unexpected_enumerator< char >; +template class xsd::cxx::tree::expected_text_content< char >; +template class xsd::cxx::tree::no_type_info< char >; +template class xsd::cxx::tree::not_derived< char >; +template class xsd::cxx::tree::duplicate_id< char >; +template class xsd::cxx::tree::serialization< char >; +template class xsd::cxx::tree::no_prefix_mapping< char >; +template class xsd::cxx::tree::bounds< char >; + +// Parsing/serialization diagnostics. +// +template class xsd::cxx::tree::error< char >; +template class xsd::cxx::tree::diagnostics< char >; + +// Error handler interface. +// +template class xsd::cxx::xml::error_handler< char >; + + +// +// +template class xsd::cxx::tree::fundamental_base; +template class xsd::cxx::tree::one; +template class xsd::cxx::tree::one; +template class xsd::cxx::tree::optional; +template class xsd::cxx::tree::optional; +template class xsd::cxx::tree::sequence; +template class xsd::cxx::tree::sequence; + + +int +main () +{ +} diff --git a/xsd-tests/cxx/tree/compilation/test.xsd b/xsd-tests/cxx/tree/compilation/test.xsd new file mode 100644 index 0000000..07bebc7 --- /dev/null +++ b/xsd-tests/cxx/tree/compilation/test.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/complex/ctor/buildfile b/xsd-tests/cxx/tree/complex/ctor/buildfile new file mode 100644 index 0000000..53e32b7 --- /dev/null +++ b/xsd-tests/cxx/tree/complex/ctor/buildfile @@ -0,0 +1,25 @@ +# file : cxx/tree/complex/ctor/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-default-ctor \ + --generate-from-base-ctor \ + --generate-doxygen \ + --generate-polymorphic \ + --polymorphic-type-all \ + --generate-comparison \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/complex/ctor/driver.cxx b/xsd-tests/cxx/tree/complex/ctor/driver.cxx new file mode 100644 index 0000000..7beaa93 --- /dev/null +++ b/xsd-tests/cxx/tree/complex/ctor/driver.cxx @@ -0,0 +1,122 @@ +// file : cxx/tree/complex/ctor/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test generation of varous complex type constructors. +// + +#include +#include + +#include "test.hxx" + +#ifdef XSD_CXX11 +# include // std::move +# define XSD_MOVE(x) std::move(x) +#else +# define XSD_MOVE(x) x +#endif + +using namespace std; +using namespace test; + +int +main () +{ + // Test case A. + // + { + a_base b1; + a_base b2 ("abc"); // empty ultimate base + required + a_base b3 ("abc", "foo"); // ultimate base + required + + a_derived a1; + a_derived a2 ("foo", "bar"); // empty ultimate base + required + a_derived a3 (b3, "bar"); // base + required + a_derived a4 ("abc", "foo", "bar"); // ultimate base + required + } + + // Test case B. + // + { + b_simple s ("base"); + b_base b ("base", "foo"); + b_derived d ("base", "foo", "bar"); + b_type t ("base"); + } + + // Test case C. + // + { + c_simple s (c_enum::a); + c_base b (c_enum::a, "foo"); + c_derived d (c_enum::a, "foo", "bar"); + c_type t (c_enum::a); + } + + // Test case D. + // + { + d_simple s (1); + d_base b (1, "foo"); + d_derived d (1, "foo", "bar"); + d_type t (1); + } + + // Test case E. + // + { + // e_base + // + e_base b1 (1, "foo", e_complex_type ("bar")); + + XSD_AUTO_PTR c2 (new e_complex_type ("bar")); + e_base b2 (1, "foo", XSD_MOVE (c2)); + + XSD_AUTO_PTR s3 (new e_simple_type ("foo")); + XSD_AUTO_PTR c3 (new e_complex_type ("bar")); + e_base b3 (1, XSD_MOVE (s3), XSD_MOVE (c3)); + + assert (b1 == b2); + assert (b1 == b3); + + // e_derived + // + e_derived d1 (1, "foo", e_complex_type ("bar"), + true, "baz", e_complex_type ("biz")); + + XSD_AUTO_PTR c2a (new e_complex_type ("bar")); + XSD_AUTO_PTR c2b (new e_complex_type ("biz")); + e_derived d2 (1, "foo", XSD_MOVE (c2a), true, "baz", XSD_MOVE (c2b)); + + XSD_AUTO_PTR s3a (new e_simple_type ("foo")); + XSD_AUTO_PTR s3b (new xml_schema::string ("baz")); + XSD_AUTO_PTR c3a (new e_complex_type ("bar")); + XSD_AUTO_PTR c3b (new e_complex_type ("biz")); + e_derived d3 (1, + XSD_MOVE (s3a), + XSD_MOVE (c3a), + true, + XSD_MOVE (s3b), + XSD_MOVE (c3b)); + + assert (d1 == d2); + assert (d1 == d3); + + } + + // Test case F. + // + { + f_type f1 (xml_schema::type (), 1, "foo", f_complex_type ("bar")); + + XSD_AUTO_PTR c2 (new f_complex_type ("bar")); + f_type f2 (1, "foo", XSD_MOVE (c2)); + + XSD_AUTO_PTR s3 (new f_simple_type ("foo")); + XSD_AUTO_PTR c3 (new f_complex_type ("bar")); + f_type f3 (1, XSD_MOVE (s3), XSD_MOVE (c3)); + + assert (f1 == f2); + assert (f1 == f3); + } +} diff --git a/xsd-tests/cxx/tree/complex/ctor/test.xsd b/xsd-tests/cxx/tree/complex/ctor/test.xsd new file mode 100644 index 0000000..b8dd95e --- /dev/null +++ b/xsd-tests/cxx/tree/complex/ctor/test.xsd @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/containment/buildfile b/xsd-tests/cxx/tree/containment/buildfile new file mode 100644 index 0000000..1d0272b --- /dev/null +++ b/xsd-tests/cxx/tree/containment/buildfile @@ -0,0 +1,20 @@ +# file : cxx/tree/containment/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-default-ctor \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/containment/driver.cxx b/xsd-tests/cxx/tree/containment/driver.cxx new file mode 100644 index 0000000..65c17fc --- /dev/null +++ b/xsd-tests/cxx/tree/containment/driver.cxx @@ -0,0 +1,118 @@ +// file : cxx/tree/containment/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test tree node containment. +// + +#include // std::auto_ptr/unique_ptr +#include + +#include "test.hxx" + +#ifdef XSD_CXX11 +# include // std::move +# define XSD_MOVE(x) std::move(x) +#else +# define XSD_MOVE(x) x +#endif + +using namespace std; +using namespace test; + +int +main () +{ + // Change of a container in a sub-tree without ID. + // + { + XSD_AUTO_PTR i (new inner ()); + i->ref ("foo"); + + outer o; + o.i (XSD_MOVE (i)); + o.ref ("foo"); + + assert (o.i ()->ref ()->get () == 0); + assert (o.ref ()->get () == 0); + } + + // Change of container in a sub-tree with ID inside. + // + { + XSD_AUTO_PTR i (new inner ()); + inner* p (i.get ()); + i->id ("foo"); + i->ref ("foo"); + assert (i->ref ()->get () == p); + + outer o; + o.i (XSD_MOVE (i)); + o.ref ("foo"); + + assert (o.i ()->ref ()->get () == p); + assert (o.ref ()->get () == p); + } + + // Change of a container in ID. + // + { + XSD_AUTO_PTR id (new xml_schema::id ("foo")); + + inner i; + i.id (XSD_MOVE (id)); + i.ref ("foo"); + assert (i.ref ()->get () == &i); + } + + // Change of a container in a type derived from ID with ID inside. + // + { + XSD_AUTO_PTR id (new id_ex ("foo")); + id_ex* p (id.get ()); + id->id ("bar"); + + inner i; + i.id_ex (XSD_MOVE (id)); + + i.ref ("foo"); + assert (i.ref ()->get () == &i); + + i.ref ("bar"); + assert (i.ref ()->get () == p); + } + + // IDREF lists + // + { + id i1 ("a"), i2 ("b"); + + XSD_AUTO_PTR ic (new ids); + ic->id ().push_back (i1); + ic->id ().push_back (i2); + + XSD_AUTO_PTR r1 (new xml_schema::idrefs); + r1->push_back (xml_schema::idref ("a")); + r1->push_back (xml_schema::idref ("b")); + + XSD_AUTO_PTR r2 (new idref_list); + r2->push_back (xml_schema::idref ("a")); + r2->push_back (xml_schema::idref ("b")); + + XSD_AUTO_PTR rc1 (new idrefs1); + XSD_AUTO_PTR rc2 (new idrefs2); + + rc1->idrefs (XSD_MOVE (r1)); + rc2->idrefs (XSD_MOVE (r2)); + + model m; + m.ids (XSD_MOVE (ic)); + m.idrefs1 (XSD_MOVE (rc1)); + m.idrefs2 (XSD_MOVE (rc2)); + + assert (m.idrefs1 ().idrefs ()[0].get () != 0); + assert (m.idrefs1 ().idrefs ()[1].get () != 0); + + assert (m.idrefs2 ().idrefs ()[0].get () != 0); + assert (m.idrefs2 ().idrefs ()[1].get () != 0); + } +} diff --git a/xsd-tests/cxx/tree/containment/test.xsd b/xsd-tests/cxx/tree/containment/test.xsd new file mode 100644 index 0000000..72c9379 --- /dev/null +++ b/xsd-tests/cxx/tree/containment/test.xsd @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/default/general/buildfile b/xsd-tests/cxx/tree/default/general/buildfile new file mode 100644 index 0000000..4e482ce --- /dev/null +++ b/xsd-tests/cxx/tree/default/general/buildfile @@ -0,0 +1,26 @@ +# file : cxx/tree/default/general/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --generate-ostream \ + --generate-default-ctor \ + --generate-from-base-ctor \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/default/general/driver.cxx b/xsd-tests/cxx/tree/default/general/driver.cxx new file mode 100644 index 0000000..7031636 --- /dev/null +++ b/xsd-tests/cxx/tree/default/general/driver.cxx @@ -0,0 +1,37 @@ +// file : cxx/tree/default/general/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test default attribute/element values. +// + +#include // std::auto_ptr/unique_ptr +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1], xml_schema::flags::dont_validate)); + + xml_schema::namespace_infomap map; + map["t"].name = "test"; + root (cout, *r, map); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/default/general/output b/xsd-tests/cxx/tree/default/general/output new file mode 100644 index 0000000..396a698 --- /dev/null +++ b/xsd-tests/cxx/tree/default/general/output @@ -0,0 +1,15 @@ + + + + + + + diff --git a/xsd-tests/cxx/tree/default/general/test.xml b/xsd-tests/cxx/tree/default/general/test.xml new file mode 100644 index 0000000..11bd0a7 --- /dev/null +++ b/xsd-tests/cxx/tree/default/general/test.xml @@ -0,0 +1,16 @@ + + + + + + + diff --git a/xsd-tests/cxx/tree/default/general/test.xsd b/xsd-tests/cxx/tree/default/general/test.xsd new file mode 100644 index 0000000..9d9cd38 --- /dev/null +++ b/xsd-tests/cxx/tree/default/general/test.xsd @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/default/omit/buildfile b/xsd-tests/cxx/tree/default/omit/buildfile new file mode 100644 index 0000000..407ab1e --- /dev/null +++ b/xsd-tests/cxx/tree/default/omit/buildfile @@ -0,0 +1,27 @@ +# file : cxx/tree/default/omit/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --generate-ostream \ + --generate-default-ctor \ + --generate-from-base-ctor \ + --omit-default-attributes \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/default/omit/driver.cxx b/xsd-tests/cxx/tree/default/omit/driver.cxx new file mode 100644 index 0000000..3dcc0d8 --- /dev/null +++ b/xsd-tests/cxx/tree/default/omit/driver.cxx @@ -0,0 +1,46 @@ +// file : cxx/tree/default/omit/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test default attribute omission from the output. +// + +#include // std::auto_ptr/unique_ptr +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1], xml_schema::flags::dont_validate)); + + cout << *r << endl + << "default x: " << derived::x_default_value () << endl + << "default y: " << derived::y_default_value () << endl + << "fixed p: " << derived::p_default_value () << endl + << "fixed q1: " << derived::q1_default_value () << endl + << "fixed q2: " << derived::q2_default_value () << endl; + + // Serialize. + // + xml_schema::namespace_infomap map; + map["t"].name = "test"; + root (cout, *r, map); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/default/omit/output b/xsd-tests/cxx/tree/default/omit/output new file mode 100644 index 0000000..150ad58 --- /dev/null +++ b/xsd-tests/cxx/tree/default/omit/output @@ -0,0 +1,19 @@ + +derived: +a: a +x: foo +q1: 1 +y: -20 +p: bar +q2: 2 +default x: foo +default y: -20 +fixed p: bar +fixed q1: 1 +fixed q2: 2 + + + + a + + diff --git a/xsd-tests/cxx/tree/default/omit/test.xml b/xsd-tests/cxx/tree/default/omit/test.xml new file mode 100644 index 0000000..dec39b4 --- /dev/null +++ b/xsd-tests/cxx/tree/default/omit/test.xml @@ -0,0 +1,9 @@ + + + + a + + + diff --git a/xsd-tests/cxx/tree/default/omit/test.xsd b/xsd-tests/cxx/tree/default/omit/test.xsd new file mode 100644 index 0000000..bfc68d4 --- /dev/null +++ b/xsd-tests/cxx/tree/default/omit/test.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/detach/buildfile b/xsd-tests/cxx/tree/detach/buildfile new file mode 100644 index 0000000..07f5f03 --- /dev/null +++ b/xsd-tests/cxx/tree/detach/buildfile @@ -0,0 +1,21 @@ +# file : cxx/tree/detach/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-detach \ + --generate-default-ctor \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/detach/driver.cxx b/xsd-tests/cxx/tree/detach/driver.cxx new file mode 100644 index 0000000..b632b5d --- /dev/null +++ b/xsd-tests/cxx/tree/detach/driver.cxx @@ -0,0 +1,108 @@ +// file : cxx/tree/detach/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test the detach functionality. +// + +#include // std::auto_ptr/unique_ptr +#include + +#include "test.hxx" + +#ifdef XSD_CXX11 +# include // std::move +# define XSD_MOVE(x) std::move(x) +#else +# define XSD_MOVE(x) x +#endif + +using namespace std; +using namespace test; + +int +main () +{ + using test::ref; + + // Construct the model. + // + object o1 ("o1"); + o1.data ().push_back ("1-1"); + o1.data ().push_back ("1-2"); + o1.data ().push_back ("1-3"); + + object o2 ("o2"); + o1.data ().push_back ("2-1"); + o1.data ().push_back ("2-2"); + o1.data ().push_back ("2-3"); + + object o3 ("o3"); + o1.data ().push_back ("3-1"); + o1.data ().push_back ("3-2"); + o1.data ().push_back ("3-3"); + + object o4 ("o4"); + o1.data ().push_back ("4-1"); + o1.data ().push_back ("4-2"); + o1.data ().push_back ("4-3"); + + subtree s1; + s1.o ().push_back (o1); + s1.o ().push_back (o2); + s1.r ().push_back (ref ("o2")); + s1.r ().push_back (ref ("o3")); + + subtree s2; + s2.o ().push_back (o3); + s2.o ().push_back (o4); + s2.r ().push_back (ref ("o4")); + s2.r ().push_back (ref ("o1")); + + model m; + m.one (s1); + m.opt (s2); + + // Detach one. + // + XSD_AUTO_PTR p (m.detach_one ()); + assert (p->_container () == 0); + assert (p->r ()[0].get () == &p->o ()[1]); + assert (m.opt ()->r ()[1].get () == 0); + + m.one (XSD_MOVE (p)); + assert (m.opt ()->r ()[1].get () == &m.one ().o ()[0]); + p = m.detach_one (); + + model m1; + m1.one (XSD_MOVE (p)); + m1.opt (s2); + assert (m1.opt ()->r ()[1].get () == &m1.one ().o ()[0]); + + p = m1.detach_one (); + m.seq ().push_back (XSD_MOVE (p)); + + // Detach opt. + // + p = m.opt ().detach (); + assert (!m.opt ()); + assert (p->_container () == 0); + assert (p->r ()[0].get () == &p->o ()[1]); + assert (m.seq ()[0].r ()[1].get () == 0); + + m.seq ().push_back (XSD_MOVE (p)); + + // Detach seq. + // + p = m.seq ().detach_back (); + assert (p->_container () == 0); + assert (p->r ()[0].get () == &p->o ()[1]); + assert (m.seq ()[0].r ()[1].get () == 0); + + m.seq ().push_back (XSD_MOVE (p)); + assert (m.seq ()[0].r ()[1].get () == &m.seq ()[1].o ()[0]); + + m.seq ().detach (m.seq ().begin (), p); + assert (p->_container () == 0); + assert (p->r ()[0].get () == &p->o ()[1]); + assert (m.seq ()[0].r ()[1].get () == 0); +} diff --git a/xsd-tests/cxx/tree/detach/test.xsd b/xsd-tests/cxx/tree/detach/test.xsd new file mode 100644 index 0000000..b9f5166 --- /dev/null +++ b/xsd-tests/cxx/tree/detach/test.xsd @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/dom-association/buildfile b/xsd-tests/cxx/tree/dom-association/buildfile new file mode 100644 index 0000000..85593e5 --- /dev/null +++ b/xsd-tests/cxx/tree/dom-association/buildfile @@ -0,0 +1,27 @@ +# file : cxx/tree/dom-association/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-ostream \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" + +# Define XSD_CXX11 since we include libxsd headers directly. +# +cxx.poptions += -DXSD_CXX11 diff --git a/xsd-tests/cxx/tree/dom-association/dom-parse.cxx b/xsd-tests/cxx/tree/dom-association/dom-parse.cxx new file mode 100644 index 0000000..281eb2c --- /dev/null +++ b/xsd-tests/cxx/tree/dom-association/dom-parse.cxx @@ -0,0 +1,95 @@ +// file : cxx/tree/dom-association/dom-parse.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include "dom-parse.hxx" + +#include + +#include +#include // chLatin_* +#include + +#include +#include + +#include +#include + +using namespace xercesc; +namespace xml = xsd::cxx::xml; +namespace tree = xsd::cxx::tree; + +XSD_DOM_AUTO_PTR +parse (std::istream& is, + const std::string& id, + bool validate) +{ + const XMLCh ls_id [] = {chLatin_L, chLatin_S, chNull}; + + // Get an implementation of the Load-Store (LS) interface. + // + DOMImplementation* impl ( + DOMImplementationRegistry::getDOMImplementation (ls_id)); + + XSD_DOM_AUTO_PTR parser ( + impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + + DOMConfiguration* conf (parser->getDomConfig ()); + + // Discard comment nodes in the document. + // + conf->setParameter (XMLUni::fgDOMComments, false); + + // Enable datatype normalization. + // + conf->setParameter (XMLUni::fgDOMDatatypeNormalization, true); + + // Do not create EntityReference nodes in the DOM tree. No + // EntityReference nodes will be created, only the nodes + // corresponding to their fully expanded substitution text + // will be created. + // + conf->setParameter (XMLUni::fgDOMEntities, false); + + // Perform namespace processing. + // + conf->setParameter (XMLUni::fgDOMNamespaces, true); + + // Do not include ignorable whitespace in the DOM tree. + // + conf->setParameter (XMLUni::fgDOMElementContentWhitespace, false); + + // Enable/Disable validation. + // + conf->setParameter (XMLUni::fgDOMValidate, validate); + conf->setParameter (XMLUni::fgXercesSchema, validate); + conf->setParameter (XMLUni::fgXercesSchemaFullChecking, false); + + // Xerces-C++ 3.1.0 is the first version with working multi import + // support. + // +#if _XERCES_VERSION >= 30100 + conf->setParameter (XMLUni::fgXercesHandleMultipleImports, true); +#endif + + // We will release the DOM document ourselves. + // + conf->setParameter (XMLUni::fgXercesUserAdoptsDOMDocument, true); + + // Set error handler. + // + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); + + // Prepare input stream. + // + xml::sax::std_input_source isrc (is, id); + Wrapper4InputSource wrap (&isrc, false); + + XSD_DOM_AUTO_PTR doc (parser->parse (&wrap)); + + eh.throw_if_failed > (); + + return doc; +} diff --git a/xsd-tests/cxx/tree/dom-association/dom-parse.hxx b/xsd-tests/cxx/tree/dom-association/dom-parse.hxx new file mode 100644 index 0000000..f14a53b --- /dev/null +++ b/xsd-tests/cxx/tree/dom-association/dom-parse.hxx @@ -0,0 +1,23 @@ +// file : cxx/tree/dom-association/dom-parse.hxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef DOM_PARSE +#define DOM_PARSE + +#include +#include + +#include + +#include + +// Parse an XML document from the standard input stream with an +// optional resource id. Resource id is used in diagnostics as +// well as to locate schemas referenced from inside the document. +// +XSD_DOM_AUTO_PTR +parse (std::istream& is, + const std::string& id, + bool validate); + +#endif // DOM_PARSE diff --git a/xsd-tests/cxx/tree/dom-association/driver.cxx b/xsd-tests/cxx/tree/dom-association/driver.cxx new file mode 100644 index 0000000..d85e105 --- /dev/null +++ b/xsd-tests/cxx/tree/dom-association/driver.cxx @@ -0,0 +1,71 @@ +// file : cxx/tree/dom-association/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test DOM association/ownership. +// + +#include // std::auto_ptr/unique_ptr +#include +#include + +#include + +#include "dom-parse.hxx" +#include "test.hxx" + +using namespace std; +using namespace test; +using namespace xercesc; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + int r (0); + + XMLPlatformUtils::Initialize (); + + try + { + ifstream ifs; + ifs.exceptions (ifstream::badbit | ifstream::failbit); + ifs.open (argv[1]); + + DOMDocument* ptr; + +#ifdef XSD_CXX11 + xml_schema::dom::unique_ptr doc (parse (ifs, argv[1], true)); + ptr = doc.get (); + unique_ptr r ( + root (std::move (doc), + xml_schema::flags::keep_dom | xml_schema::flags::own_dom)); +#else + xml_schema::dom::auto_ptr doc (parse (ifs, argv[1], true)); + ptr = doc.get (); + auto_ptr r ( + root (doc, + xml_schema::flags::keep_dom | xml_schema::flags::own_dom)); +#endif + + assert (doc.get () == 0); + assert (r->_node ()->getOwnerDocument () == ptr); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + r = 1; + } + catch (const std::ios_base::failure&) + { + cerr << argv[1] << ": unable to open or read failure" << endl; + r = 1; + } + + XMLPlatformUtils::Terminate (); + return r; +} diff --git a/xsd-tests/cxx/tree/dom-association/output b/xsd-tests/cxx/tree/dom-association/output new file mode 100644 index 0000000..e69de29 diff --git a/xsd-tests/cxx/tree/dom-association/test.xml b/xsd-tests/cxx/tree/dom-association/test.xml new file mode 100644 index 0000000..624a80c --- /dev/null +++ b/xsd-tests/cxx/tree/dom-association/test.xml @@ -0,0 +1,7 @@ + + + a + + diff --git a/xsd-tests/cxx/tree/dom-association/test.xsd b/xsd-tests/cxx/tree/dom-association/test.xsd new file mode 100644 index 0000000..07bebc7 --- /dev/null +++ b/xsd-tests/cxx/tree/dom-association/test.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/encoding/char/iso-8859-1/buildfile b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/buildfile new file mode 100644 index 0000000..bdea527 --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/buildfile @@ -0,0 +1,25 @@ +# file : cxx/tree/encoding/char/iso-8859-1/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --char-encoding iso8859-1 \ + --generate-doxygen \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx new file mode 100644 index 0000000..e356815 --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx @@ -0,0 +1,74 @@ +// file : cxx/tree/encoding/char/iso-8859-1/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test ISO-8859-1 encoding. +// + +#include // std::auto_ptr/unique_ptr +#include +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + try + { + root (argv[1]); + return 1; + } + catch (xsd::cxx::xml::iso8859_1_unrepresentable const&) + { + } + + xsd::cxx::xml::char_transcoder::unrep_char ('?'); + XSD_AUTO_PTR r (root (argv[1])); + + { + type::a_sequence const& s (r->a ()); + + if (s[0] != "abc" || + s[1] != "\xE6" || + s[2] != "\xA2\xA3\xA4\xA5" || + s[3] != "??") + { + cerr << "invalid encoding" << endl; + return 1; + } + } + + { + type::b_sequence const& s (r->b ()); + + if (s[0] != strenum::abc || + s[1] != strenum::a_c || + s[2] != strenum::cxx__bc) + { + cerr << "invalid encoding" << endl; + return 1; + } + } + + xml_schema::namespace_infomap map; + map["t"].name = "test"; + + root (std::cout, *r, map, "ISO-8859-1"); + } + catch (xml_schema::exception const& e) + { + cerr << "xml_schema::exception: " << e.what () << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/encoding/char/iso-8859-1/output b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/output new file mode 100644 index 0000000..cb73faa --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/output @@ -0,0 +1,10 @@ + + + abc + æ + ¢£¤¥ + ?? + abc + aâc + âòbc + diff --git a/xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xml b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xml new file mode 100644 index 0000000..cc05f8d --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xml @@ -0,0 +1,14 @@ + + + abc + æ + ¢£¤¥ + Āꪪ + + abc + aâc + âòbc + + diff --git a/xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xsd b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xsd new file mode 100644 index 0000000..31b8901 --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xsd @@ -0,0 +1,31 @@ + + + + + + + + Test enum. Valid values are: + abc + aâc + òbc + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/encoding/char/lcp/buildfile b/xsd-tests/cxx/tree/encoding/char/lcp/buildfile new file mode 100644 index 0000000..d935b09 --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/lcp/buildfile @@ -0,0 +1,24 @@ +# file : cxx/tree/encoding/char/lcp/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --char-encoding lcp \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/encoding/char/lcp/driver.cxx b/xsd-tests/cxx/tree/encoding/char/lcp/driver.cxx new file mode 100644 index 0000000..97c0875 --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/lcp/driver.cxx @@ -0,0 +1,40 @@ +// file : cxx/tree/encoding/char/lcp/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test local code page encoding (--char-encoding lcp). +// The test just makes sure it still compiles and works. +// + +#include // std::auto_ptr/unique_ptr +#include +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + xml_schema::namespace_infomap map; + map["t"].name = "test"; + + root (std::cout, *r, map); + } + catch (xml_schema::exception const& e) + { + cerr << "xml_schema::exception: " << e.what () << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/encoding/char/lcp/output b/xsd-tests/cxx/tree/encoding/char/lcp/output new file mode 100644 index 0000000..368826d --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/lcp/output @@ -0,0 +1,4 @@ + + + abcd + diff --git a/xsd-tests/cxx/tree/encoding/char/lcp/test.xml b/xsd-tests/cxx/tree/encoding/char/lcp/test.xml new file mode 100644 index 0000000..772512e --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/lcp/test.xml @@ -0,0 +1,7 @@ + + + abcd + + diff --git a/xsd-tests/cxx/tree/encoding/char/lcp/test.xsd b/xsd-tests/cxx/tree/encoding/char/lcp/test.xsd new file mode 100644 index 0000000..1e264e3 --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/lcp/test.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/encoding/char/utf-8/buildfile b/xsd-tests/cxx/tree/encoding/char/utf-8/buildfile new file mode 100644 index 0000000..4d48165 --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/utf-8/buildfile @@ -0,0 +1,24 @@ +# file : cxx/tree/encoding/char/utf-8/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --generate-doxygen \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/encoding/char/utf-8/driver.cxx b/xsd-tests/cxx/tree/encoding/char/utf-8/driver.cxx new file mode 100644 index 0000000..7892667 --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/utf-8/driver.cxx @@ -0,0 +1,63 @@ +// file : cxx/tree/encoding/char/utf-8/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test UTF-8 encoding. +// + +#include // std::auto_ptr/unique_ptr +#include +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + { + type::a_sequence const& s (r->a ()); + + if (s[0] != "abc" || + s[1] != "\xD5\x95" || + s[2] != "\xEA\xAA\xAA") + { + cerr << "invalid encoding" << endl; + return 1; + } + } + + { + type::b_sequence const& s (r->b ()); + + if (s[0] != strenum::abc || + s[1] != strenum::a_c || + s[2] != strenum::cxx_bc) + { + cerr << "invalid encoding" << endl; + return 1; + } + } + + xml_schema::namespace_infomap map; + map["t"].name = "test"; + + root (std::cout, *r, map, "ASCII"); + } + catch (xml_schema::exception const& e) + { + cerr << "xml_schema::exception: " << e.what () << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/encoding/char/utf-8/output b/xsd-tests/cxx/tree/encoding/char/utf-8/output new file mode 100644 index 0000000..fdfef4c --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/utf-8/output @@ -0,0 +1,9 @@ + + + abc + Օ + + abc + aՕc + ꪪbc + diff --git a/xsd-tests/cxx/tree/encoding/char/utf-8/test.xml b/xsd-tests/cxx/tree/encoding/char/utf-8/test.xml new file mode 100644 index 0000000..0d3e27a --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/utf-8/test.xml @@ -0,0 +1,13 @@ + + + abc + Օ + + + abc + aՕc + ꪪbc + + diff --git a/xsd-tests/cxx/tree/encoding/char/utf-8/test.xsd b/xsd-tests/cxx/tree/encoding/char/utf-8/test.xsd new file mode 100644 index 0000000..d5ee868 --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/char/utf-8/test.xsd @@ -0,0 +1,31 @@ + + + + + + + + Test enum. Valid values are: + abc + aՕc + ꪪbc + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/encoding/wchar/buildfile b/xsd-tests/cxx/tree/encoding/wchar/buildfile new file mode 100644 index 0000000..f640976 --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/wchar/buildfile @@ -0,0 +1,25 @@ +# file : cxx/tree/encoding/wchar/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --char-type wchar_t \ + --generate-doxygen \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/encoding/wchar/driver.cxx b/xsd-tests/cxx/tree/encoding/wchar/driver.cxx new file mode 100644 index 0000000..dbcbcba --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/wchar/driver.cxx @@ -0,0 +1,55 @@ +// file : cxx/tree/encoding/wchar/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test the wide character mapping. +// + +#include // std::auto_ptr/unique_ptr +#include +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + // Use dont_validate because we do not have instance's system id (path). + // + std::ifstream ifs (argv[1]); + XSD_AUTO_PTR r (root (ifs, xml_schema::flags::dont_validate)); + + { + type::b_sequence const& s (r->b ()); + + if (s[0] != strenum::abc || + s[1] != strenum::a__c || + s[2] != strenum::cxx__bc || + s[3] != strenum::ab__) + { + cerr << "invalid encoding" << endl; + return 1; + } + } + + xml_schema::namespace_infomap map; + map[L"t"].name = L"test"; + + root (std::cout, *r, map, L"ASCII"); + } + catch (xml_schema::exception const& e) + { + cerr << "xml_schema::exception: " << e.what () << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/encoding/wchar/output b/xsd-tests/cxx/tree/encoding/wchar/output new file mode 100644 index 0000000..e0eaef0 --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/wchar/output @@ -0,0 +1,10 @@ + + + abc + ῿퟿ + ကჿ + abc + a῿퟿c + ကჿbc + abကჿ + diff --git a/xsd-tests/cxx/tree/encoding/wchar/test.xml b/xsd-tests/cxx/tree/encoding/wchar/test.xml new file mode 100644 index 0000000..9abb1b6 --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/wchar/test.xml @@ -0,0 +1,14 @@ + + + abc + ῿퟿ + ကჿ + + abc + a῿퟿c + ကჿbc + abကჿ + + diff --git a/xsd-tests/cxx/tree/encoding/wchar/test.xsd b/xsd-tests/cxx/tree/encoding/wchar/test.xsd new file mode 100644 index 0000000..0151d2f --- /dev/null +++ b/xsd-tests/cxx/tree/encoding/wchar/test.xsd @@ -0,0 +1,33 @@ + + + + + + + + Test enum. Valid values are: + abc + a῿퟿c + ကჿbc + abကჿ + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/enumeration/ctor/buildfile b/xsd-tests/cxx/tree/enumeration/ctor/buildfile new file mode 100644 index 0000000..96be1ce --- /dev/null +++ b/xsd-tests/cxx/tree/enumeration/ctor/buildfile @@ -0,0 +1,22 @@ +# file : cxx/tree/enumeration/ctor/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-default-ctor \ + --generate-from-base-ctor \ + --generate-doxygen \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/enumeration/ctor/driver.cxx b/xsd-tests/cxx/tree/enumeration/ctor/driver.cxx new file mode 100644 index 0000000..c5ea1f2 --- /dev/null +++ b/xsd-tests/cxx/tree/enumeration/ctor/driver.cxx @@ -0,0 +1,30 @@ +// file : cxx/tree/enumeration/ctor/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test enumeration constructors. +// +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main () +{ + // Test ctor(const char*). + // + { + string_enum se ("a"); + type t ("a", 1); + } + + // Test ctor(const std::string&) + // + { + string const s ("c"); + string_enum se (s); + type t (s, 3); + } +} diff --git a/xsd-tests/cxx/tree/enumeration/ctor/test.xsd b/xsd-tests/cxx/tree/enumeration/ctor/test.xsd new file mode 100644 index 0000000..c5d625a --- /dev/null +++ b/xsd-tests/cxx/tree/enumeration/ctor/test.xsd @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/enumeration/inheritance/buildfile b/xsd-tests/cxx/tree/enumeration/inheritance/buildfile new file mode 100644 index 0000000..184c95c --- /dev/null +++ b/xsd-tests/cxx/tree/enumeration/inheritance/buildfile @@ -0,0 +1,23 @@ +# file : cxx/tree/enumeration/inheritance/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-ostream \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/enumeration/inheritance/driver.cxx b/xsd-tests/cxx/tree/enumeration/inheritance/driver.cxx new file mode 100644 index 0000000..b517b1f --- /dev/null +++ b/xsd-tests/cxx/tree/enumeration/inheritance/driver.cxx @@ -0,0 +1,53 @@ +// file : cxx/tree/enumeration/inheritance/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Insert test description here. +// + +#include // std::auto_ptr/unique_ptr +#include +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + switch (*r) + { + case top_bottom::top: + { + cout << "top" << endl; + break; + } + case top_bottom::bottom: + { + cout << "bottom" << endl; + break; + } + default: // Suppress warning. + { + assert (false); + break; + } + } + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/enumeration/inheritance/output b/xsd-tests/cxx/tree/enumeration/inheritance/output new file mode 100644 index 0000000..fef12e2 --- /dev/null +++ b/xsd-tests/cxx/tree/enumeration/inheritance/output @@ -0,0 +1 @@ +bottom diff --git a/xsd-tests/cxx/tree/enumeration/inheritance/test.xml b/xsd-tests/cxx/tree/enumeration/inheritance/test.xml new file mode 100644 index 0000000..1de9043 --- /dev/null +++ b/xsd-tests/cxx/tree/enumeration/inheritance/test.xml @@ -0,0 +1,3 @@ +bottom diff --git a/xsd-tests/cxx/tree/enumeration/inheritance/test.xsd b/xsd-tests/cxx/tree/enumeration/inheritance/test.xsd new file mode 100644 index 0000000..cf2eeb1 --- /dev/null +++ b/xsd-tests/cxx/tree/enumeration/inheritance/test.xsd @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/float/buildfile b/xsd-tests/cxx/tree/float/buildfile new file mode 100644 index 0000000..4872a2f --- /dev/null +++ b/xsd-tests/cxx/tree/float/buildfile @@ -0,0 +1,24 @@ +# file : cxx/tree/float/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --root-element-all \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/float/driver.cxx b/xsd-tests/cxx/tree/float/driver.cxx new file mode 100644 index 0000000..0f7455f --- /dev/null +++ b/xsd-tests/cxx/tree/float/driver.cxx @@ -0,0 +1,53 @@ +// file : cxx/tree/float/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test floating point (xsd:{float, double, decimal}) type parsing +// and serialization. +// + +#include // std::auto_ptr/unique_ptr +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + r->simple ().push_back (12.129456); + r->simple ().push_back (123.129456); + r->simple ().push_back (1234.129456); + + r->s (12.129456); + + r->complex ().push_back (12.129456); + r->complex ().push_back (123.129456); + r->complex ().push_back (1234.129456); + r->complex ().push_back (-12.12); + r->complex ().push_back (-123.12); + + r->s (12.129456); + + xml_schema::namespace_infomap map; + + map["t"].name = "test"; + root (cout, *r, map); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/float/output b/xsd-tests/cxx/tree/float/output new file mode 100644 index 0000000..399e28c --- /dev/null +++ b/xsd-tests/cxx/tree/float/output @@ -0,0 +1,35 @@ + + + 0 + 1 + 1e+06 + 1e-07 + 0 1 1e+06 1e-07 + 0 + 1 + 100000000000000 + 1e-15 + 0 1 100000000000000 1e-15 + 0 + 1 + 10000 + 100000000000000 + 0.000000000000001 + 0 1 100000000000000 0.000000000000001 + 0 + 1 + 12.34 + 0.12 + 12.13 + 123.1 + 1234 + 0 + 1 + 12.34 + 0.12 + 12.13 + 123.1 + 1234 + -12.12 + -123.1 + diff --git a/xsd-tests/cxx/tree/float/test.xml b/xsd-tests/cxx/tree/float/test.xml new file mode 100644 index 0000000..e5124a4 --- /dev/null +++ b/xsd-tests/cxx/tree/float/test.xml @@ -0,0 +1,35 @@ + + + 0.0 + 1.0 + 1000000.0 + 0.0000001 + 0.0 1.0 1000000.0 0.0000001 + + 0.0 + 1.0 + 100000000000000.0 + 0.000000000000001 + 0.0 1.0 100000000000000.0 0.000000000000001 + + 0.0 + 1.0 + 10000 + 100000000000000.0 + 0.000000000000001 + 0.0 1.0 100000000000000.0 0.000000000000001 + + 0.0 + 1.0 + 12.34 + 0.12 + + 0.0 + 1.0 + 12.34 + 0.12 + + diff --git a/xsd-tests/cxx/tree/float/test.xsd b/xsd-tests/cxx/tree/float/test.xsd new file mode 100644 index 0000000..c02678d --- /dev/null +++ b/xsd-tests/cxx/tree/float/test.xsd @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/list/ctor/buildfile b/xsd-tests/cxx/tree/list/ctor/buildfile new file mode 100644 index 0000000..2155f95 --- /dev/null +++ b/xsd-tests/cxx/tree/list/ctor/buildfile @@ -0,0 +1,22 @@ +# file : cxx/tree/list/ctor/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-default-ctor \ + --generate-from-base-ctor \ + --generate-doxygen \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/list/ctor/driver.cxx b/xsd-tests/cxx/tree/list/ctor/driver.cxx new file mode 100644 index 0000000..5673e67 --- /dev/null +++ b/xsd-tests/cxx/tree/list/ctor/driver.cxx @@ -0,0 +1,50 @@ +// file : cxx/tree/list/ctor/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test list constructors. +// +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main () +{ + // Test ctor() + // + { + string_list sl; + + xml_schema::nmtokens nt; + xml_schema::idrefs id; + } + + // Test ctor(size_type, const X&) + // + { + string_list sl (10, "abc"); + size_type st (10, 123); + + xml_schema::nmtokens nt (10, "abc"); + xml_schema::idrefs id (10, "abc"); + } + + // Test ctor(const I& begin, const I& end) + // + { + string_list sl1 (10, "abc"); + string_list sl2 (sl1.begin (), sl1.end ()); + + I i1 (10, 123); + I i2 (i1.begin (), i1.end ()); + + xml_schema::nmtokens nt1 (10, "abc"); + xml_schema::nmtokens nt2 (nt1.begin (), nt1.end ()); + + xml_schema::idrefs id1 (10, "abc"); + xml_schema::idrefs id2 (id1.begin (), id1.end ()); + } +} diff --git a/xsd-tests/cxx/tree/list/ctor/test.xsd b/xsd-tests/cxx/tree/list/ctor/test.xsd new file mode 100644 index 0000000..f090bb8 --- /dev/null +++ b/xsd-tests/cxx/tree/list/ctor/test.xsd @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/name-clash/inheritance/buildfile b/xsd-tests/cxx/tree/name-clash/inheritance/buildfile new file mode 100644 index 0000000..530c42f --- /dev/null +++ b/xsd-tests/cxx/tree/name-clash/inheritance/buildfile @@ -0,0 +1,23 @@ +# file : cxx/tree/name-clash/inheritance/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-ostream \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/name-clash/inheritance/driver.cxx b/xsd-tests/cxx/tree/name-clash/inheritance/driver.cxx new file mode 100644 index 0000000..634c56a --- /dev/null +++ b/xsd-tests/cxx/tree/name-clash/inheritance/driver.cxx @@ -0,0 +1,35 @@ +// file : cxx/tree/name-clash/inheritance/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test for name clashes across inheritance hierarchy. +// + +#include // std::auto_ptr/unique_ptr +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + cout << *r << endl; + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/name-clash/inheritance/output b/xsd-tests/cxx/tree/name-clash/inheritance/output new file mode 100644 index 0000000..54565bb --- /dev/null +++ b/xsd-tests/cxx/tree/name-clash/inheritance/output @@ -0,0 +1,3 @@ + +e: e +e: e1 diff --git a/xsd-tests/cxx/tree/name-clash/inheritance/test.xml b/xsd-tests/cxx/tree/name-clash/inheritance/test.xml new file mode 100644 index 0000000..8c17101 --- /dev/null +++ b/xsd-tests/cxx/tree/name-clash/inheritance/test.xml @@ -0,0 +1,8 @@ + + + e + e1 + + diff --git a/xsd-tests/cxx/tree/name-clash/inheritance/test.xsd b/xsd-tests/cxx/tree/name-clash/inheritance/test.xsd new file mode 100644 index 0000000..b83d7df --- /dev/null +++ b/xsd-tests/cxx/tree/name-clash/inheritance/test.xsd @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/naming/camel/buildfile b/xsd-tests/cxx/tree/naming/camel/buildfile new file mode 100644 index 0000000..8a8410c --- /dev/null +++ b/xsd-tests/cxx/tree/naming/camel/buildfile @@ -0,0 +1,25 @@ +# file : cxx/tree/naming/camel/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --type-naming ucc \ + --function-naming lcc \ + --generate-ostream \ + --generate-comparison \ + --generate-wildcard \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/naming/camel/driver.cxx b/xsd-tests/cxx/tree/naming/camel/driver.cxx new file mode 100644 index 0000000..600b3ff --- /dev/null +++ b/xsd-tests/cxx/tree/naming/camel/driver.cxx @@ -0,0 +1,154 @@ +// file : cxx/tree/naming/camel/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test camel case (upper for types, lower for functions) naming style. +// + +#include +#include + +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main () +{ + xercesc::XMLPlatformUtils::Initialize (); + + try + { + // Enum 'value' type. + // + { + Gender::Value v; + v = Gender::female; + XSD_UNUSED (v); + } + + // Anonymous type. + // + { + Foo f ("a", "b"); + + if (f.a () != "a" || f.b () != "b") + return 1; + } + + // Type name and accessors/modifiers. + // + { + Type t ("bar"); + + // foo + // + { + Type::FooType* p = 0; + XSD_UNUSED (p); + + Type::FooOptional o; + + if (t.foo ().present ()) + return 1; + + t.foo (o); + } + + // bar + // + { + Type::BarType* p = 0; + XSD_UNUSED (p); + + if (t.bar () != "bar") + return 1; + + t.bar ("barbar"); + } + + // baz + // + { + Type::BazType* p = 0; + XSD_UNUSED (p); + + Type::BazSequence s; + Type::BazIterator i (s.begin ()); + Type::BazConstIterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); + + if (t.baz () != s) + return 1; + + t.baz (s); + } + + // any + // + { + Type::AnySequence s (t.domDocument ()); + Type::AnyIterator i (s.begin ()); + Type::AnyConstIterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); + + if (t.any () != s) + return 1; + + t.any (s); + } + + // foo + // + { + Type::FoxType x = Type::foxDefaultValue (); + + if (t.fox () != x) + return 1; + + t.fox ("fox"); + } + + // any_attribute + // + { + Type::AnyAttributeSet s (t.domDocument ()); + Type::AnyAttributeIterator i (s.begin ()); + Type::AnyAttributeConstIterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); + + if (t.anyAttribute () != s) + return 1; + + t.anyAttribute (s); + } + } + + // Parsing/serialization functions. + // + { + istringstream is ("foo"); + root (is, xml_schema::Flags::dont_validate); + } + + { + ostringstream os; + xml_schema::NamespaceInfomap m; + m["t"].name = "test"; + + root (os, "foo", m); + } + } + catch (xml_schema::Exception const& e) + { + cerr << e << endl; + return 1; + } + + xercesc::XMLPlatformUtils::Terminate (); +} diff --git a/xsd-tests/cxx/tree/naming/camel/test.xsd b/xsd-tests/cxx/tree/naming/camel/test.xsd new file mode 100644 index 0000000..7d0a745 --- /dev/null +++ b/xsd-tests/cxx/tree/naming/camel/test.xsd @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/naming/java/buildfile b/xsd-tests/cxx/tree/naming/java/buildfile new file mode 100644 index 0000000..5d4b447 --- /dev/null +++ b/xsd-tests/cxx/tree/naming/java/buildfile @@ -0,0 +1,25 @@ +# file : cxx/tree/naming/java/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --type-naming java \ + --function-naming java \ + --generate-ostream \ + --generate-comparison \ + --generate-wildcard \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/naming/java/driver.cxx b/xsd-tests/cxx/tree/naming/java/driver.cxx new file mode 100644 index 0000000..b47ff74 --- /dev/null +++ b/xsd-tests/cxx/tree/naming/java/driver.cxx @@ -0,0 +1,153 @@ +// file : cxx/tree/naming/java/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test Java naming style. +// + +#include +#include + +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main () +{ + xercesc::XMLPlatformUtils::Initialize (); + + try + { + // Enum 'value' type. + // + { + Gender::Value v; + v = Gender::female; + XSD_UNUSED (v); + } + + // Anonymous type. + // + { + Foo f ("a", "b"); + + if (f.getA () != "a" || f.getB () != "b") + return 1; + } + + // Type name and accessors/modifiers. + // + { + Type t ("bar"); + + // foo + // + { + Type::FooType* p = 0; + XSD_UNUSED (p); + Type::FooOptional o; + + if (t.getFoo ().present ()) + return 1; + + t.setFoo (o); + } + + // bar + // + { + Type::BarType* p = 0; + XSD_UNUSED (p); + + if (t.getBar () != "bar") + return 1; + + t.setBar ("barbar"); + } + + // baz + // + { + Type::BazType* p = 0; + XSD_UNUSED (p); + + Type::BazSequence s; + Type::BazIterator i (s.begin ()); + Type::BazConstIterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); + + if (t.getBaz () != s) + return 1; + + t.setBaz (s); + } + + // any + // + { + Type::AnySequence s (t.getDomDocument ()); + Type::AnyIterator i (s.begin ()); + Type::AnyConstIterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); + + if (t.getAny () != s) + return 1; + + t.setAny (s); + } + + // foo + // + { + Type::FoxType x = Type::getFoxDefaultValue (); + + if (t.getFox () != x) + return 1; + + t.setFox ("fox"); + } + + // any_attribute + // + { + Type::AnyAttributeSet s (t.getDomDocument ()); + Type::AnyAttributeIterator i (s.begin ()); + Type::AnyAttributeConstIterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); + + if (t.getAnyAttribute () != s) + return 1; + + t.setAnyAttribute (s); + } + } + + // Parsing/serialization functions. + // + { + istringstream is ("foo"); + parseRoot (is, xml_schema::Flags::dont_validate); + } + + { + ostringstream os; + xml_schema::NamespaceInfomap m; + m["t"].name = "test"; + + serializeRoot (os, "foo", m); + } + } + catch (xml_schema::Exception const& e) + { + cerr << e << endl; + return 1; + } + + xercesc::XMLPlatformUtils::Terminate (); +} diff --git a/xsd-tests/cxx/tree/naming/java/test.xsd b/xsd-tests/cxx/tree/naming/java/test.xsd new file mode 100644 index 0000000..f525534 --- /dev/null +++ b/xsd-tests/cxx/tree/naming/java/test.xsd @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/naming/knr/buildfile b/xsd-tests/cxx/tree/naming/knr/buildfile new file mode 100644 index 0000000..c4c2287 --- /dev/null +++ b/xsd-tests/cxx/tree/naming/knr/buildfile @@ -0,0 +1,25 @@ +# file : cxx/tree/naming/knr/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --type-naming knr \ + --function-naming knr \ + --generate-ostream \ + --generate-comparison \ + --generate-wildcard \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/naming/knr/driver.cxx b/xsd-tests/cxx/tree/naming/knr/driver.cxx new file mode 100644 index 0000000..8c75dd9 --- /dev/null +++ b/xsd-tests/cxx/tree/naming/knr/driver.cxx @@ -0,0 +1,154 @@ +// file : cxx/tree/naming/knr/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test K&R naming style. +// + +#include +#include + +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main () +{ + xercesc::XMLPlatformUtils::Initialize (); + + try + { + // Enum 'value' type. + // + { + gender::value v; + v = gender::female; + XSD_UNUSED (v); + } + + // Anonymous type. + // + { + foo f ("a", "b"); + + if (f.a () != "a" || f.b () != "b") + return 1; + } + + // Type name and accessors/modifiers. + // + { + type t ("bar"); + + // foo + // + { + type::foo_type* p = 0; + XSD_UNUSED (p); + + type::foo_optional o; + + if (t.foo ().present ()) + return 1; + + t.foo (o); + } + + // bar + // + { + type::bar_type* p = 0; + XSD_UNUSED (p); + + if (t.bar () != "bar") + return 1; + + t.bar ("barbar"); + } + + // baz + // + { + type::baz_type* p = 0; + XSD_UNUSED (p); + + type::baz_sequence s; + type::baz_iterator i (s.begin ()); + type::baz_const_iterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); + + if (t.baz () != s) + return 1; + + t.baz (s); + } + + // any + // + { + type::any_sequence s (t.dom_document ()); + type::any_iterator i (s.begin ()); + type::any_const_iterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); + + if (t.any () != s) + return 1; + + t.any (s); + } + + // foo + // + { + type::fox_type x = type::fox_default_value (); + + if (t.fox () != x) + return 1; + + t.fox ("fox"); + } + + // any_attribute + // + { + type::any_attribute_set s (t.dom_document ()); + type::any_attribute_iterator i (s.begin ()); + type::any_attribute_const_iterator ci (s.begin ()); + XSD_UNUSED (i); + XSD_UNUSED (ci); + + if (t.any_attribute () != s) + return 1; + + t.any_attribute (s); + } + } + + // Parsing/serialization functions. + // + { + istringstream is ("foo"); + root (is, xml_schema::flags::dont_validate); + } + + { + ostringstream os; + xml_schema::namespace_infomap m; + m["t"].name = "test"; + + root (os, "foo", m); + } + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } + + xercesc::XMLPlatformUtils::Terminate (); +} diff --git a/xsd-tests/cxx/tree/naming/knr/test.xsd b/xsd-tests/cxx/tree/naming/knr/test.xsd new file mode 100644 index 0000000..4361544 --- /dev/null +++ b/xsd-tests/cxx/tree/naming/knr/test.xsd @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/order/buildfile b/xsd-tests/cxx/tree/order/buildfile new file mode 100644 index 0000000..91c3cb7 --- /dev/null +++ b/xsd-tests/cxx/tree/order/buildfile @@ -0,0 +1,37 @@ +# file : cxx/tree/order/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --generate-wildcard \ + --generate-comparison \ + --ordered-type t1_base \ + --ordered-type t1_derived \ + --ordered-type t2_base \ + --ordered-type t2_derived \ + --ordered-type t3_type \ + --ordered-type t4_base \ + --ordered-type t4_derived \ + --ordered-type t5_base \ + --ordered-type t5_derived \ + --ordered-type t6_base \ + --ordered-type t6_derived \ + --ordered-type t7_type \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/order/driver.cxx b/xsd-tests/cxx/tree/order/driver.cxx new file mode 100644 index 0000000..f1902ba --- /dev/null +++ b/xsd-tests/cxx/tree/order/driver.cxx @@ -0,0 +1,64 @@ +// file : cxx/tree/order/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test ordered type support. +// + +#include // std::auto_ptr/unique_ptr +#include +#include + +#include +#include + +#include "test.hxx" + +using namespace std; +using namespace test; +using namespace xercesc; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + XMLPlatformUtils::Initialize (); + + try + { + XSD_AUTO_PTR r (root_ (argv[1], xml_schema::flags::dont_initialize)); + + root c (*r); + assert (c == *r); + + for (root::t1_const_iterator j (r->t1 ().begin ()); + j != r->t1 ().end (); ++j) + { + const t1_derived& d (*j); + + for (t1_derived::content_order_const_iterator i ( + d.content_order ().begin ()); i != d.content_order ().end (); ++i) + { + cout << i->id << ' ' << i->index << endl; + } + } + + xml_schema::namespace_infomap map; + + map["t"].name = "test"; + map["t1"].name = "test1"; + + root_ (cout, *r, map, "UTF-8", xml_schema::flags::dont_initialize); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } + + XMLPlatformUtils::Terminate (); +} diff --git a/xsd-tests/cxx/tree/order/output b/xsd-tests/cxx/tree/order/output new file mode 100644 index 0000000..73442fe --- /dev/null +++ b/xsd-tests/cxx/tree/order/output @@ -0,0 +1,92 @@ +2 0 +1 0 +1 1 +2 1 +3 0 +4 0 +3 1 +4 1 + + + + b1 + a1 + a2 + b2 + c1 + d1 + e1 + d2 + f1 + + + b1 + a1 + b2 + a2 + + + a1 + b1 + c1 + c2 + + + a1 + c1 + + + t1 + + b1 + t2 + + a1 + t3 + + b2 + t4 + + a2 + t5 + + d1 + t6 + + c1 + t7 + + + + t5a + + + t1 + + b1 + t2 + + a1 + t3 + + a2 + t4 + + b2 + t5 + + + + t6 + + + t1 + + a1 + t2 + + b1 + t3 + + + diff --git a/xsd-tests/cxx/tree/order/test.xml b/xsd-tests/cxx/tree/order/test.xml new file mode 100644 index 0000000..cd82936 --- /dev/null +++ b/xsd-tests/cxx/tree/order/test.xml @@ -0,0 +1,71 @@ + + + b1 + a1 + a2 + b2 + c1 + d1 + e1 + d2 + f1 + + + b1 + a1 + b2 + a2 + + + a1 + b1 + c1 + c2 + + + a1 + c1 + + + t1 + b1 + t2 + a1 + t3 + b2 + t4 + a2 + t5 + d1 + t6 + c1 + t7 + + + t5a + + + t1 + b1 + t2 + a1 + t3 + a2 + t4 + b2 + t5 + + + t6 + + + t1 + a1 + t2 + b1 + t3 + + diff --git a/xsd-tests/cxx/tree/order/test.xsd b/xsd-tests/cxx/tree/order/test.xsd new file mode 100644 index 0000000..c30c027 --- /dev/null +++ b/xsd-tests/cxx/tree/order/test.xsd @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/polymorphism/comparison/buildfile b/xsd-tests/cxx/tree/polymorphism/comparison/buildfile new file mode 100644 index 0000000..0bb0b77 --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/comparison/buildfile @@ -0,0 +1,25 @@ +# file : cxx/tree/polymorphism/comparison/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --generate-polymorphic \ + --polymorphic-type base \ + --generate-comparison \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/polymorphism/comparison/driver.cxx b/xsd-tests/cxx/tree/polymorphism/comparison/driver.cxx new file mode 100644 index 0000000..cadb225 --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/comparison/driver.cxx @@ -0,0 +1,85 @@ +// file : cxx/tree/polymorphism/comparison/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test comparison of polymorphic object models. +// + +#include // std::auto_ptr/unique_ptr +#include +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + // Equals. + // + { + derived1 d ("a", 1); + d.b ("b"); + type r1 (d); + + assert (*r == r1); + } + + // Values are not equal. + // + { + derived1 d ("a", 1); + d.b ("c"); + type r1 (d); + + assert (*r != r1); + } + + // Values are not equal. + // + { + derived1 d ("a", 2); + d.b ("b"); + type r1 (d); + + assert (*r != r1); + } + + // Different types. + // + { + derived2 d ("a", 1); + d.c ().push_back ("c"); + type r1 (d); + + assert (*r != r1); + } + + xml_schema::namespace_infomap map; + + map["t"].name = "test"; + + stringstream s; + root (s, *r, map); + + XSD_AUTO_PTR c (root (s, xml_schema::flags::dont_validate)); + + assert (*r == *c); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/polymorphism/comparison/test.xml b/xsd-tests/cxx/tree/polymorphism/comparison/test.xml new file mode 100644 index 0000000..0b8c125 --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/comparison/test.xml @@ -0,0 +1,7 @@ + + + a1b + + diff --git a/xsd-tests/cxx/tree/polymorphism/comparison/test.xsd b/xsd-tests/cxx/tree/polymorphism/comparison/test.xsd new file mode 100644 index 0000000..364d1b3 --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/comparison/test.xsd @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/polymorphism/ostream/buildfile b/xsd-tests/cxx/tree/polymorphism/ostream/buildfile new file mode 100644 index 0000000..2237c73 --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/ostream/buildfile @@ -0,0 +1,26 @@ +# file : cxx/tree/polymorphism/ostream/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-polymorphic \ + --polymorphic-type-all \ + --root-element root \ + --generate-ostream \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/polymorphism/ostream/driver.cxx b/xsd-tests/cxx/tree/polymorphism/ostream/driver.cxx new file mode 100644 index 0000000..b030be9 --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/ostream/driver.cxx @@ -0,0 +1,34 @@ +// file : cxx/tree/polymorphism/ostream/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test printing of polymorphic object models. +// + +#include // std::auto_ptr/unique_ptr +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + cout << *r << endl; + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/polymorphism/ostream/output b/xsd-tests/cxx/tree/polymorphism/ostream/output new file mode 100644 index 0000000..e7fbd68 --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/ostream/output @@ -0,0 +1,18 @@ + +base: +a: a +fund: 1 +base: +a: a +fund: 1 +b: b +base: +a: a +fund: 1 +c: c1 +c: c2 +base: +a: a +fund: 1 +d: d1 +d: d2 diff --git a/xsd-tests/cxx/tree/polymorphism/ostream/test.xml b/xsd-tests/cxx/tree/polymorphism/ostream/test.xml new file mode 100644 index 0000000..5409d2a --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/ostream/test.xml @@ -0,0 +1,10 @@ + + + a1 + a1b + a1c1c2 + a1d1d2 + + diff --git a/xsd-tests/cxx/tree/polymorphism/ostream/test.xsd b/xsd-tests/cxx/tree/polymorphism/ostream/test.xsd new file mode 100644 index 0000000..688cd5a --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/ostream/test.xsd @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/polymorphism/same-type/buildfile b/xsd-tests/cxx/tree/polymorphism/same-type/buildfile new file mode 100644 index 0000000..46720d6 --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/same-type/buildfile @@ -0,0 +1,25 @@ +# file : cxx/tree/polymorphism/same-type/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-polymorphic \ + --root-element root \ + --generate-ostream \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/polymorphism/same-type/driver.cxx b/xsd-tests/cxx/tree/polymorphism/same-type/driver.cxx new file mode 100644 index 0000000..94f82f5 --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/same-type/driver.cxx @@ -0,0 +1,35 @@ +// file : cxx/tree/polymorphism/same-type/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test substitution group and xsi:type that don't change the type. +// + +#include // std::auto_ptr/unique_ptr +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + cout << *r << endl; + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/polymorphism/same-type/output b/xsd-tests/cxx/tree/polymorphism/same-type/output new file mode 100644 index 0000000..04b5cbf --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/same-type/output @@ -0,0 +1,9 @@ + +base: +a: a1 +base: +a: a2 +base: +a: a3 +base: +a: a4 diff --git a/xsd-tests/cxx/tree/polymorphism/same-type/test.xml b/xsd-tests/cxx/tree/polymorphism/same-type/test.xml new file mode 100644 index 0000000..f8b6d1e --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/same-type/test.xml @@ -0,0 +1,10 @@ + + + a1 + a2 + a3 + a4 + + diff --git a/xsd-tests/cxx/tree/polymorphism/same-type/test.xsd b/xsd-tests/cxx/tree/polymorphism/same-type/test.xsd new file mode 100644 index 0000000..a4157d3 --- /dev/null +++ b/xsd-tests/cxx/tree/polymorphism/same-type/test.xsd @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/prefix/.gitignore b/xsd-tests/cxx/tree/prefix/.gitignore new file mode 100644 index 0000000..2457930 --- /dev/null +++ b/xsd-tests/cxx/tree/prefix/.gitignore @@ -0,0 +1,2 @@ +bar.?xx +foo.?xx diff --git a/xsd-tests/cxx/tree/prefix/bar.xsd b/xsd-tests/cxx/tree/prefix/bar.xsd new file mode 100644 index 0000000..4e20902 --- /dev/null +++ b/xsd-tests/cxx/tree/prefix/bar.xsd @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/prefix/buildfile b/xsd-tests/cxx/tree/prefix/buildfile new file mode 100644 index 0000000..7ac81de --- /dev/null +++ b/xsd-tests/cxx/tree/prefix/buildfile @@ -0,0 +1,31 @@ +# file : cxx/tree/prefix/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +fs = foo bar test + +exe{driver}: {hxx cxx}{* -{$fs}} {hxx ixx cxx}{$fs} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +for f: $fs +{ + <{hxx ixx cxx}{$f}>: xsd{$f} $xsd + {{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --generate-polymorphic \ + --polymorphic-type 'foo#base' \ + --root-element root \ + --output-dir $out_base \ + $path($<[0]) + }} +} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/prefix/driver.cxx b/xsd-tests/cxx/tree/prefix/driver.cxx new file mode 100644 index 0000000..bd2e46d --- /dev/null +++ b/xsd-tests/cxx/tree/prefix/driver.cxx @@ -0,0 +1,34 @@ +// file : cxx/tree/prefix/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test automatic prefix assignment. +// + +#include // std::auto_ptr/unique_ptr +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + root (std::cout, *r); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/prefix/foo.xsd b/xsd-tests/cxx/tree/prefix/foo.xsd new file mode 100644 index 0000000..97a35cf --- /dev/null +++ b/xsd-tests/cxx/tree/prefix/foo.xsd @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/prefix/output b/xsd-tests/cxx/tree/prefix/output new file mode 100644 index 0000000..9801a23 --- /dev/null +++ b/xsd-tests/cxx/tree/prefix/output @@ -0,0 +1,18 @@ + + + + 123 + + + + 1 + 2 + + + + + 1 + 2 + + + diff --git a/xsd-tests/cxx/tree/prefix/test.xml b/xsd-tests/cxx/tree/prefix/test.xml new file mode 100644 index 0000000..b6d0dd6 --- /dev/null +++ b/xsd-tests/cxx/tree/prefix/test.xml @@ -0,0 +1,19 @@ + + + + 123 + + + + 12 + + + + 12 + + + diff --git a/xsd-tests/cxx/tree/prefix/test.xsd b/xsd-tests/cxx/tree/prefix/test.xsd new file mode 100644 index 0000000..421fdc0 --- /dev/null +++ b/xsd-tests/cxx/tree/prefix/test.xsd @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/test-template/buildfile b/xsd-tests/cxx/tree/test-template/buildfile new file mode 100644 index 0000000..b50e6c3 --- /dev/null +++ b/xsd-tests/cxx/tree/test-template/buildfile @@ -0,0 +1,23 @@ +# file : cxx/tree/test-template/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-ostream \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/test-template/driver.cxx b/xsd-tests/cxx/tree/test-template/driver.cxx new file mode 100644 index 0000000..5257279 --- /dev/null +++ b/xsd-tests/cxx/tree/test-template/driver.cxx @@ -0,0 +1,35 @@ +// file : cxx/tree/test-template/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Insert test description here. +// + +#include // std::auto_ptr/unique_ptr +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR r (root (argv[1])); + + cout << *r << endl; + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/test-template/output b/xsd-tests/cxx/tree/test-template/output new file mode 100644 index 0000000..2a50681 --- /dev/null +++ b/xsd-tests/cxx/tree/test-template/output @@ -0,0 +1,2 @@ + +a: a diff --git a/xsd-tests/cxx/tree/test-template/test.xml b/xsd-tests/cxx/tree/test-template/test.xml new file mode 100644 index 0000000..624a80c --- /dev/null +++ b/xsd-tests/cxx/tree/test-template/test.xml @@ -0,0 +1,7 @@ + + + a + + diff --git a/xsd-tests/cxx/tree/test-template/test.xsd b/xsd-tests/cxx/tree/test-template/test.xsd new file mode 100644 index 0000000..07bebc7 --- /dev/null +++ b/xsd-tests/cxx/tree/test-template/test.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/types-only/buildfile b/xsd-tests/cxx/tree/types-only/buildfile new file mode 100644 index 0000000..fa02277 --- /dev/null +++ b/xsd-tests/cxx/tree/types-only/buildfile @@ -0,0 +1,20 @@ +# file : cxx/tree/types-only/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --suppress-parsing \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/types-only/driver.cxx b/xsd-tests/cxx/tree/types-only/driver.cxx new file mode 100644 index 0000000..730b807 --- /dev/null +++ b/xsd-tests/cxx/tree/types-only/driver.cxx @@ -0,0 +1,30 @@ +// file : cxx/tree/types-only/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test that code generated without parsing and serialization functions +// still compiles. +// + +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main () +{ + color_enum red (color_enum::red); + red_blue_enum blue (red_blue_enum::blue); + + long_string_union num ("123"); + + string_list list; + list.push_back ("Hello"); + list.push_back ("World"); + + complex_type t ("Hello, World!", "foo", color_enum::red); + + anon a ("Hello, World!"); +} diff --git a/xsd-tests/cxx/tree/types-only/test.xsd b/xsd-tests/cxx/tree/types-only/test.xsd new file mode 100644 index 0000000..9f02240 --- /dev/null +++ b/xsd-tests/cxx/tree/types-only/test.xsd @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/union/ctor/buildfile b/xsd-tests/cxx/tree/union/ctor/buildfile new file mode 100644 index 0000000..6715cb6 --- /dev/null +++ b/xsd-tests/cxx/tree/union/ctor/buildfile @@ -0,0 +1,22 @@ +# file : cxx/tree/union/ctor/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-default-ctor \ + --generate-from-base-ctor \ + --generate-doxygen \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/union/ctor/driver.cxx b/xsd-tests/cxx/tree/union/ctor/driver.cxx new file mode 100644 index 0000000..246eea8 --- /dev/null +++ b/xsd-tests/cxx/tree/union/ctor/driver.cxx @@ -0,0 +1,30 @@ +// file : cxx/tree/union/ctor/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test union constructors. +// +#include + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main () +{ + // Test ctor(const std::string&) + // + { + string const s ("123"); + int_string_union u (s); + type t (s); + } + + // Test ctor(const char*). + // + { + int_string_union u ("123"); + type t ("123"); + } +} diff --git a/xsd-tests/cxx/tree/union/ctor/test.xsd b/xsd-tests/cxx/tree/union/ctor/test.xsd new file mode 100644 index 0000000..9601093 --- /dev/null +++ b/xsd-tests/cxx/tree/union/ctor/test.xsd @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/xsd-tests/cxx/tree/wildcard/buildfile b/xsd-tests/cxx/tree/wildcard/buildfile new file mode 100644 index 0000000..67edcdc --- /dev/null +++ b/xsd-tests/cxx/tree/wildcard/buildfile @@ -0,0 +1,27 @@ +# file : cxx/tree/wildcard/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-serialization \ + --generate-wildcard \ + --generate-default-ctor \ + --generate-from-base-ctor \ + --generate-comparison \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/wildcard/driver.cxx b/xsd-tests/cxx/tree/wildcard/driver.cxx new file mode 100644 index 0000000..e3040c7 --- /dev/null +++ b/xsd-tests/cxx/tree/wildcard/driver.cxx @@ -0,0 +1,203 @@ +// file : cxx/tree/wildcard/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test wildcard (any & anyAttribute) mapping. +// + +#include // std::auto_ptr/unique_ptr +#include +#include + +#include +#include + +#include "test.hxx" // Get XSD_CXX11 defined. + +#include + +using namespace std; +using namespace test; +using namespace xercesc; + +namespace xml = xsd::cxx::xml; + +void +print (type& t) +{ + if (t.att ()) + cout << *t.att () << endl; + + type::any_attribute_set& as (t.any_attribute ()); + + for (type::any_attribute_iterator i (as.begin ()); i != as.end (); ++i) + { + cout << xml::transcode (i->getTextContent ()) << endl; + } + + cout << xml::transcode (t.any ().getTextContent ()) << endl + << t.foo () << endl; + + if (t.any1 ()) + cout << xml::transcode (t.any1 ()->getTextContent ()) << endl; + + cout << t.bar () << endl; + + type::any2_sequence& es (t.any2 ()); + + for (type::any2_iterator i (es.begin ()); i != es.end (); ++i) + { + cout << xml::transcode (i->getTextContent ()) << endl; + } + + cout << endl; +} + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + XMLPlatformUtils::Initialize (); + + try + { + // Test accessors/modifiers for various cardinalities. + // + type t; + + DOMDocument& doc (t.dom_document ()); + + // one + // + { + DOMElement* e (doc.createElement (xml::string ("a").c_str ())); + t.any (*e); + e->release (); + assert (xml::transcode (t.any ().getTagName ()) == "a"); + + t.any (doc.createElement (xml::string ("b").c_str ())); + assert (xml::transcode (t.any ().getTagName ()) == "b"); + } + + // optional + // + { + assert (!t.any1 ().present ()); + + DOMElement* e (doc.createElement (xml::string ("a").c_str ())); + t.any1 (*e); + e->release (); + assert (t.any1 ().present ()); + assert (xml::transcode (t.any1 ().get ().getTagName ()) == "a"); + + t.any1 (doc.createElement (xml::string ("b").c_str ())); + assert (xml::transcode (t.any1 ()->getTagName ()) == "b"); + + type::any1_optional c ( + doc.createElement (xml::string ("c").c_str ()), doc); + t.any1 (c); + assert (xml::transcode (t.any1 ()->getTagName ()) == "c"); + } + + + // sequence + // + { + type::any2_sequence& s (t.any2 ()); + + DOMElement* e (doc.createElement (xml::string ("a").c_str ())); + s.push_back (*e); + e->release (); + s.push_back (doc.createElement (xml::string ("b").c_str ())); + assert (s.size () == 2); + + for (type::any2_iterator i (s.begin ()); i != s.end (); ++i) + { + if (i == s.begin ()) + assert (xml::transcode (i->getTagName ()) == "a"); + else + assert (xml::transcode ((*i).getTagName ()) == "b"); + } + + // copy c-tor + type::any2_sequence cs (s, doc); + assert (cs.size () == 2); + assert (xml::transcode (cs[0].getTagName ()) == "a"); + assert (xml::transcode (cs[1].getTagName ()) == "b"); + + // assignment + t.any2 (cs); + assert (s.size () == 2); + assert (xml::transcode (s[0].getTagName ()) == "a"); + assert (xml::transcode (s[1].getTagName ()) == "b"); + } + + // anyAttribute + // + { + type::any_attribute_set& s (t.any_attribute ()); + + DOMAttr* a (doc.createAttribute (xml::string ("a").c_str ())); + s.insert (*a); + a->release (); + s.insert (doc.createAttribute (xml::string ("b").c_str ())); + assert (s.size () == 2); + + assert (s.find ("a") != s.end ()); + assert (s.find ("b") != s.end ()); + + for (type::any_attribute_iterator i (s.begin ()); i != s.end (); ++i) + { + assert (xml::transcode (i->getName ()) == "a" || + xml::transcode ((*i).getName ()) == "b"); + } + + // copy c-tor + type::any_attribute_set cs (s, doc); + assert (cs.size () == 2); + assert (cs.count ("a")); + assert (cs.count ("b")); + + // assignment + t.any_attribute (cs); + assert (s.size () == 2); + assert (s.count ("a")); + assert (s.count ("b")); + } + + // Test parsing + // + XSD_AUTO_PTR r (root (argv[1])); + print (*r); + + // Test serialization. + // + xml_schema::namespace_infomap map; + + map["t"].name = "test"; + map["t"].schema = "test.xsd"; + map["o"].name = "other"; + + stringstream iostr; + root (iostr, *r, map); + + // cout << iostr.str () << endl + // << endl; + + XSD_AUTO_PTR copy (root (iostr, argv[1])); + assert (*copy == *r); + + print (*copy); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } + + XMLPlatformUtils::Terminate (); +} diff --git a/xsd-tests/cxx/tree/wildcard/output b/xsd-tests/cxx/tree/wildcard/output new file mode 100644 index 0000000..b23b488 --- /dev/null +++ b/xsd-tests/cxx/tree/wildcard/output @@ -0,0 +1,24 @@ +att +any +o:any +t:any +o:one +foo +t:bar +bar +o:one1 +o:one2 +o:one3 + +att +any +o:any +t:any +o:one +foo +t:bar +bar +o:one1 +o:one2 +o:one3 + diff --git a/xsd-tests/cxx/tree/wildcard/test.xml b/xsd-tests/cxx/tree/wildcard/test.xml new file mode 100644 index 0000000..b0c3267 --- /dev/null +++ b/xsd-tests/cxx/tree/wildcard/test.xml @@ -0,0 +1,19 @@ + + + o:one + foo + t:bar + bar + o:one1 + o:one2 + o:one3 + + diff --git a/xsd-tests/cxx/tree/wildcard/test.xsd b/xsd-tests/cxx/tree/wildcard/test.xsd new file mode 100644 index 0000000..6c7b308 --- /dev/null +++ b/xsd-tests/cxx/tree/wildcard/test.xsd @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + -- cgit v1.1