summaryrefslogtreecommitdiff
path: root/xsd/tests/cxx/tree/binary/xdr/driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/tests/cxx/tree/binary/xdr/driver.cxx')
-rw-r--r--xsd/tests/cxx/tree/binary/xdr/driver.cxx29
1 files changed, 18 insertions, 11 deletions
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)
{