aboutsummaryrefslogtreecommitdiff
path: root/tests/cxx/serializer/enumeration/driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cxx/serializer/enumeration/driver.cxx')
-rw-r--r--tests/cxx/serializer/enumeration/driver.cxx74
1 files changed, 74 insertions, 0 deletions
diff --git a/tests/cxx/serializer/enumeration/driver.cxx b/tests/cxx/serializer/enumeration/driver.cxx
new file mode 100644
index 0000000..ae200ae
--- /dev/null
+++ b/tests/cxx/serializer/enumeration/driver.cxx
@@ -0,0 +1,74 @@
+// file : tests/cxx/serializer/enumeration/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 enumeration type serialization.
+//
+
+#include <iostream>
+
+#include "test-sskel.hxx"
+
+using namespace std;
+using namespace test;
+
+struct digit_simpl: digit_sskel
+{
+ digit_simpl ()
+ : digit_sskel (&base_impl_)
+ {
+ }
+
+private:
+ xml_schema::int_simpl base_impl_;
+};
+
+struct boolean_simpl: boolean_sskel
+{
+ boolean_simpl ()
+ : boolean_sskel (&base_impl_)
+ {
+ }
+
+ virtual void
+ pre (boolean b)
+ {
+ int i = b;
+ base_impl_.pre (i);
+ }
+
+private:
+ xml_schema::int_simpl base_impl_;
+};
+
+struct root_simpl: root_sskel
+{
+ virtual int
+ digit ()
+ {
+ return 7;
+ }
+
+ virtual ::boolean
+ boolean ()
+ {
+ return TRUE;
+ }
+};
+
+int
+main ()
+{
+ digit_simpl digit_s;
+ boolean_simpl boolean_s;
+ root_simpl root_s;
+
+ root_s.serializers (digit_s, boolean_s);
+
+ xml_schema::document_simpl doc_s (root_s, "test", "root");
+
+ root_s.pre ();
+ doc_s.serialize (cout);
+ root_s.post ();
+}