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 --- tests/cxx/tree/binary/cdr/driver.cxx | 143 -------------------- tests/cxx/tree/binary/cdr/makefile | 89 ------------- tests/cxx/tree/binary/cdr/test.xml | 93 ------------- tests/cxx/tree/binary/cdr/test.xsd | 123 ----------------- tests/cxx/tree/binary/makefile | 16 --- tests/cxx/tree/binary/polymorphic/driver.cxx | 164 ----------------------- tests/cxx/tree/binary/polymorphic/makefile | 90 ------------- tests/cxx/tree/binary/polymorphic/test.xml | 92 ------------- tests/cxx/tree/binary/polymorphic/test.xsd | 125 ------------------ tests/cxx/tree/binary/xdr-ordered/driver.cxx | 189 --------------------------- tests/cxx/tree/binary/xdr-ordered/makefile | 85 ------------ tests/cxx/tree/binary/xdr-ordered/test.xml | 93 ------------- tests/cxx/tree/binary/xdr-ordered/test.xsd | 123 ----------------- tests/cxx/tree/binary/xdr/driver.cxx | 187 -------------------------- tests/cxx/tree/binary/xdr/makefile | 85 ------------ tests/cxx/tree/binary/xdr/test.xml | 93 ------------- tests/cxx/tree/binary/xdr/test.xsd | 123 ----------------- 17 files changed, 1913 deletions(-) delete mode 100644 tests/cxx/tree/binary/cdr/driver.cxx delete mode 100644 tests/cxx/tree/binary/cdr/makefile delete mode 100644 tests/cxx/tree/binary/cdr/test.xml delete mode 100644 tests/cxx/tree/binary/cdr/test.xsd delete mode 100644 tests/cxx/tree/binary/makefile delete mode 100644 tests/cxx/tree/binary/polymorphic/driver.cxx delete mode 100644 tests/cxx/tree/binary/polymorphic/makefile delete mode 100644 tests/cxx/tree/binary/polymorphic/test.xml delete mode 100644 tests/cxx/tree/binary/polymorphic/test.xsd delete mode 100644 tests/cxx/tree/binary/xdr-ordered/driver.cxx delete mode 100644 tests/cxx/tree/binary/xdr-ordered/makefile delete mode 100644 tests/cxx/tree/binary/xdr-ordered/test.xml delete mode 100644 tests/cxx/tree/binary/xdr-ordered/test.xsd delete mode 100644 tests/cxx/tree/binary/xdr/driver.cxx delete mode 100644 tests/cxx/tree/binary/xdr/makefile delete mode 100644 tests/cxx/tree/binary/xdr/test.xml delete mode 100644 tests/cxx/tree/binary/xdr/test.xsd (limited to 'tests/cxx/tree/binary') diff --git a/tests/cxx/tree/binary/cdr/driver.cxx b/tests/cxx/tree/binary/cdr/driver.cxx deleted file mode 100644 index fe74bb5..0000000 --- a/tests/cxx/tree/binary/cdr/driver.cxx +++ /dev/null @@ -1,143 +0,0 @@ -// 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/tests/cxx/tree/binary/cdr/makefile b/tests/cxx/tree/binary/cdr/makefile deleted file mode 100644 index 2d452ee..0000000 --- a/tests/cxx/tree/binary/cdr/makefile +++ /dev/null @@ -1,89 +0,0 @@ -# file : tests/cxx/tree/binary/cdr/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make - -xsd := test.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) - -$(call import,\ - $(scf_root)/import/libace/stub.make,\ - l: ace.l,cpp-options: ace.l.cpp-options) - -# Build. -# -$(driver): $(obj) $(xerces_c.l) $(ace.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) $(ace.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 += --generate-insertion ACE_OutputCDR \ ---generate-extraction ACE_InputCDR --generate-comparison -$(gen): $(out_root)/xsd/xsd - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Test. -# -$(test): driver := $(driver) -$(test): $(driver) $(src_base)/test.xml - $(call message,test $$1,$$1 $(src_base)/test.xml,$(driver)) - -# 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,$(bld_root)/cxx/standard.make) # cxx_standard -ifdef cxx_standard -$(gen): xsd_options += --std $(cxx_standard) -$(call include,$(scf_root)/xsd/tree/xsd-cxx.make) -endif - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/tests/cxx/tree/binary/cdr/test.xml b/tests/cxx/tree/binary/cdr/test.xml deleted file mode 100644 index 5cedd98..0000000 --- a/tests/cxx/tree/binary/cdr/test.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - 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/tests/cxx/tree/binary/cdr/test.xsd b/tests/cxx/tree/binary/cdr/test.xsd deleted file mode 100644 index 0629e94..0000000 --- a/tests/cxx/tree/binary/cdr/test.xsd +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/cxx/tree/binary/makefile b/tests/cxx/tree/binary/makefile deleted file mode 100644 index 9ccc93f..0000000 --- a/tests/cxx/tree/binary/makefile +++ /dev/null @@ -1,16 +0,0 @@ -# file : tests/cxx/tree/binary/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make - -tests := cdr polymorphic xdr xdr-ordered - -default := $(out_base)/ -test := $(out_base)/.test -clean := $(out_base)/.clean - -$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests))) -$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(tests))) -$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(tests))) - -$(foreach t,$(tests),$(call import,$(src_base)/$t/makefile)) diff --git a/tests/cxx/tree/binary/polymorphic/driver.cxx b/tests/cxx/tree/binary/polymorphic/driver.cxx deleted file mode 100644 index 15ebf17..0000000 --- a/tests/cxx/tree/binary/polymorphic/driver.cxx +++ /dev/null @@ -1,164 +0,0 @@ -// 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/tests/cxx/tree/binary/polymorphic/makefile b/tests/cxx/tree/binary/polymorphic/makefile deleted file mode 100644 index c88b79c..0000000 --- a/tests/cxx/tree/binary/polymorphic/makefile +++ /dev/null @@ -1,90 +0,0 @@ -# file : tests/cxx/tree/binary/polymorphic/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make - -xsd := test.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) - -$(call import,\ - $(scf_root)/import/libace/stub.make,\ - l: ace.l,cpp-options: ace.l.cpp-options) - -# Build. -# -$(driver): $(obj) $(xerces_c.l) $(ace.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) $(ace.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 += --generate-polymorphic --root-element-last \ ---generate-insertion ACE_OutputCDR --generate-extraction ACE_InputCDR \ - --generate-comparison -$(gen): $(out_root)/xsd/xsd - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Test. -# -$(test): driver := $(driver) -$(test): $(driver) $(src_base)/test.xml - $(call message,test $$1,$$1 $(src_base)/test.xml,$(driver)) - -# 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,$(bld_root)/cxx/standard.make) # cxx_standard -ifdef cxx_standard -$(gen): xsd_options += --std $(cxx_standard) -$(call include,$(scf_root)/xsd/tree/xsd-cxx.make) -endif - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/tests/cxx/tree/binary/polymorphic/test.xml b/tests/cxx/tree/binary/polymorphic/test.xml deleted file mode 100644 index ad3a403..0000000 --- a/tests/cxx/tree/binary/polymorphic/test.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - 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/tests/cxx/tree/binary/polymorphic/test.xsd b/tests/cxx/tree/binary/polymorphic/test.xsd deleted file mode 100644 index 8c214e5..0000000 --- a/tests/cxx/tree/binary/polymorphic/test.xsd +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/cxx/tree/binary/xdr-ordered/driver.cxx b/tests/cxx/tree/binary/xdr-ordered/driver.cxx deleted file mode 100644 index 8e2d845..0000000 --- a/tests/cxx/tree/binary/xdr-ordered/driver.cxx +++ /dev/null @@ -1,189 +0,0 @@ -// 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 (char* 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 (char* 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); -} - -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 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/tests/cxx/tree/binary/xdr-ordered/makefile b/tests/cxx/tree/binary/xdr-ordered/makefile deleted file mode 100644 index df3a945..0000000 --- a/tests/cxx/tree/binary/xdr-ordered/makefile +++ /dev/null @@ -1,85 +0,0 @@ -# file : tests/cxx/tree/binary/xdr-ordered/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make - -xsd := test.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$(out_base) -I$(src_base) -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 += --generate-insertion XDR --generate-extraction XDR \ ---generate-comparison --ordered-type-all -$(gen): $(out_root)/xsd/xsd - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Test. -# -$(test): driver := $(driver) -$(test): $(driver) $(src_base)/test.xml - $(call message,test $$1,$$1 $(src_base)/test.xml,$(driver)) - -# 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,$(bld_root)/cxx/standard.make) # cxx_standard -ifdef cxx_standard -$(gen): xsd_options += --std $(cxx_standard) -$(call include,$(scf_root)/xsd/tree/xsd-cxx.make) -endif - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/tests/cxx/tree/binary/xdr-ordered/test.xml b/tests/cxx/tree/binary/xdr-ordered/test.xml deleted file mode 100644 index 5cedd98..0000000 --- a/tests/cxx/tree/binary/xdr-ordered/test.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - 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/tests/cxx/tree/binary/xdr-ordered/test.xsd b/tests/cxx/tree/binary/xdr-ordered/test.xsd deleted file mode 100644 index 0629e94..0000000 --- a/tests/cxx/tree/binary/xdr-ordered/test.xsd +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/cxx/tree/binary/xdr/driver.cxx b/tests/cxx/tree/binary/xdr/driver.cxx deleted file mode 100644 index f5912c5..0000000 --- a/tests/cxx/tree/binary/xdr/driver.cxx +++ /dev/null @@ -1,187 +0,0 @@ -// 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 (char* 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 (char* 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); -} - -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 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/tests/cxx/tree/binary/xdr/makefile b/tests/cxx/tree/binary/xdr/makefile deleted file mode 100644 index dca3230..0000000 --- a/tests/cxx/tree/binary/xdr/makefile +++ /dev/null @@ -1,85 +0,0 @@ -# file : tests/cxx/tree/binary/xdr/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make - -xsd := test.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$(out_base) -I$(src_base) -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 += --generate-insertion XDR --generate-extraction XDR \ ---generate-comparison -$(gen): $(out_root)/xsd/xsd - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Test. -# -$(test): driver := $(driver) -$(test): $(driver) $(src_base)/test.xml - $(call message,test $$1,$$1 $(src_base)/test.xml,$(driver)) - -# 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,$(bld_root)/cxx/standard.make) # cxx_standard -ifdef cxx_standard -$(gen): xsd_options += --std $(cxx_standard) -$(call include,$(scf_root)/xsd/tree/xsd-cxx.make) -endif - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/tests/cxx/tree/binary/xdr/test.xml b/tests/cxx/tree/binary/xdr/test.xml deleted file mode 100644 index 5cedd98..0000000 --- a/tests/cxx/tree/binary/xdr/test.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - 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/tests/cxx/tree/binary/xdr/test.xsd b/tests/cxx/tree/binary/xdr/test.xsd deleted file mode 100644 index 0629e94..0000000 --- a/tests/cxx/tree/binary/xdr/test.xsd +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.1