summaryrefslogtreecommitdiff
path: root/ACE/contrib/utility/Test/ExH
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/contrib/utility/Test/ExH')
-rw-r--r--ACE/contrib/utility/Test/ExH/Compound/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ExH/Compound/compound.cpp115
-rw-r--r--ACE/contrib/utility/Test/ExH/Converter/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ExH/Converter/converter.cpp48
-rw-r--r--ACE/contrib/utility/Test/ExH/Inline/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ExH/Inline/inline.cpp18
-rw-r--r--ACE/contrib/utility/Test/ExH/Inline/unit.cpp8
-rw-r--r--ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp108
-rw-r--r--ACE/contrib/utility/Test/ExH/Logic/Makefile16
-rw-r--r--ACE/contrib/utility/Test/ExH/Makefile16
-rw-r--r--ACE/contrib/utility/Test/ExH/System/DescriptiveException/Makefile24
-rw-r--r--ACE/contrib/utility/Test/ExH/System/DescriptiveException/descriptive_exception.cpp107
-rw-r--r--ACE/contrib/utility/Test/ExH/System/Makefile16
14 files changed, 572 insertions, 0 deletions
diff --git a/ACE/contrib/utility/Test/ExH/Compound/Makefile b/ACE/contrib/utility/Test/ExH/Compound/Makefile
new file mode 100644
index 00000000000..b596cd2fbce
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Compound/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ExH/Compound/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := compound.cpp
+
+module_base := compound
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/Compound/compound.cpp b/ACE/contrib/utility/Test/ExH/Compound/compound.cpp
new file mode 100644
index 00000000000..d3319f5d7dc
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Compound/compound.cpp
@@ -0,0 +1,115 @@
+// file : Test/ExH/Compound/compound.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/Compound.hpp"
+
+#include <string>
+
+using namespace Utility::ExH;
+
+struct E {};
+
+void postcondition (bool p) throw (E)
+{
+ if (!p) throw E ();
+}
+
+class Base
+{
+protected:
+ Base () throw ()
+ {
+ }
+
+ void
+ init (char const* description) throw ()
+ {
+ str_ = description;
+ }
+
+ char const*
+ what () const throw ()
+ {
+ return str_.c_str ();
+ }
+
+public:
+ std::string str_;
+};
+
+class A_ {};
+typedef
+Compound<A_, Base>
+A;
+
+struct StringHolder
+{
+ StringHolder (char const* s)
+ : str_ (s)
+ {
+ }
+
+ operator std::string () const
+ {
+ return str_;
+ }
+
+ std::string str_;
+};
+
+
+int main ()
+{
+ try
+ {
+ // Compound (char const*)
+ //
+ {
+ A a ("hello");
+
+ postcondition (a.str_ == "hello");
+ }
+
+ // Compound (T const&)
+ //
+ {
+ StringHolder a ("hello");
+ A b (a);
+
+ postcondition (b.str_ == "hello");
+ }
+
+ // Compound (Compound const&)
+ //
+ {
+ A a ("hello");
+ A b (a);
+
+ postcondition (b.str_ == "hello");
+ }
+
+ // ~Compound ()
+ //
+
+ // operator= (Compound const&)
+ //
+ {
+ A a ("hello");
+ A b ("foo");
+ b = a;
+
+ postcondition (b.str_ == "hello");
+ }
+
+ // Compound ()
+ //
+
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/ExH/Converter/Makefile b/ACE/contrib/utility/Test/ExH/Converter/Makefile
new file mode 100644
index 00000000000..3f37652482d
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Converter/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ExH/Converter/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := converter.cpp
+
+module_base := converter
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/Converter/converter.cpp b/ACE/contrib/utility/Test/ExH/Converter/converter.cpp
new file mode 100644
index 00000000000..396b616e6a6
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Converter/converter.cpp
@@ -0,0 +1,48 @@
+// file : Test/ExH/Converter/converter.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/Converter.hpp"
+#include "Utility/ExH/StringStreamConverter.hpp"
+
+#include <string>
+#include <sstream>
+
+using std::string;
+using namespace Utility::ExH;
+
+struct E {};
+
+void postcondition (bool p) throw (E)
+{
+ if (!p) throw E ();
+}
+
+int
+main ()
+{
+ try
+ {
+ // template<T>
+ // converter (T const&)
+ //
+ {
+ postcondition (converter ("hello") == string("hello"));
+ }
+
+ // template<>
+ // converter (std::ostringstream const&)
+ //
+ {
+ std::ostringstream ostr;
+ ostr << "hello";
+ postcondition (converter (ostr) == string("hello"));
+ }
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/ExH/Inline/Makefile b/ACE/contrib/utility/Test/ExH/Inline/Makefile
new file mode 100644
index 00000000000..26606c35669
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Inline/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ExH/Inline/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := inline.cpp unit.cpp
+
+module_base := inline
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/Inline/inline.cpp b/ACE/contrib/utility/Test/ExH/Inline/inline.cpp
new file mode 100644
index 00000000000..7700728932f
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Inline/inline.cpp
@@ -0,0 +1,18 @@
+// file : Test/ExH/Inline/inline.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+//
+// This is a link-time test to detect any problems with inline functions
+// (notably missing inline specifier).
+//
+
+#include "Utility/ExH/ExH.hpp"
+
+int
+main ()
+{
+}
+
+//$Id$
diff --git a/ACE/contrib/utility/Test/ExH/Inline/unit.cpp b/ACE/contrib/utility/Test/ExH/Inline/unit.cpp
new file mode 100644
index 00000000000..8a57af7d759
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Inline/unit.cpp
@@ -0,0 +1,8 @@
+// file : Test/ExH/Inline/unit.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/ExH.hpp"
+
+//$Id$
diff --git a/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/Makefile b/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/Makefile
new file mode 100644
index 00000000000..6ca8e6029ee
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ExH/Logic/DescriptiveException/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := descriptive_exception.cpp
+
+module_base := descriptive_exception
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp b/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp
new file mode 100644
index 00000000000..7c3246df491
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp
@@ -0,0 +1,108 @@
+// file : Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+#include <string>
+
+using std::string;
+using namespace Utility::ExH::Logic;
+
+struct E {};
+
+void postcondition (bool p) throw (E)
+{
+ if (!p) throw E ();
+}
+
+struct StringHolder
+{
+ StringHolder (char const* s)
+ : str_ (s)
+ {
+ }
+
+ operator std::string () const
+ {
+ return str_;
+ }
+
+ string str_;
+};
+
+int
+main ()
+{
+ try
+ {
+ // DescriptiveException (char const*)
+ //
+ {
+ DescriptiveException a ("hello");
+
+ postcondition (a.what () == string ("hello"));
+ }
+
+ // DescriptiveException (std::string const&)
+ //
+ {
+ DescriptiveException a (string ("hello"));
+
+ postcondition (a.what () == string ("hello"));
+ }
+
+
+ // DescriptiveException (T const&)
+ //
+ {
+ StringHolder a ("hello");
+
+ DescriptiveException b (a);
+
+ postcondition (b.what () == string ("hello"));
+ }
+
+ // DescriptiveException (DescriptiveException const&)
+ //
+ {
+ DescriptiveException a ("hello");
+ DescriptiveException b (a);
+
+ postcondition (b.what () == string ("hello"));
+ }
+
+ // ~DescriptiveException
+ //
+
+ // operator= (DescriptiveException const&)
+ //
+ {
+ DescriptiveException a ("hello");
+ DescriptiveException b ("foo");
+ b = a;
+
+ postcondition (b.what () == string ("hello"));
+ }
+
+ // DescriptiveException ()
+ //
+
+ // init (char const*)
+ //
+
+ // what ()
+ //
+ {
+ DescriptiveException a ("hello");
+
+ postcondition (a.what () == string ("hello"));
+ }
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/ExH/Logic/Makefile b/ACE/contrib/utility/Test/ExH/Logic/Makefile
new file mode 100644
index 00000000000..042b3a172a4
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Logic/Makefile
@@ -0,0 +1,16 @@
+# file : Test/ExH/Logic/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := DescriptiveException
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/Makefile b/ACE/contrib/utility/Test/ExH/Makefile
new file mode 100644
index 00000000000..161884a439c
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Makefile
@@ -0,0 +1,16 @@
+# file : Test/ExH/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := Compound Converter Inline Logic System
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/System/DescriptiveException/Makefile b/ACE/contrib/utility/Test/ExH/System/DescriptiveException/Makefile
new file mode 100644
index 00000000000..9fd89d86ade
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/System/DescriptiveException/Makefile
@@ -0,0 +1,24 @@
+# file : Test/ExH/System/DescriptiveException/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Executable.pre.rules)
+
+
+cxx_translation_units := descriptive_exception.cpp
+
+module_base := descriptive_exception
+module_prefix :=
+module_suffix :=
+
+
+CXX_PREPROCESS_FLAGS += -I $(root)
+
+
+$(call include, $(root)/BuildRules/Executable.post.rules)
+# $Id$
diff --git a/ACE/contrib/utility/Test/ExH/System/DescriptiveException/descriptive_exception.cpp b/ACE/contrib/utility/Test/ExH/System/DescriptiveException/descriptive_exception.cpp
new file mode 100644
index 00000000000..4cd14da8627
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/System/DescriptiveException/descriptive_exception.cpp
@@ -0,0 +1,107 @@
+// file : Test/ExH/System/DescriptiveException/descriptive_exception.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+#include "Utility/ExH/System/DescriptiveException.hpp"
+
+#include <string>
+
+using std::string;
+using namespace Utility::ExH::System;
+
+struct E {};
+
+void postcondition (bool p) throw (E)
+{
+ if (!p) throw E ();
+}
+
+struct StringHolder
+{
+ StringHolder (char const* s)
+ : str_ (s)
+ {
+ }
+
+ operator std::string () const
+ {
+ return str_;
+ }
+
+ string str_;
+};
+
+int
+main ()
+{
+ try
+ {
+ // DescriptiveException (char const*)
+ //
+ {
+ DescriptiveException a ("hello");
+
+ postcondition (a.what () == string ("hello"));
+ }
+
+ // DescriptiveException (std::string const&)
+ //
+ {
+ DescriptiveException a (string ("hello"));
+
+ postcondition (a.what () == string ("hello"));
+ }
+
+ // DescriptiveException (T const&)
+ //
+ {
+ StringHolder a ("hello");
+
+ DescriptiveException b (a);
+
+ postcondition (b.what () == string ("hello"));
+ }
+
+ // DescriptiveException (DescriptiveException const&)
+ //
+ {
+ DescriptiveException a ("hello");
+ DescriptiveException b (a);
+
+ postcondition (b.what () == string ("hello"));
+ }
+
+ // ~DescriptiveException
+ //
+
+ // operator= (DescriptiveException const&)
+ //
+ {
+ DescriptiveException a ("hello");
+ DescriptiveException b ("foo");
+ b = a;
+
+ postcondition (b.what () == string ("hello"));
+ }
+
+ // DescriptiveException ()
+ //
+
+ // init (char const*)
+ //
+
+ // what ()
+ //
+ {
+ DescriptiveException a ("hello");
+
+ postcondition (a.what () == string ("hello"));
+ }
+ }
+ catch (...)
+ {
+ return -1;
+ }
+}
+//$Id$
diff --git a/ACE/contrib/utility/Test/ExH/System/Makefile b/ACE/contrib/utility/Test/ExH/System/Makefile
new file mode 100644
index 00000000000..2ffea12a6ed
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/System/Makefile
@@ -0,0 +1,16 @@
+# file : Test/ExH/System/Makefile
+# author : Boris Kolpackov <boris@kolpackov.net>
+# copyright : Copyright (c) 2002-2003 Boris Kolpackov
+# license : http://kolpackov.net/license.html
+
+root := ../../..
+
+include $(root)/BuildRules/Bootstrap.rules
+
+$(call include, $(root)/BuildRules/Recursion.pre.rules)
+
+target_makefile_list :=
+target_directory_list := DescriptiveException
+
+$(call include, $(root)/BuildRules/Recursion.post.rules)
+# $Id$