diff options
| author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 | 
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 | 
| commit | 8286ac511144e4f17d34eac9affb97e50646344a (patch) | |
| tree | f1af7320d7b6be6be059216d0ad08ac7b4f73fd0 /xsd/tests/cxx/tree/binary | |
| parent | a15cf65c44d5c224169c32ef5495b68c758134b7 (diff) | |
Imported Upstream version 4.0.0upstream/4.0.0
Diffstat (limited to 'xsd/tests/cxx/tree/binary')
| -rw-r--r-- | xsd/tests/cxx/tree/binary/cdr/driver.cxx | 17 | ||||
| -rw-r--r-- | xsd/tests/cxx/tree/binary/cdr/makefile | 16 | ||||
| -rw-r--r-- | xsd/tests/cxx/tree/binary/cdr/test.xml | 4 | ||||
| -rw-r--r-- | xsd/tests/cxx/tree/binary/cdr/test.xsd | 3 | ||||
| -rw-r--r-- | xsd/tests/cxx/tree/binary/makefile | 3 | ||||
| -rw-r--r-- | xsd/tests/cxx/tree/binary/polymorphic/driver.cxx | 24 | ||||
| -rw-r--r-- | xsd/tests/cxx/tree/binary/polymorphic/makefile | 17 | ||||
| -rw-r--r-- | xsd/tests/cxx/tree/binary/xdr/driver.cxx | 29 | ||||
| -rw-r--r-- | xsd/tests/cxx/tree/binary/xdr/makefile | 15 | ||||
| -rw-r--r-- | xsd/tests/cxx/tree/binary/xdr/test.xml | 4 | ||||
| -rw-r--r-- | xsd/tests/cxx/tree/binary/xdr/test.xsd | 3 | 
11 files changed, 93 insertions, 42 deletions
| diff --git a/xsd/tests/cxx/tree/binary/cdr/driver.cxx b/xsd/tests/cxx/tree/binary/cdr/driver.cxx index 42ca181..a2d7195 100644 --- a/xsd/tests/cxx/tree/binary/cdr/driver.cxx +++ b/xsd/tests/cxx/tree/binary/cdr/driver.cxx @@ -1,12 +1,11 @@  // file      : tests/cxx/tree/binary/cdr/driver.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  // Test non-polymorphic binary serialization to ACE CDR.  // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr  #include <cassert>  #include <iostream> @@ -26,7 +25,7 @@ main (int argc, char* argv[])    try    { -    auto_ptr<type> r (root (argv[1])); +    XSD_AUTO_PTR<type> r (root (argv[1]));      // Save to a CDR stream.      // @@ -38,7 +37,7 @@ main (int argc, char* argv[])      //      ACE_InputCDR ace_icdr (ace_ocdr);      xml_schema::istream<ACE_InputCDR> icdr (ace_icdr); -    auto_ptr<type> c (new type (icdr)); +    XSD_AUTO_PTR<type> c (new type (icdr));      // Compare the two.      // @@ -128,6 +127,14 @@ main (int argc, char* argv[])      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)    { diff --git a/xsd/tests/cxx/tree/binary/cdr/makefile b/xsd/tests/cxx/tree/binary/cdr/makefile index 67437dc..eb80d35 100644 --- a/xsd/tests/cxx/tree/binary/cdr/makefile +++ b/xsd/tests/cxx/tree/binary/cdr/makefile @@ -1,6 +1,5 @@  # file      : tests/cxx/tree/binary/cdr/makefile -# author    : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC  # license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make @@ -30,18 +29,18 @@ $(call import,\  #  $(driver): $(obj) $(xerces_c.l) $(ace.l) -$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(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 +$(gen): xsd_options += --generate-insertion ACE_OutputCDR \ +--generate-extraction ACE_InputCDR --generate-comparison  $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen))  # Convenience alias for default target.  # @@ -78,7 +77,12 @@ endif  $(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. diff --git a/xsd/tests/cxx/tree/binary/cdr/test.xml b/xsd/tests/cxx/tree/binary/cdr/test.xml index 928b4cf..5cedd98 100644 --- a/xsd/tests/cxx/tree/binary/cdr/test.xml +++ b/xsd/tests/cxx/tree/binary/cdr/test.xml @@ -1,6 +1,7 @@  <t:root xmlns:t="test"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -        xsi:schemaLocation="test test.xsd"> +        xsi:schemaLocation="test test.xsd" +        any_simple_type_attr="any simple content">    <list>1 2 3</list> @@ -87,5 +88,6 @@    <year_month>2001-11+02:00</year_month>    <time>21:32:52+02:00</time> +  <any_simple_type>any simple content in element</any_simple_type>  </t:root> diff --git a/xsd/tests/cxx/tree/binary/cdr/test.xsd b/xsd/tests/cxx/tree/binary/cdr/test.xsd index e593f64..0629e94 100644 --- a/xsd/tests/cxx/tree/binary/cdr/test.xsd +++ b/xsd/tests/cxx/tree/binary/cdr/test.xsd @@ -112,7 +112,10 @@        <element name="year"                  type="gYear"/>        <element name="year_month"            type="gYearMonth"/>        <element name="time"                  type="time"/> + +      <element name="any_simple_type"       type="anySimpleType"/>      </sequence> +    <attribute name="any_simple_type_attr"  type="anySimpleType" use="required"/>    </complexType>    <element name="root" type="t:type"/> diff --git a/xsd/tests/cxx/tree/binary/makefile b/xsd/tests/cxx/tree/binary/makefile index 8a242c7..7ec2f6a 100644 --- a/xsd/tests/cxx/tree/binary/makefile +++ b/xsd/tests/cxx/tree/binary/makefile @@ -1,6 +1,5 @@  # file      : tests/cxx/tree/binary/makefile -# author    : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC  # license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make diff --git a/xsd/tests/cxx/tree/binary/polymorphic/driver.cxx b/xsd/tests/cxx/tree/binary/polymorphic/driver.cxx index 3c3e057..8e7256e 100644 --- a/xsd/tests/cxx/tree/binary/polymorphic/driver.cxx +++ b/xsd/tests/cxx/tree/binary/polymorphic/driver.cxx @@ -1,16 +1,17 @@  // file      : tests/cxx/tree/binary/polymorphic/driver.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  // Test polymorphic binary serialization.  // -#include <memory> // std::auto_ptr +#include <memory> // std::auto_ptr/unique_ptr  #include <cassert>  #include <iostream>  #include <typeinfo> +#include <ace/Log_Msg.h>  // ACE_HEX_DUMP +  #include "test.hxx"  using namespace std; @@ -27,7 +28,7 @@ main (int argc, char* argv[])    try    { -    auto_ptr<type> r (root (argv[1])); +    XSD_AUTO_PTR<type> r (root (argv[1]));      // Save to a CDR stream.      // @@ -35,11 +36,24 @@ main (int argc, char* argv[])      xml_schema::ostream<ACE_OutputCDR> 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<ACE_InputCDR> icdr (ace_icdr); -    auto_ptr<type> c (new type (icdr)); +    XSD_AUTO_PTR<type> c (new type (icdr));      // Compare the two.      // diff --git a/xsd/tests/cxx/tree/binary/polymorphic/makefile b/xsd/tests/cxx/tree/binary/polymorphic/makefile index 7e97e00..05c5186 100644 --- a/xsd/tests/cxx/tree/binary/polymorphic/makefile +++ b/xsd/tests/cxx/tree/binary/polymorphic/makefile @@ -1,6 +1,5 @@  # file      : tests/cxx/tree/binary/polymorphic/makefile -# author    : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC  # license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make @@ -30,18 +29,19 @@ $(call import,\  #  $(driver): $(obj) $(xerces_c.l) $(ace.l) -$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(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 +$(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)) +$(call include-dep,$(dep),$(obj),$(gen))  # Convenience alias for default target.  # @@ -78,7 +78,12 @@ endif  $(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. diff --git a/xsd/tests/cxx/tree/binary/xdr/driver.cxx b/xsd/tests/cxx/tree/binary/xdr/driver.cxx index cf2a264..623a953 100644 --- a/xsd/tests/cxx/tree/binary/xdr/driver.cxx +++ b/xsd/tests/cxx/tree/binary/xdr/driver.cxx @@ -1,12 +1,11 @@  // file      : tests/cxx/tree/binary/xdr/driver.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  // Test non-polymorphic binary serialization to XDR.  // -#include <memory>  // std::auto_ptr +#include <memory>  // std::auto_ptr/unique_ptr  #include <cstring> // std::memcpy  #include <cassert>  #include <iostream> @@ -17,15 +16,15 @@ using namespace std;  using namespace test;  extern "C" int -overflow (char* p, char* buf, int n) +overflow (char* p, char* buf, int in)  {    xml_schema::buffer* dst (reinterpret_cast<xml_schema::buffer*> (p)); -  std::size_t size (dst->size ()); +  size_t n (static_cast<size_t> (in)), size (dst->size ());    dst->size (size + n);    memcpy (dst->data () + size, buf, n); -  return n; +  return static_cast<int> (n);  }  struct underflow_info @@ -35,17 +34,17 @@ struct underflow_info  };  extern "C" int -underflow (char* p, char* buf, int n) +underflow (char* p, char* buf, int in)  {    underflow_info* ui (reinterpret_cast<underflow_info*> (p)); -  std::size_t size (ui->buf->size () - ui->pos); +  size_t n (static_cast<size_t> (in)), size (ui->buf->size () - ui->pos);    n = size > n ? n : size;    memcpy (buf, ui->buf->data () + ui->pos, n);    ui->pos += n; -  return n; +  return static_cast<int> (n);  }  int @@ -59,7 +58,7 @@ main (int argc, char* argv[])    try    { -    auto_ptr<type> r (root (argv[1])); +    XSD_AUTO_PTR<type> r (root (argv[1]));      // Save to an XDR stream.      // @@ -81,7 +80,7 @@ main (int argc, char* argv[])      xdr.x_op = XDR_DECODE;      xdrrec_skiprecord (&xdr);      xsd::cxx::tree::istream<XDR> ixdr (xdr); -    auto_ptr<type> c (new type (ixdr)); +    XSD_AUTO_PTR<type> c (new type (ixdr));      xdr_destroy (&xdr);      // Compare the two. @@ -172,6 +171,14 @@ main (int argc, char* argv[])      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)    { diff --git a/xsd/tests/cxx/tree/binary/xdr/makefile b/xsd/tests/cxx/tree/binary/xdr/makefile index 7b3089b..2994134 100644 --- a/xsd/tests/cxx/tree/binary/xdr/makefile +++ b/xsd/tests/cxx/tree/binary/xdr/makefile @@ -1,6 +1,5 @@  # file      : tests/cxx/tree/binary/xdr/makefile -# author    : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC  # license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make @@ -26,17 +25,18 @@ $(call import,\  #  $(driver): $(obj) $(xerces_c.l) -$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(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 +$(gen): xsd_options += --generate-insertion XDR --generate-extraction XDR \ +--generate-comparison  $(gen): $(out_root)/xsd/xsd -$(call include-dep,$(dep)) +$(call include-dep,$(dep),$(obj),$(gen))  # Convenience alias for default target.  # @@ -73,7 +73,12 @@ endif  $(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. diff --git a/xsd/tests/cxx/tree/binary/xdr/test.xml b/xsd/tests/cxx/tree/binary/xdr/test.xml index 928b4cf..5cedd98 100644 --- a/xsd/tests/cxx/tree/binary/xdr/test.xml +++ b/xsd/tests/cxx/tree/binary/xdr/test.xml @@ -1,6 +1,7 @@  <t:root xmlns:t="test"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -        xsi:schemaLocation="test test.xsd"> +        xsi:schemaLocation="test test.xsd" +        any_simple_type_attr="any simple content">    <list>1 2 3</list> @@ -87,5 +88,6 @@    <year_month>2001-11+02:00</year_month>    <time>21:32:52+02:00</time> +  <any_simple_type>any simple content in element</any_simple_type>  </t:root> diff --git a/xsd/tests/cxx/tree/binary/xdr/test.xsd b/xsd/tests/cxx/tree/binary/xdr/test.xsd index e593f64..0629e94 100644 --- a/xsd/tests/cxx/tree/binary/xdr/test.xsd +++ b/xsd/tests/cxx/tree/binary/xdr/test.xsd @@ -112,7 +112,10 @@        <element name="year"                  type="gYear"/>        <element name="year_month"            type="gYearMonth"/>        <element name="time"                  type="time"/> + +      <element name="any_simple_type"       type="anySimpleType"/>      </sequence> +    <attribute name="any_simple_type_attr"  type="anySimpleType" use="required"/>    </complexType>    <element name="root" type="t:type"/> | 
