aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-12-01 11:05:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-12-01 11:05:10 +0200
commit899728d08993676b01e722a28f60efb2d076534d (patch)
treeb7ad14010ad75bdc08ed3b9e4e4fe6a5f6371b4f /tests
parent238774bc0a8a1c07d5fec89135a766a3e3d8494d (diff)
Make the list type a container for its elements
Diffstat (limited to 'tests')
-rw-r--r--tests/cxx/tree/containment/driver.cxx35
-rw-r--r--tests/cxx/tree/containment/makefile2
-rw-r--r--tests/cxx/tree/containment/test.xsd32
3 files changed, 68 insertions, 1 deletions
diff --git a/tests/cxx/tree/containment/driver.cxx b/tests/cxx/tree/containment/driver.cxx
index bd9aa24..62e1a8c 100644
--- a/tests/cxx/tree/containment/driver.cxx
+++ b/tests/cxx/tree/containment/driver.cxx
@@ -74,4 +74,39 @@ main ()
i.ref ("bar");
assert (i.ref ()->get () == p);
}
+
+ // IDREF lists
+ //
+ {
+ id i1 ("a"), i2 ("b");
+
+ 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);
+ r1->push_back (xml_schema::idref ("a"));
+ r1->push_back (xml_schema::idref ("b"));
+
+ 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);
+
+ rc1->idrefs (r1);
+ rc2->idrefs (r2);
+
+ model m;
+ m.ids (ic);
+ m.idrefs1 (rc1);
+ m.idrefs2 (rc2);
+
+ assert (m.idrefs1 ().idrefs ()[0].get () != 0);
+ assert (m.idrefs1 ().idrefs ()[1].get () != 0);
+
+ assert (m.idrefs2 ().idrefs ()[0].get () != 0);
+ assert (m.idrefs2 ().idrefs ()[1].get () != 0);
+ }
}
diff --git a/tests/cxx/tree/containment/makefile b/tests/cxx/tree/containment/makefile
index e44f82e..d6f45b3 100644
--- a/tests/cxx/tree/containment/makefile
+++ b/tests/cxx/tree/containment/makefile
@@ -34,7 +34,7 @@ genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.ixx) $(xsd:.xsd=.cxx)
gen := $(addprefix $(out_base)/,$(genf))
$(gen): xsd := $(out_root)/xsd/xsd
-$(gen): xsd_options :=
+$(gen): xsd_options := --generate-default-ctor
$(gen): $(out_root)/xsd/xsd
$(call include-dep,$(dep))
diff --git a/tests/cxx/tree/containment/test.xsd b/tests/cxx/tree/containment/test.xsd
index 002bdda..72c9379 100644
--- a/tests/cxx/tree/containment/test.xsd
+++ b/tests/cxx/tree/containment/test.xsd
@@ -24,4 +24,36 @@
</sequence>
</complexType>
+ <!-- IDREF lists -->
+
+ <complexType name="id">
+ <attribute name="id" type="ID" use="required"/>
+ </complexType>
+
+ <complexType name="ids">
+ <sequence>
+ <element name="id" type="t:id" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="idrefs1">
+ <attribute name="idrefs" type="IDREFS" use="required"/>
+ </complexType>
+
+ <simpleType name="idref-list">
+ <list itemType="IDREF"/>
+ </simpleType>
+
+ <complexType name="idrefs2">
+ <attribute name="idrefs" type="t:idref-list" use="required"/>
+ </complexType>
+
+ <complexType name="model">
+ <sequence>
+ <element name="ids" type="t:ids"/>
+ <element name="idrefs1" type="t:idrefs1"/>
+ <element name="idrefs2" type="t:idrefs2"/>
+ </sequence>
+ </complexType>
+
</schema>