summaryrefslogtreecommitdiff
path: root/test/unit/expr/kind_black.cpp
diff options
context:
space:
mode:
authorAina Niemetz <aina.niemetz@gmail.com>2020-12-10 06:11:43 -0800
committerGitHub <noreply@github.com>2020-12-10 15:11:43 +0100
commitad8d70c5481266a58ceefe41fc0ec46083ba5d6e (patch)
tree3536affb969a1e5212301a53f0af3250104e9caf /test/unit/expr/kind_black.cpp
parentcc6e04b4572180596ae25001d4a1b99884030a62 (diff)
google test: expr: Migrate kind_black. (#5634)
Diffstat (limited to 'test/unit/expr/kind_black.cpp')
-rw-r--r--test/unit/expr/kind_black.cpp90
1 files changed, 90 insertions, 0 deletions
diff --git a/test/unit/expr/kind_black.cpp b/test/unit/expr/kind_black.cpp
new file mode 100644
index 000000000..93b7c15cb
--- /dev/null
+++ b/test/unit/expr/kind_black.cpp
@@ -0,0 +1,90 @@
+/********************* */
+/*! \file kind_black.cpp
+ ** \verbatim
+ ** Top contributors (to current version):
+ ** Aina Niemetz, Tim King, Andres Noetzli
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2020 by the authors listed in the file AUTHORS
+ ** in the top-level source directory and their institutional affiliations.
+ ** All rights reserved. See the file COPYING in the top-level source
+ ** directory for licensing information.\endverbatim
+ **
+ ** \brief Black box testing of CVC4::Kind.
+ **
+ ** Black box testing of CVC4::Kind.
+ **/
+
+#include <iostream>
+#include <sstream>
+#include <string>
+
+#include "expr/kind.h"
+#include "test_expr.h"
+
+namespace CVC4 {
+
+using namespace kind;
+
+namespace test {
+
+class TestExprBlackKind : public TestExprBlack
+{
+ protected:
+ void SetUp() override
+ {
+ undefined = UNDEFINED_KIND;
+ null = NULL_EXPR;
+ last = LAST_KIND;
+ beyond = ((int32_t)LAST_KIND) + 1;
+ unknown = (Kind)beyond;
+ }
+
+ bool string_is_as_expected(Kind k, const char* s)
+ {
+ std::stringstream act;
+ std::stringstream exp;
+ act << k;
+ exp << s;
+ return act.str() == exp.str();
+ }
+
+ Kind undefined;
+ Kind unknown;
+ Kind null;
+ Kind last;
+ int32_t beyond;
+};
+
+TEST_F(TestExprBlackKind, equality)
+{
+ EXPECT_EQ(undefined, UNDEFINED_KIND);
+ EXPECT_EQ(last, LAST_KIND);
+}
+
+TEST_F(TestExprBlackKind, order)
+{
+ EXPECT_LT((int32_t)undefined, (int32_t)null);
+ EXPECT_LT((int32_t)null, (int32_t)last);
+ EXPECT_LT((int32_t)undefined, (int32_t)last);
+ EXPECT_LT((int32_t)last, (int32_t)unknown);
+}
+
+TEST_F(TestExprBlackKind, output)
+{
+ ASSERT_TRUE(string_is_as_expected(undefined, "UNDEFINED_KIND"));
+ ASSERT_TRUE(string_is_as_expected(null, "NULL"));
+ ASSERT_TRUE(string_is_as_expected(last, "LAST_KIND"));
+}
+
+TEST_F(TestExprBlackKind, output_concat)
+{
+ std::stringstream act, exp;
+ act << undefined << null << last << unknown;
+ exp << "UNDEFINED_KIND"
+ << "NULL"
+ << "LAST_KIND"
+ << "?";
+ EXPECT_EQ(act.str(), exp.str());
+}
+} // namespace test
+} // namespace CVC4
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback