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/parser/recursive/buildfile | 24 ++++++ xsd-tests/cxx/parser/recursive/driver.cxx | 139 ++++++++++++++++++++++++++++++ xsd-tests/cxx/parser/recursive/output | 22 +++++ xsd-tests/cxx/parser/recursive/test.xml | 11 +++ xsd-tests/cxx/parser/recursive/test.xsd | 27 ++++++ 5 files changed, 223 insertions(+) create mode 100644 xsd-tests/cxx/parser/recursive/buildfile create mode 100644 xsd-tests/cxx/parser/recursive/driver.cxx create mode 100644 xsd-tests/cxx/parser/recursive/output create mode 100644 xsd-tests/cxx/parser/recursive/test.xml create mode 100644 xsd-tests/cxx/parser/recursive/test.xsd (limited to 'xsd-tests/cxx/parser/recursive') diff --git a/xsd-tests/cxx/parser/recursive/buildfile b/xsd-tests/cxx/parser/recursive/buildfile new file mode 100644 index 0000000..237855c --- /dev/null +++ b/xsd-tests/cxx/parser/recursive/buildfile @@ -0,0 +1,24 @@ +# file : cxx/parser/recursive/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-pskel} {hxx ixx cxx}{test-pskel} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-parser --std c++11 \ + --generate-inline \ + --skel-file-suffix -pskel \ + --output-dir $out_base \ + --generate-validation \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/parser/recursive/driver.cxx b/xsd-tests/cxx/parser/recursive/driver.cxx new file mode 100644 index 0000000..c93fd35 --- /dev/null +++ b/xsd-tests/cxx/parser/recursive/driver.cxx @@ -0,0 +1,139 @@ +// file : cxx/parser/recursive/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test recursive parser invocation. +// + +#include +#include + +#include "test-pskel.hxx" + +using namespace std; + +struct sub_pimpl: sub_type_pskel +{ + virtual void + pre () + { + cout << "sub::pre" << endl; + } + + virtual void + sub () + { + cout << "sub::sub" << endl; + } + + virtual void + sub2 () + { + cout << "sub::sub2" << endl; + } + + virtual void + name (string const& n) + { + cout << "sub::name: " << n << endl; + } + + virtual void + post_sub_type () + { + cout << "sub::post" << endl; + } +}; + +struct indir_pimpl: indir_type_pskel +{ + virtual void + pre () + { + cout << "indir::pre" << endl; + } + + virtual void + sub () + { + cout << "indir::sub" << endl; + } + + virtual void + name (string const& n) + { + cout << "indir::name: " << n << endl; + } + + virtual void + post_indir_type () + { + cout << "indir::post" << endl; + } +}; + +struct test_pimpl: test_type_pskel +{ + virtual void + pre () + { + cout << "test::pre" << endl; + } + + virtual void + sub () + { + cout << "test::sub" << endl; + } + + virtual void + name (string const& n) + { + cout << "test::name: " << n << endl; + } + + virtual void + post_test_type () + { + cout << "test::post" << endl; + } +}; + + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + xml_schema::string_pimpl string_p; + + sub_pimpl sub_p; + indir_pimpl indir_p; + test_pimpl test_p; + + sub_p.parsers (sub_p, indir_p, sub_p, string_p); + indir_p.parsers (sub_p, string_p); + test_p.parsers (sub_p, string_p); + + xml_schema::document doc_p (test_p, "test"); + + test_p.pre (); + doc_p.parse (argv[1]); + test_p.post_test_type (); + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } + catch (ios_base::failure const&) + { + cerr << "io failure" << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/parser/recursive/output b/xsd-tests/cxx/parser/recursive/output new file mode 100644 index 0000000..f26fb72 --- /dev/null +++ b/xsd-tests/cxx/parser/recursive/output @@ -0,0 +1,22 @@ +test::pre +test::name: testName +sub::pre +sub::name: subName +sub::pre +sub::name: sub-subName +sub::post +sub::sub +indir::pre +indir::name: sub-indirName +sub::pre +sub::name: sub-indir-subName +sub::post +indir::sub +indir::post +sub::pre +sub::name: sub-sub2Name +sub::post +sub::sub2 +sub::post +test::sub +test::post diff --git a/xsd-tests/cxx/parser/recursive/test.xml b/xsd-tests/cxx/parser/recursive/test.xml new file mode 100644 index 0000000..f6c219d --- /dev/null +++ b/xsd-tests/cxx/parser/recursive/test.xml @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/xsd-tests/cxx/parser/recursive/test.xsd b/xsd-tests/cxx/parser/recursive/test.xsd new file mode 100644 index 0000000..33e1d2d --- /dev/null +++ b/xsd-tests/cxx/parser/recursive/test.xsd @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.1