summaryrefslogtreecommitdiff
path: root/tests/cxx/tree/list
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-09-17 07:15:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-09-17 07:15:29 +0200
commitf0510d2f90467de8e8f260b47d79a9baaf9bef17 (patch)
tree0b9929946f06a9cbe9b9e8f2a7600dae4e048f79 /tests/cxx/tree/list
Start tracking XSD with git
Diffstat (limited to 'tests/cxx/tree/list')
-rw-r--r--tests/cxx/tree/list/ctor/driver.cxx52
-rw-r--r--tests/cxx/tree/list/ctor/makefile82
-rw-r--r--tests/cxx/tree/list/ctor/test.xsd18
-rw-r--r--tests/cxx/tree/list/makefile20
4 files changed, 172 insertions, 0 deletions
diff --git a/tests/cxx/tree/list/ctor/driver.cxx b/tests/cxx/tree/list/ctor/driver.cxx
new file mode 100644
index 0000000..0cac51c
--- /dev/null
+++ b/tests/cxx/tree/list/ctor/driver.cxx
@@ -0,0 +1,52 @@
+// file : tests/cxx/tree/list/ctor/driver.cxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test list constructors.
+//
+#include <string>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main ()
+{
+ // Test ctor()
+ //
+ {
+ string_list sl;
+
+ xml_schema::nmtokens nt;
+ xml_schema::idrefs id;
+ }
+
+ // Test ctor(size_type, const X&)
+ //
+ {
+ string_list sl (10, "abc");
+ size_type st (10, 123);
+
+ xml_schema::nmtokens nt (10, "abc");
+ xml_schema::idrefs id (10, "abc");
+ }
+
+ // Test ctor(const I& begin, const I& end)
+ //
+ {
+ string_list sl1 (10, "abc");
+ string_list sl2 (sl1.begin (), sl1.end ());
+
+ I i1 (10, 123);
+ I i2 (i1.begin (), i1.end ());
+
+ xml_schema::nmtokens nt1 (10, "abc");
+ xml_schema::nmtokens nt2 (nt1.begin (), nt1.end ());
+
+ xml_schema::idrefs id1 (10, "abc");
+ xml_schema::idrefs id2 (id1.begin (), id1.end ());
+ }
+}
diff --git a/tests/cxx/tree/list/ctor/makefile b/tests/cxx/tree/list/ctor/makefile
new file mode 100644
index 0000000..1a002ae
--- /dev/null
+++ b/tests/cxx/tree/list/ctor/makefile
@@ -0,0 +1,82 @@
+# file : tests/cxx/tree/list/ctor/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC
+# 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$(src_root)/libxsd
+$(obj) $(dep): $(xerces_c.l.cpp-options)
+
+$(out_base)/$(xsd:.xsd=.hxx) \
+$(out_base)/$(xsd:.xsd=.ixx) \
+$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd
+
+$(out_base)/$(xsd:.xsd=.hxx) \
+$(out_base)/$(xsd:.xsd=.ixx) \
+$(out_base)/$(xsd:.xsd=.cxx): xsd_options := --generate-default-ctor \
+--generate-from-base-ctor --generate-doxygen
+
+$(out_base)/$(xsd:.xsd=.hxx) \
+$(out_base)/$(xsd:.xsd=.ixx) \
+$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd
+
+$(call include-dep,$(dep))
+
+# Convenience alias for default target.
+#
+.PHONY: $(out_base)/
+$(out_base)/: $(driver)
+
+
+# Test.
+#
+.PHONY: $(test)
+
+$(test): driver := $(driver)
+$(test): $(driver)
+ $(call message,test $$1,$$1,$(driver))
+
+# Clean.
+#
+.PHONY: $(clean)
+
+$(clean): $(driver).o.clean \
+ $(addsuffix .cxx.clean,$(obj)) \
+ $(addsuffix .cxx.clean,$(dep)) \
+ $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean))
+
+
+# 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,$(scf_root)/xsd/tree/xsd-cxx.make)
+
+
+# Dependencies.
+#
+$(call import,$(src_root)/xsd/makefile)
diff --git a/tests/cxx/tree/list/ctor/test.xsd b/tests/cxx/tree/list/ctor/test.xsd
new file mode 100644
index 0000000..f090bb8
--- /dev/null
+++ b/tests/cxx/tree/list/ctor/test.xsd
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="string-list">
+ <list itemType="string"/>
+ </simpleType>
+
+ <!-- Test name conflict resolution. -->
+
+ <simpleType name="size_type">
+ <list itemType="int"/>
+ </simpleType>
+
+ <simpleType name="I">
+ <list itemType="int"/>
+ </simpleType>
+
+</schema>
diff --git a/tests/cxx/tree/list/makefile b/tests/cxx/tree/list/makefile
new file mode 100644
index 0000000..9d03a72
--- /dev/null
+++ b/tests/cxx/tree/list/makefile
@@ -0,0 +1,20 @@
+# file : tests/cxx/tree/list/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
+
+tests := ctor
+
+default := $(out_base)/
+test := $(out_base)/.test
+clean := $(out_base)/.clean
+
+.PHONY: $(default) $(test) $(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))