summaryrefslogtreecommitdiff
path: root/test/unit/expr/kind_black.h
diff options
context:
space:
mode:
authorTim King <taking@cs.nyu.edu>2010-02-25 01:05:40 +0000
committerTim King <taking@cs.nyu.edu>2010-02-25 01:05:40 +0000
commitf716b67e7bedd90c4dd43617158c0f55c1811334 (patch)
treea0a6755d1ebad6ddebbdf96d9bcc05d591fba72a /test/unit/expr/kind_black.h
parentff9bda51dfb047af2005f464847edd61314bb50c (diff)
Created basic node builder and kind tests. Also fixed a couple of node builder problems.
Diffstat (limited to 'test/unit/expr/kind_black.h')
-rw-r--r--test/unit/expr/kind_black.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/test/unit/expr/kind_black.h b/test/unit/expr/kind_black.h
new file mode 100644
index 000000000..35c5fde16
--- /dev/null
+++ b/test/unit/expr/kind_black.h
@@ -0,0 +1,89 @@
+/********************* */
+/** kind_black.h
+ ** Original author: taking
+ ** 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::Kind.
+ **/
+
+#include <cxxtest/TestSuite.h>
+
+#include <iostream>
+#include <string>
+#include <sstream>
+
+#include "expr/kind.h"
+
+using namespace CVC4;
+using namespace std;
+
+class KindBlack : public CxxTest::TestSuite {
+ Kind undefined;
+ Kind null;
+ Kind last;
+
+ //easier to define in setup
+ int beyond;
+ Kind unknown;
+public:
+ void setUp() {
+ undefined = UNDEFINED_KIND;
+ null = NULL_EXPR;
+ last = LAST_KIND;
+ beyond = ((int) LAST_KIND) + 1;
+ unknown = (Kind) beyond;
+ }
+
+
+ void testEquality(){
+
+ TS_ASSERT_EQUALS(undefined, UNDEFINED_KIND);
+ TS_ASSERT_EQUALS(last, LAST_KIND);
+ }
+
+ void testOrder(){
+ TS_ASSERT_LESS_THAN(int(undefined), int(null));
+ TS_ASSERT_LESS_THAN(int(null), int(last));
+ TS_ASSERT_LESS_THAN(int(undefined), int(last));
+ TS_ASSERT_LESS_THAN(int(last), int(unknown));
+ }
+
+ bool stringIsAsExpected(Kind k, const char * s){
+ stringstream act;
+ stringstream exp;
+
+ act << k;
+ exp << s;
+
+ string actCreated = act.str();
+ string expCreated = exp.str();
+ return actCreated == expCreated;
+ }
+
+ void testOperatorLtLt() {
+
+ TS_ASSERT(stringIsAsExpected(undefined, "UNDEFINED_KIND"));
+ TS_ASSERT(stringIsAsExpected(null, "NULL"));
+ TS_ASSERT(stringIsAsExpected(last, "LAST_KIND"));
+
+ }
+ void testOperatorLtLtConcat() {
+
+ stringstream act, exp;
+ act << undefined << null << last << unknown;
+ exp << "UNDEFINED_KIND" << "NULL" << "LAST_KIND" << "UNKNOWNKIND!"<< beyond;
+
+ string actCreated = act.str();
+ string expCreated = exp.str();
+
+ TS_ASSERT_EQUALS(actCreated, expCreated);
+ }
+
+};
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback