summaryrefslogtreecommitdiff
path: root/xsd/tests/cxx/tree/containment
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 15:25:44 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 15:25:44 +0200
commit8286ac511144e4f17d34eac9affb97e50646344a (patch)
treef1af7320d7b6be6be059216d0ad08ac7b4f73fd0 /xsd/tests/cxx/tree/containment
parenta15cf65c44d5c224169c32ef5495b68c758134b7 (diff)
Imported Upstream version 4.0.0upstream/4.0.0
Diffstat (limited to 'xsd/tests/cxx/tree/containment')
-rw-r--r--xsd/tests/cxx/tree/containment/driver.cxx48
-rw-r--r--xsd/tests/cxx/tree/containment/makefile14
2 files changed, 36 insertions, 26 deletions
diff --git a/xsd/tests/cxx/tree/containment/driver.cxx b/xsd/tests/cxx/tree/containment/driver.cxx
index cb6c76e..f019de8 100644
--- a/xsd/tests/cxx/tree/containment/driver.cxx
+++ b/xsd/tests/cxx/tree/containment/driver.cxx
@@ -1,16 +1,22 @@
// file : tests/cxx/tree/containment/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 tree node containment.
//
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <cassert>
#include "test.hxx"
+#ifdef XSD_CXX11
+# include <utility> // std::move
+# define XSD_MOVE(x) std::move(x)
+#else
+# define XSD_MOVE(x) x
+#endif
+
using namespace std;
using namespace test;
@@ -20,11 +26,11 @@ main ()
// Change of a container in a sub-tree without ID.
//
{
- auto_ptr<inner> i (new inner ());
+ XSD_AUTO_PTR<inner> i (new inner ());
i->ref ("foo");
outer o;
- o.i (i);
+ o.i (XSD_MOVE (i));
o.ref ("foo");
assert (o.i ()->ref ()->get () == 0);
@@ -34,14 +40,14 @@ main ()
// Change of container in a sub-tree with ID inside.
//
{
- auto_ptr<inner> i (new inner ());
+ XSD_AUTO_PTR<inner> i (new inner ());
inner* p (i.get ());
i->id ("foo");
i->ref ("foo");
assert (i->ref ()->get () == p);
outer o;
- o.i (i);
+ o.i (XSD_MOVE (i));
o.ref ("foo");
assert (o.i ()->ref ()->get () == p);
@@ -51,10 +57,10 @@ main ()
// Change of a container in ID.
//
{
- auto_ptr<xml_schema::id> id (new xml_schema::id ("foo"));
+ XSD_AUTO_PTR<xml_schema::id> id (new xml_schema::id ("foo"));
inner i;
- i.id (id);
+ i.id (XSD_MOVE (id));
i.ref ("foo");
assert (i.ref ()->get () == &i);
}
@@ -62,12 +68,12 @@ main ()
// Change of a container in a type derived from ID with ID inside.
//
{
- auto_ptr<id_ex> id (new id_ex ("foo"));
+ XSD_AUTO_PTR<id_ex> id (new id_ex ("foo"));
id_ex* p (id.get ());
id->id ("bar");
inner i;
- i.id_ex (id);
+ i.id_ex (XSD_MOVE (id));
i.ref ("foo");
assert (i.ref ()->get () == &i);
@@ -81,28 +87,28 @@ main ()
{
id i1 ("a"), i2 ("b");
- auto_ptr<ids> ic (new ids);
+ XSD_AUTO_PTR<ids> ic (new ids);
ic->id ().push_back (i1);
ic->id ().push_back (i2);
- auto_ptr<xml_schema::idrefs> r1 (new xml_schema::idrefs);
+ XSD_AUTO_PTR<xml_schema::idrefs> r1 (new xml_schema::idrefs);
r1->push_back (xml_schema::idref ("a"));
r1->push_back (xml_schema::idref ("b"));
- auto_ptr<idref_list> r2 (new idref_list);
+ XSD_AUTO_PTR<idref_list> r2 (new idref_list);
r2->push_back (xml_schema::idref ("a"));
r2->push_back (xml_schema::idref ("b"));
- auto_ptr<idrefs1> rc1 (new idrefs1);
- auto_ptr<idrefs2> rc2 (new idrefs2);
+ XSD_AUTO_PTR<idrefs1> rc1 (new idrefs1);
+ XSD_AUTO_PTR<idrefs2> rc2 (new idrefs2);
- rc1->idrefs (r1);
- rc2->idrefs (r2);
+ rc1->idrefs (XSD_MOVE (r1));
+ rc2->idrefs (XSD_MOVE (r2));
model m;
- m.ids (ic);
- m.idrefs1 (rc1);
- m.idrefs2 (rc2);
+ m.ids (XSD_MOVE (ic));
+ m.idrefs1 (XSD_MOVE (rc1));
+ m.idrefs2 (XSD_MOVE (rc2));
assert (m.idrefs1 ().idrefs ()[0].get () != 0);
assert (m.idrefs1 ().idrefs ()[1].get () != 0);
diff --git a/xsd/tests/cxx/tree/containment/makefile b/xsd/tests/cxx/tree/containment/makefile
index fcdd792..d181fb5 100644
--- a/xsd/tests/cxx/tree/containment/makefile
+++ b/xsd/tests/cxx/tree/containment/makefile
@@ -1,6 +1,5 @@
# file : tests/cxx/tree/containment/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
@@ -27,17 +26,17 @@ $(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-default-ctor
+$(gen): xsd_options += --generate-default-ctor
$(gen): $(out_root)/xsd/xsd
-$(call include-dep,$(dep))
+$(call include-dep,$(dep),$(obj),$(gen))
# Convenience alias for default target.
#
@@ -74,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.