This PR adds a C++ unit test that explicitly calls into API functions that are not exposed by the java API. This fixes the issue of false positives in our API coverage checks, as some parts of the C++ API are legitimately not used by the java API.
It also corrects a few other minor issues.
Stat::~Stat() {}
Stat::Stat(const Stat& s)
: d_internal(s.d_internal),
- d_default(s.d_default),
- d_data(std::make_unique<StatData>(s.d_data->data))
+ d_default(s.d_default)
{
+ if (s.d_data)
+ {
+ d_data = std::make_unique<StatData>(s.d_data->data);
+ }
}
Stat& Stat::operator=(const Stat& s)
{
d_internal = s.d_internal;
d_default = s.d_default;
- d_data = std::make_unique<StatData>(s.d_data->data);
+ if (s.d_data)
+ {
+ d_data = std::make_unique<StatData>(s.d_data->data);
+ }
return *this;
}
cvc5_add_java_api_test(SolverTest)
cvc5_add_java_api_test(SortTest)
cvc5_add_java_api_test(TermTest)
+
+cvc5_add_unit_test_white(UncoveredTest api/java)
for (Statistics.ConstIterator it = stats.iterator(true, true); it.hasNext();)
{
Map.Entry<String, Stat> elem = it.next();
- if (elem.getKey() == "cvc5::CONSTANT")
+ if (elem.getKey().equals("cvc5::CONSTANT"))
{
assertFalse(elem.getValue().isInternal());
assertFalse(elem.getValue().isDefault());
assertFalse(hist.isEmpty());
assertEquals(elem.getValue().toString(), "{ integer type: 1 }");
}
- else if (elem.getKey() == "theory::arrays::avgIndexListLength")
+ else if (elem.getKey().equals("theory::arrays::avgIndexListLength"))
{
assertTrue(elem.getValue().isInternal());
- assertTrue(elem.getValue().isDefault());
+ assertTrue(elem.getValue().isDouble());
+ assertTrue(Double.isNaN(elem.getValue().getDouble()));
}
}
}
--- /dev/null
+/******************************************************************************
+ * Top contributors (to current version):
+ * Aina Niemetz, Mathias Preiner, Andrew Reynolds
+ *
+ * This file is part of the cvc5 project.
+ *
+ * Copyright (c) 2009-2022 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.
+ * ****************************************************************************
+ *
+ * Testing stuff that is not exposed by the Java API to fix code coverage
+ */
+
+#include "test_api.h"
+
+namespace cvc5::internal {
+
+namespace test {
+
+class TestApiBlackUncovered : public TestApi
+{
+};
+
+TEST_F(TestApiBlackUncovered, streaming_operators)
+{
+ std::stringstream ss;
+ ss << cvc5::modes::LearnedLitType::PREPROCESS;
+ ss << cvc5::SynthResult();
+}
+
+TEST_F(TestApiBlackUncovered, Options)
+{
+ auto dopts = d_solver.getDriverOptions();
+ dopts.err();
+ dopts.in();
+ dopts.out();
+}
+
+TEST_F(TestApiBlackUncovered, Statistics)
+{
+ Stat stat;
+ stat = Stat();
+ Statistics stats = d_solver.getStatistics();
+ auto it = stats.begin();
+ it++;
+ it--;
+ ++it;
+ --it;
+}
+
+} // namespace test
+} // namespace cvc5::internal