summaryrefslogtreecommitdiff
path: root/test/unit/util/exception_black.h
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2010-04-09 16:25:32 +0000
committerMorgan Deters <mdeters@gmail.com>2010-04-09 16:25:32 +0000
commite390a4207d3858927354b3d4b40d540c00f8064c (patch)
tree589fd13ed8f6ba835cd79a2894092860b66b7696 /test/unit/util/exception_black.h
parentc3a6ff8c6e4a0c743cd33eb29931f837eeb2959e (diff)
added experimental "make lcov" target (it runs only unit tests); better coverage for util and context classes; implemented some output functionality that was missing; reclassified some tests white -> black or black -> public; other minor fixes
Diffstat (limited to 'test/unit/util/exception_black.h')
-rw-r--r--test/unit/util/exception_black.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/unit/util/exception_black.h b/test/unit/util/exception_black.h
new file mode 100644
index 000000000..758a12645
--- /dev/null
+++ b/test/unit/util/exception_black.h
@@ -0,0 +1,58 @@
+/********************* */
+/** exception_black.h
+ ** Original author: mdeters
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 prototype.
+ ** Copyright (c) 2009, 2010 The Analysis of Computer Systems Group (ACSys)
+ ** Courant Institute of Mathematical Sciences
+ ** New York University
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.
+ **
+ ** Black box testing of CVC4::Exception.
+ **/
+
+#include <cxxtest/TestSuite.h>
+
+#include <iostream>
+#include <sstream>
+
+#include "util/exception.h"
+
+using namespace CVC4;
+using namespace std;
+
+class ExceptionBlack : public CxxTest::TestSuite {
+public:
+
+ void setUp() {
+ }
+
+ void tearDown() {
+ }
+
+ // CVC4::Exception is a simple class, just test it all at once.
+ void testExceptions() {
+ Exception e1;
+ Exception e2(string("foo!"));
+ Exception e3("bar!");
+
+ TS_ASSERT_EQUALS(e1.toString(), string("Unknown exception"));
+ TS_ASSERT_EQUALS(e2.toString(), string("foo!"));
+ TS_ASSERT_EQUALS(e3.toString(), string("bar!"));
+
+ e1.setMessage("blah");
+ e2.setMessage("another");
+ e3.setMessage("three of 'em!");
+
+ stringstream s1, s2, s3;
+ s1 << e1;
+ s2 << e2;
+ s3 << e3;
+
+ TS_ASSERT_EQUALS(s1.str(), string("blah"));
+ TS_ASSERT_EQUALS(s2.str(), string("another"));
+ TS_ASSERT_EQUALS(s3.str(), string("three of 'em!"));
+ }
+};
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback