diff options
Diffstat (limited to 'tests/cxx/serializer/test-template')
-rw-r--r-- | tests/cxx/serializer/test-template/driver.cxx | 48 | ||||
-rw-r--r-- | tests/cxx/serializer/test-template/makefile | 72 | ||||
-rw-r--r-- | tests/cxx/serializer/test-template/output | 1 | ||||
-rw-r--r-- | tests/cxx/serializer/test-template/test.xsd | 12 |
4 files changed, 133 insertions, 0 deletions
diff --git a/tests/cxx/serializer/test-template/driver.cxx b/tests/cxx/serializer/test-template/driver.cxx new file mode 100644 index 0000000..784f223 --- /dev/null +++ b/tests/cxx/serializer/test-template/driver.cxx @@ -0,0 +1,48 @@ +// file : tests/cxx/serializer/test-template/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 + +// Insert test description here. +// + +#include <iostream> + +#include "test-sskel.hxx" + +using namespace std; +using namespace test; + +struct root_simpl: root_sskel +{ + virtual void + pre () + { + } + + virtual int + a () + { + return 1234; + } + + virtual void + post_type () + { + } +}; + +int +main () +{ + xml_schema::int_simpl int_s; + root_simpl root_s; + + root_s.serializers (int_s); + + xml_schema::document_simpl doc_s (root_s, "test", "root"); + + root_s.pre (); + doc_s.serialize (cout); + root_s.post (); +} diff --git a/tests/cxx/serializer/test-template/makefile b/tests/cxx/serializer/test-template/makefile new file mode 100644 index 0000000..28e1f5f --- /dev/null +++ b/tests/cxx/serializer/test-template/makefile @@ -0,0 +1,72 @@ +# file : tests/cxx/serializer/test-template/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=-sskel.o)) +dep := $(obj:.o=.o.d) + +xsde.l := $(out_root)/libxsde/xsde/xsde.l +xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options + +driver := $(out_base)/driver +test := $(out_base)/.test +clean := $(out_base)/.clean + + +# Build. +# +$(driver): $(obj) $(xsde.l) + +$(obj) $(dep): $(xsde.l.cpp-options) + +skel := $(out_base)/$(xsd:.xsd=-sskel.hxx) \ + $(out_base)/$(xsd:.xsd=-sskel.ixx) \ + $(out_base)/$(xsd:.xsd=-sskel.cxx) + +$(skel): xsde := $(out_root)/xsde/xsde +$(skel): $(out_root)/xsde/xsde + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Test. +# +.PHONY: $(test) + +$(test): driver := $(driver) +$(test): $(driver) $(src_base)/output + $(call message,test $$1,$$1 | diff -u $(src_base)/output -,$(driver)) + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=-sskel.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)/xsde/serializer/xsd-cxx.make) + + +# Dependencies. +# +$(call import,$(src_root)/xsde/makefile) +$(call import,$(src_root)/libxsde/xsde/makefile) diff --git a/tests/cxx/serializer/test-template/output b/tests/cxx/serializer/test-template/output new file mode 100644 index 0000000..509a8ed --- /dev/null +++ b/tests/cxx/serializer/test-template/output @@ -0,0 +1 @@ +<g1:root xmlns:g1="test"><a>1234</a></g1:root>
\ No newline at end of file diff --git a/tests/cxx/serializer/test-template/test.xsd b/tests/cxx/serializer/test-template/test.xsd new file mode 100644 index 0000000..164b72c --- /dev/null +++ b/tests/cxx/serializer/test-template/test.xsd @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test"> + + <complexType name="root"> + <sequence> + <element name="a" type="int"/> + </sequence> + </complexType> + + <element name="root" type="t:root"/> + +</schema> |