summaryrefslogtreecommitdiff
path: root/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2008-03-04 14:51:23 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2008-03-04 14:51:23 +0000
commit99aa8c60282c7b8072eb35eb9ac815702f5bf586 (patch)
treebda96bf8c3a4c2875a083d7b16720533c8ffeaf4 /ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp
parentc4078c377d74290ebe4e66da0b4975da91732376 (diff)
downloadATCD-99aa8c60282c7b8072eb35eb9ac815702f5bf586.tar.gz
undoing accidental deletion
Diffstat (limited to 'ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp')
-rw-r--r--ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp110
1 files changed, 110 insertions, 0 deletions
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..c8ed217b824
--- /dev/null
+++ b/ACE/contrib/utility/Test/ExH/Logic/DescriptiveException/descriptive_exception.cpp
@@ -0,0 +1,110 @@
+// 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
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include "Utility/ExH/Logic/DescriptiveException.hpp"
+
+#include <string>
+
+using std::string;
+using namespace Utility::ExH::Logic;
+
+struct E {};
+
+void postcondition (bool p)
+{
+ 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$