From a15cf65c44d5c224169c32ef5495b68c758134b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 18 May 2014 16:08:14 +0200 Subject: Imported Upstream version 3.3.0.2 --- xsd/tests/cxx/tree/built-in/attributes.xml | 73 +++++ xsd/tests/cxx/tree/built-in/driver.cxx | 94 ++++++ xsd/tests/cxx/tree/built-in/elements.xml | 84 ++++++ xsd/tests/cxx/tree/built-in/inherited.xml | 84 ++++++ xsd/tests/cxx/tree/built-in/makefile | 97 ++++++ xsd/tests/cxx/tree/built-in/types.xsd | 460 +++++++++++++++++++++++++++++ 6 files changed, 892 insertions(+) create mode 100644 xsd/tests/cxx/tree/built-in/attributes.xml create mode 100644 xsd/tests/cxx/tree/built-in/driver.cxx create mode 100644 xsd/tests/cxx/tree/built-in/elements.xml create mode 100644 xsd/tests/cxx/tree/built-in/inherited.xml create mode 100644 xsd/tests/cxx/tree/built-in/makefile create mode 100644 xsd/tests/cxx/tree/built-in/types.xsd (limited to 'xsd/tests/cxx/tree/built-in') diff --git a/xsd/tests/cxx/tree/built-in/attributes.xml b/xsd/tests/cxx/tree/built-in/attributes.xml new file mode 100644 index 0000000..609a757 --- /dev/null +++ b/xsd/tests/cxx/tree/built-in/attributes.xml @@ -0,0 +1,73 @@ + + 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..a41e4f3 --- /dev/null +++ b/xsd/tests/cxx/tree/built-in/driver.cxx @@ -0,0 +1,94 @@ +// file : tests/cxx/tree/built-in/driver.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test built-in type mapping. +// + +#include // std::auto_ptr +#include +#include + + +#include "types.hxx" + +using std::cerr; +using std::endl; +using std::auto_ptr; + +int +main (int argc, char* argv[]) +{ + if (argc != 4) + { + cerr << "usage: " << argv[0] << " elements.xml attributes.xml inherited.xml" << endl; + return 1; + } + + auto_ptr elements (xmlns::test::elements (argv[1])); + + auto_ptr attributes ( + xmlns::test::attributes (argv[2])); + + 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 ()); + 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 ()); + 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 ()); + 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/elements.xml b/xsd/tests/cxx/tree/built-in/elements.xml new file mode 100644 index 0000000..f76f019 --- /dev/null +++ b/xsd/tests/cxx/tree/built-in/elements.xml @@ -0,0 +1,84 @@ + + + + + 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 + + + + + + + diff --git a/xsd/tests/cxx/tree/built-in/inherited.xml b/xsd/tests/cxx/tree/built-in/inherited.xml new file mode 100644 index 0000000..1781a69 --- /dev/null +++ b/xsd/tests/cxx/tree/built-in/inherited.xml @@ -0,0 +1,84 @@ + + + + + 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 + + + + + + + diff --git a/xsd/tests/cxx/tree/built-in/makefile b/xsd/tests/cxx/tree/built-in/makefile new file mode 100644 index 0000000..bf6301b --- /dev/null +++ b/xsd/tests/cxx/tree/built-in/makefile @@ -0,0 +1,97 @@ +# file : tests/cxx/tree/built-in/makefile +# author : Boris Kolpackov +# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make + +xsd := types.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +test := $(out_base)/.test +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.ixx) $(xsd:.xsd=.cxx) +gen := $(addprefix $(out_base)/,$(genf)) + +$(gen): xsd := $(out_root)/xsd/xsd + +$(gen): xsd_options := \ +--char-type char \ +--generate-inline \ +--generate-ostream \ +--generate-serialization \ +--generate-default-ctor \ +--generate-from-base-ctor \ +--root-element-all + +$(gen): $(src_root)/xsd/xsd + +$(call include-dep,$(dep)) + + +# Convenience alias for default target. +# +$(out_base)/: $(driver) + + +# Test. +# +# We need to cd to src_base in order to have the schema in the working +# directory. +# +$(test): driver := $(driver) +$(test): $(driver) $(src_base)/elements.xml $(src_base)/attributes.xml \ +$(src_base)/inherited.xml + cd $(src_base) && $(driver) $(src_base)/elements.xml \ +$(src_base)/attributes.xml $(src_base)/inherited.xml + + +# Clean. +# +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + +# Generated .gitignore. +# +ifeq ($(out_base),$(src_base)) +$(gen): | $(out_base)/.gitignore +$(driver): | $(out_base)/.gitignore + +$(out_base)/.gitignore: files := driver $(genf) +$(clean): $(out_base)/.gitignore.clean + +$(call include,$(bld_root)/git/gitignore.make) +endif + +# How to. +# +$(call include,$(bld_root)/cxx/o-e.make) +$(call include,$(bld_root)/cxx/cxx-o.make) +$(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(scf_root)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3