summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2019-03-04 08:42:50 +0100
committerGitHub <noreply@github.com>2019-03-04 08:42:50 +0100
commit1e0ae2265c676e0dcf8ecc08102579379f3ccd85 (patch)
treed0093a673dace2186d86be8bcce786758a75c442
parent866e0944565acc0fbd1fd24ee8ec76db192a86f0 (diff)
parentca15266fb4cf9e045fd9e86d768ad032ea66bd41 (diff)
Merge pull request #8653 from vespa-engine/geirst/migrate-tests-from-cppunit-to-gtest-1
Geirst/migrate tests from cppunit to gtest 1
-rw-r--r--document/src/tests/CMakeLists.txt5
-rw-r--r--document/src/tests/documentcalculatortestcase.cpp125
-rw-r--r--document/src/tests/gtest_runner.cpp2
-rw-r--r--document/src/tests/teststringutil.cpp80
-rw-r--r--document/src/tests/teststringutil.h24
-rw-r--r--documentapi/src/tests/loadtypes/CMakeLists.txt3
-rw-r--r--documentapi/src/tests/loadtypes/loadtypetest.cpp53
-rw-r--r--documentapi/src/tests/loadtypes/testrunner.cpp12
-rw-r--r--eval/src/tests/tensor/tensor_add_operation/tensor_add_operation_test.cpp2
-rw-r--r--eval/src/tests/tensor/tensor_modify_operation/tensor_modify_operation_test.cpp2
-rw-r--r--eval/src/tests/tensor/tensor_remove_operation/tensor_remove_operation_test.cpp2
-rw-r--r--metrics/src/tests/CMakeLists.txt1
-rw-r--r--metrics/src/tests/gtest_runner.cpp2
-rw-r--r--staging_vespalib/src/vespa/vespalib/gtest/gtest.h2
-rw-r--r--storage/src/tests/CMakeLists.txt1
-rw-r--r--storage/src/tests/gtest_runner.cpp2
-rw-r--r--storageapi/src/tests/CMakeLists.txt1
-rw-r--r--storageapi/src/tests/gtest_runner.cpp2
-rw-r--r--storageframework/src/tests/CMakeLists.txt1
-rw-r--r--storageframework/src/tests/gtest_runner.cpp2
-rw-r--r--vdslib/src/tests/CMakeLists.txt1
-rw-r--r--vdslib/src/tests/gtest_runner.cpp2
22 files changed, 101 insertions, 226 deletions
diff --git a/document/src/tests/CMakeLists.txt b/document/src/tests/CMakeLists.txt
index c0b46d7ccd4..b78fd66b687 100644
--- a/document/src/tests/CMakeLists.txt
+++ b/document/src/tests/CMakeLists.txt
@@ -4,9 +4,11 @@
# NOTE: All new test classes should be added here.
vespa_add_executable(document_gtest_runner_app TEST
SOURCES
+ documentcalculatortestcase.cpp
documentidtest.cpp
documentupdatetestcase.cpp
gtest_runner.cpp
+ teststringutil.cpp
DEPENDS
document
gtest
@@ -17,16 +19,13 @@ vespa_add_executable(document_gtest_runner_app TEST
vespa_add_test(
NAME document_gtest_runner_app
COMMAND document_gtest_runner_app
- DEPENDS document_gtest_runner_app
)
# Runner for unit tests written in CppUnit (DEPRECATED).
vespa_add_executable(document_testrunner_app TEST
SOURCES
- teststringutil.cpp
testbytebuffer.cpp
stringtokenizertest.cpp
- documentcalculatortestcase.cpp
buckettest.cpp
globalidtest.cpp
documenttypetestcase.cpp
diff --git a/document/src/tests/documentcalculatortestcase.cpp b/document/src/tests/documentcalculatortestcase.cpp
index e313f3f33b5..744a7556f1b 100644
--- a/document/src/tests/documentcalculatortestcase.cpp
+++ b/document/src/tests/documentcalculatortestcase.cpp
@@ -1,87 +1,52 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/document/base/testdocrepo.h>
-#include <vespa/vespalib/io/fileutil.h>
-#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/document/base/documentcalculator.h>
-#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/base/testdocrepo.h>
#include <vespa/document/fieldvalue/bytefieldvalue.h>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/fieldvalue/floatfieldvalue.h>
#include <vespa/document/fieldvalue/intfieldvalue.h>
#include <vespa/document/fieldvalue/longfieldvalue.h>
-#include <vespa/document/fieldvalue/floatfieldvalue.h>
#include <vespa/document/select/variablemap.h>
+#include <vespa/vespalib/gtest/gtest.h>
+#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/exceptions.h>
namespace document {
-class DocumentCalculatorTest : public CppUnit::TestFixture {
- TestDocRepo _testRepo;
-
+class DocumentCalculatorTest : public ::testing::Test {
public:
+ TestDocRepo _testRepo;
const DocumentTypeRepo &getRepo() { return _testRepo.getTypeRepo(); }
-
- void setUp() override {}
- void tearDown() override {}
-
- void testConstant();
- void testSimple();
- void testVariables();
- void testFields();
- void testDivideByZero();
- void testModByZero();
- void testFieldsDivZero();
- void testFieldNotSet();
- void testFieldNotFound();
- void testByteSubtractionZeroResult();
-
- CPPUNIT_TEST_SUITE(DocumentCalculatorTest);
- CPPUNIT_TEST(testConstant);
- CPPUNIT_TEST(testSimple);
- CPPUNIT_TEST(testVariables);
- CPPUNIT_TEST(testFields);
- CPPUNIT_TEST(testDivideByZero);
- CPPUNIT_TEST(testModByZero);
- CPPUNIT_TEST(testFieldsDivZero);
- CPPUNIT_TEST(testFieldNotSet);
- CPPUNIT_TEST(testFieldNotFound);
- CPPUNIT_TEST(testByteSubtractionZeroResult);
- CPPUNIT_TEST_SUITE_END();
};
-CPPUNIT_TEST_SUITE_REGISTRATION(DocumentCalculatorTest);
-
-
-void
-DocumentCalculatorTest::testConstant() {
+TEST_F(DocumentCalculatorTest, testConstant) {
auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "4.0");
Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
- CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, std::move(variables)));
+ EXPECT_EQ(4.0, calc.evaluate(doc, std::move(variables)));
}
-void
-DocumentCalculatorTest::testSimple() {
+TEST_F(DocumentCalculatorTest, testSimple) {
auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "(3 + 5) / 2");
Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
- CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, std::move(variables)));
+ EXPECT_EQ(4.0, calc.evaluate(doc, std::move(variables)));
}
-void
-DocumentCalculatorTest::testVariables() {
+TEST_F(DocumentCalculatorTest, testVariables) {
auto variables = std::make_unique<select::VariableMap>();
(*variables)["x"] = 3.0;
(*variables)["y"] = 5.0;
DocumentCalculator calc(getRepo(), "($x + $y) / 2");
Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
- CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, std::move(variables)));
+ EXPECT_EQ(4.0, calc.evaluate(doc, std::move(variables)));
}
-void
-DocumentCalculatorTest::testFields() {
+TEST_F(DocumentCalculatorTest, testFields) {
auto variables = std::make_unique<select::VariableMap>();
(*variables)["x"] = 3.0;
(*variables)["y"] = 5.0;
@@ -92,11 +57,10 @@ DocumentCalculatorTest::testFields() {
doc.setValue(doc.getField("headerval"), IntFieldValue(5));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(2));
- CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, std::move(variables)));
+ EXPECT_EQ(4.0, calc.evaluate(doc, std::move(variables)));
}
-void
-DocumentCalculatorTest::testFieldsDivZero() {
+TEST_F(DocumentCalculatorTest, testFieldsDivZero) {
auto variables = std::make_unique<select::VariableMap>();
(*variables)["x"] = 3.0;
(*variables)["y"] = 5.0;
@@ -107,44 +71,29 @@ DocumentCalculatorTest::testFieldsDivZero() {
doc.setValue(doc.getField("headerval"), IntFieldValue(5));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(0));
- try {
- calc.evaluate(doc, std::move(variables));
- CPPUNIT_ASSERT(false);
- } catch (const vespalib::IllegalArgumentException& e) {
- // OK
- }
+ EXPECT_THROW(calc.evaluate(doc, std::move(variables)),
+ vespalib::IllegalArgumentException);
}
-void
-DocumentCalculatorTest::testDivideByZero() {
+TEST_F(DocumentCalculatorTest, testDivideByZero) {
auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "(3 + 5) / 0");
Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
- try {
- calc.evaluate(doc, std::move(variables));
- CPPUNIT_ASSERT(false);
- } catch (const vespalib::IllegalArgumentException& e) {
- // OK
- }
+ EXPECT_THROW(calc.evaluate(doc, std::move(variables)),
+ vespalib::IllegalArgumentException);
}
-void
-DocumentCalculatorTest::testModByZero() {
+TEST_F(DocumentCalculatorTest, testModByZero) {
auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "(3 + 5) % 0");
Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
- try {
- calc.evaluate(doc, std::move(variables));
- CPPUNIT_ASSERT(false);
- } catch (const vespalib::IllegalArgumentException& e) {
- // OK
- }
+ EXPECT_THROW(calc.evaluate(doc, std::move(variables)),
+ vespalib::IllegalArgumentException);
}
-void
-DocumentCalculatorTest::testFieldNotSet() {
+TEST_F(DocumentCalculatorTest, testFieldNotSet) {
auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "(testdoctype1.headerval + testdoctype1"
".hfloatval) / testdoctype1.headerlongval");
@@ -152,16 +101,11 @@ DocumentCalculatorTest::testFieldNotSet() {
Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(2));
- try {
- calc.evaluate(doc, std::move(variables));
- CPPUNIT_ASSERT(false);
- } catch (const vespalib::IllegalArgumentException&) {
- // OK
- }
+ EXPECT_THROW(calc.evaluate(doc, std::move(variables)),
+ vespalib::IllegalArgumentException);
}
-void
-DocumentCalculatorTest::testFieldNotFound() {
+TEST_F(DocumentCalculatorTest, testFieldNotFound) {
auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(),
"(testdoctype1.mynotfoundfield + testdoctype1"
@@ -170,22 +114,17 @@ DocumentCalculatorTest::testFieldNotFound() {
Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(2));
- try {
- calc.evaluate(doc, std::move(variables));
- CPPUNIT_ASSERT(false);
- } catch (const vespalib::IllegalArgumentException&) {
- // OK
- }
+ EXPECT_THROW(calc.evaluate(doc, std::move(variables)),
+ vespalib::IllegalArgumentException);
}
-void
-DocumentCalculatorTest::testByteSubtractionZeroResult() {
+TEST_F(DocumentCalculatorTest, testByteSubtractionZeroResult) {
auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "testdoctype1.byteval - 3");
Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("byteval"), ByteFieldValue(3));
- CPPUNIT_ASSERT_EQUAL(0.0, calc.evaluate(doc, std::move(variables)));
+ EXPECT_EQ(0.0, calc.evaluate(doc, std::move(variables)));
}
}
diff --git a/document/src/tests/gtest_runner.cpp b/document/src/tests/gtest_runner.cpp
index fed042acceb..7a55e8a098e 100644
--- a/document/src/tests/gtest_runner.cpp
+++ b/document/src/tests/gtest_runner.cpp
@@ -5,4 +5,4 @@
#include <vespa/log/log.h>
LOG_SETUP("document_gtest_runner");
-GTEST_MAIN_RUN_ALL_TESTS
+GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/document/src/tests/teststringutil.cpp b/document/src/tests/teststringutil.cpp
index 3d741d4827f..ad57c18488d 100644
--- a/document/src/tests/teststringutil.cpp
+++ b/document/src/tests/teststringutil.cpp
@@ -1,63 +1,45 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/**
- * Test program for StringUtil methods
- *
- * @version $Id$
- */
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
#include <vespa/document/util/stringutil.h>
-#include "heapdebugger.h"
-#include "teststringutil.h"
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-CPPUNIT_TEST_SUITE_REGISTRATION( StringUtil_Test );
+#include <gtest/gtest.h>
using namespace document;
using vespalib::string;
-void StringUtil_Test::setUp()
-{
- enableHeapUsageMonitor();
-}
-
-void StringUtil_Test::test_escape()
+TEST(StringUtilTest, test_escape)
{
- CPPUNIT_ASSERT_EQUAL(string("abz019ABZ"), StringUtil::escape("abz019ABZ"));
- CPPUNIT_ASSERT_EQUAL(string("\\t"), StringUtil::escape("\t"));
- CPPUNIT_ASSERT_EQUAL(string("\\n"), StringUtil::escape("\n"));
- CPPUNIT_ASSERT_EQUAL(string("\\r"), StringUtil::escape("\r"));
- CPPUNIT_ASSERT_EQUAL(string("\\\""), StringUtil::escape("\""));
- CPPUNIT_ASSERT_EQUAL(string("\\f"), StringUtil::escape("\f"));
- CPPUNIT_ASSERT_EQUAL(string("\\\\"), StringUtil::escape("\\"));
- CPPUNIT_ASSERT_EQUAL(string("\\x05"), StringUtil::escape("\x05"));
- CPPUNIT_ASSERT_EQUAL(string("\\tA\\ncombined\\r\\x055test"),
- StringUtil::escape("\tA\ncombined\r\x05""5test"));
- CPPUNIT_ASSERT_EQUAL(string("A\\x20space\\x20separated\\x20string"),
- StringUtil::escape("A space separated string", ' '));
+ EXPECT_EQ(string("abz019ABZ"), StringUtil::escape("abz019ABZ"));
+ EXPECT_EQ(string("\\t"), StringUtil::escape("\t"));
+ EXPECT_EQ(string("\\n"), StringUtil::escape("\n"));
+ EXPECT_EQ(string("\\r"), StringUtil::escape("\r"));
+ EXPECT_EQ(string("\\\""), StringUtil::escape("\""));
+ EXPECT_EQ(string("\\f"), StringUtil::escape("\f"));
+ EXPECT_EQ(string("\\\\"), StringUtil::escape("\\"));
+ EXPECT_EQ(string("\\x05"), StringUtil::escape("\x05"));
+ EXPECT_EQ(string("\\tA\\ncombined\\r\\x055test"),
+ StringUtil::escape("\tA\ncombined\r\x05""5test"));
+ EXPECT_EQ(string("A\\x20space\\x20separated\\x20string"),
+ StringUtil::escape("A space separated string", ' '));
}
-void StringUtil_Test::test_unescape()
+TEST(StringUtilTest, test_unescape)
{
- CPPUNIT_ASSERT_EQUAL(string("abz019ABZ"),
- StringUtil::unescape("abz019ABZ"));
- CPPUNIT_ASSERT_EQUAL(string("\t"), StringUtil::unescape("\\t"));
- CPPUNIT_ASSERT_EQUAL(string("\n"), StringUtil::unescape("\\n"));
- CPPUNIT_ASSERT_EQUAL(string("\r"), StringUtil::unescape("\\r"));
- CPPUNIT_ASSERT_EQUAL(string("\""), StringUtil::unescape("\\\""));
- CPPUNIT_ASSERT_EQUAL(string("\f"), StringUtil::unescape("\\f"));
- CPPUNIT_ASSERT_EQUAL(string("\\"), StringUtil::unescape("\\\\"));
- CPPUNIT_ASSERT_EQUAL(string("\x05"), StringUtil::unescape("\\x05"));
- CPPUNIT_ASSERT_EQUAL(string("\tA\ncombined\r\x05""5test"),
- StringUtil::unescape("\\tA\\ncombined\\r\\x055test"));
- CPPUNIT_ASSERT_EQUAL(string("A space separated string"),
- StringUtil::unescape("A\\x20space\\x20separated\\x20string"));
+ EXPECT_EQ(string("abz019ABZ"),
+ StringUtil::unescape("abz019ABZ"));
+ EXPECT_EQ(string("\t"), StringUtil::unescape("\\t"));
+ EXPECT_EQ(string("\n"), StringUtil::unescape("\\n"));
+ EXPECT_EQ(string("\r"), StringUtil::unescape("\\r"));
+ EXPECT_EQ(string("\""), StringUtil::unescape("\\\""));
+ EXPECT_EQ(string("\f"), StringUtil::unescape("\\f"));
+ EXPECT_EQ(string("\\"), StringUtil::unescape("\\\\"));
+ EXPECT_EQ(string("\x05"), StringUtil::unescape("\\x05"));
+ EXPECT_EQ(string("\tA\ncombined\r\x05""5test"),
+ StringUtil::unescape("\\tA\\ncombined\\r\\x055test"));
+ EXPECT_EQ(string("A space separated string"),
+ StringUtil::unescape("A\\x20space\\x20separated\\x20string"));
}
-void StringUtil_Test::test_printAsHex()
+TEST(StringUtilTest, test_printAsHex)
{
std::vector<char> asciitable(256);
for (uint32_t i=0; i<256; ++i) asciitable[i] = i;
@@ -82,7 +64,7 @@ void StringUtil_Test::test_printAsHex()
" 208: d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df\n"
" 224: e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef\n"
" 240: f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff");
- CPPUNIT_ASSERT_EQUAL(expected, ost.str());
+ EXPECT_EQ(expected, ost.str());
ost.str("");
ost << "\n";
@@ -107,5 +89,5 @@ void StringUtil_Test::test_printAsHex()
"225: e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef ...............\n"
"240: f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ...............\n"
"255: ff .";
- CPPUNIT_ASSERT_EQUAL(expected, ost.str());
+ EXPECT_EQ(expected, ost.str());
}
diff --git a/document/src/tests/teststringutil.h b/document/src/tests/teststringutil.h
deleted file mode 100644
index bcc7617d1d4..00000000000
--- a/document/src/tests/teststringutil.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include <cppunit/extensions/HelperMacros.h>
-
-class StringUtil_Test : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE( StringUtil_Test);
- CPPUNIT_TEST(test_escape);
- CPPUNIT_TEST(test_unescape);
- CPPUNIT_TEST(test_printAsHex);
- CPPUNIT_TEST_SUITE_END();
-
-public:
- void setUp() override;
-
-protected:
- void test_escape();
- void test_unescape();
- void test_printAsHex();
-
-};
-
-
diff --git a/documentapi/src/tests/loadtypes/CMakeLists.txt b/documentapi/src/tests/loadtypes/CMakeLists.txt
index 7588c091cc2..39ee6816c5e 100644
--- a/documentapi/src/tests/loadtypes/CMakeLists.txt
+++ b/documentapi/src/tests/loadtypes/CMakeLists.txt
@@ -2,9 +2,10 @@
vespa_add_executable(documentapi_loadtype_test_app TEST
SOURCES
loadtypetest.cpp
- testrunner.cpp
DEPENDS
documentapi
vdstestlib
+ gmock
+ gtest
)
vespa_add_test(NAME documentapi_loadtype_test_app COMMAND documentapi_loadtype_test_app)
diff --git a/documentapi/src/tests/loadtypes/loadtypetest.cpp b/documentapi/src/tests/loadtypes/loadtypetest.cpp
index 768b4f3a3ff..20efb281300 100644
--- a/documentapi/src/tests/loadtypes/loadtypetest.cpp
+++ b/documentapi/src/tests/loadtypes/loadtypetest.cpp
@@ -1,52 +1,45 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/documentapi/loadtypes/loadtypeset.h>
-#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/config/config.h>
#include <vespa/config/common/exceptions.h>
+#include <vespa/vespalib/gtest/gtest.h>
+#include <gmock/gmock.h>
-namespace documentapi {
-
-struct LoadTypeTest : public CppUnit::TestFixture {
-
- void testConfig();
+using namespace ::testing;
- CPPUNIT_TEST_SUITE(LoadTypeTest);
- CPPUNIT_TEST(testConfig);
- CPPUNIT_TEST_SUITE_END();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(LoadTypeTest);
+namespace documentapi {
-#define ASSERT_CONFIG_FAILURE(configId, error) \
- try { \
- LoadTypeSet createdFromConfigId(vespalib::stringref(configId)); \
- CPPUNIT_FAIL("Config was expected to fail with error: " \
- + string(error)); \
- } catch (config::InvalidConfigException& e) { \
- CPPUNIT_ASSERT_CONTAIN(string(error), e.getMessage()); \
+void
+assertConfigFailure(const vespalib::string &configId, const vespalib::string &expError)
+{
+ try {
+ LoadTypeSet createdFromConfigId(configId);
+ FAIL() << "Config was expected to fail with error: " << expError;
+ } catch (config::InvalidConfigException &e) {
+ EXPECT_THAT(e.getMessage(), HasSubstr(expError));
}
+}
-void
-LoadTypeTest::testConfig()
+TEST(LoadTypeTest, testConfig)
{
- // Using id 0 is illegal. Reserved for default type.
- ASSERT_CONFIG_FAILURE(
+ // Using id 0 is illegal. Reserved for default type.
+ assertConfigFailure(
"raw:"
"type[1]\n"
"type[0].id 0\n"
"type[0].name \"foo\"\n"
"type[0].priority \"\"",
"Load type identifiers need to be");
- // Using name "default" is illegal. Reserved for default type.
- ASSERT_CONFIG_FAILURE(
+ // Using name "default" is illegal. Reserved for default type.
+ assertConfigFailure(
"raw:"
"type[1]\n"
"type[0].id 1\n"
"type[0].name \"default\"\n"
"type[0].priority \"\"", "Load type names need to be");
- // Identifiers need to be unique.
- ASSERT_CONFIG_FAILURE(
+ // Identifiers need to be unique.
+ assertConfigFailure(
"raw:"
"type[2]\n"
"type[0].id 1\n"
@@ -55,8 +48,8 @@ LoadTypeTest::testConfig()
"type[1].id 1\n"
"type[1].name \"testa\"\n"
"type[1].priority \"\"", "Load type identifiers need to be");
- // Names need to be unique.
- ASSERT_CONFIG_FAILURE(
+ // Names need to be unique.
+ assertConfigFailure(
"raw:"
"type[2]\n"
"type[0].id 1\n"
@@ -80,3 +73,5 @@ LoadTypeTest::testConfig()
}
} // documentapi
+
+GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/documentapi/src/tests/loadtypes/testrunner.cpp b/documentapi/src/tests/loadtypes/testrunner.cpp
deleted file mode 100644
index 78f58b1168e..00000000000
--- a/documentapi/src/tests/loadtypes/testrunner.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vdstestlib/cppunit/cppunittestrunner.h>
-
-#include <vespa/log/log.h>
-LOG_SETUP("storagecppunittests");
-
-int
-main(int argc, const char *argv[])
-{
- vdstestlib::CppUnitTestRunner testRunner;
- return testRunner.run(argc, argv);
-}
diff --git a/eval/src/tests/tensor/tensor_add_operation/tensor_add_operation_test.cpp b/eval/src/tests/tensor/tensor_add_operation/tensor_add_operation_test.cpp
index 4c92dc717a7..1d39a557114 100644
--- a/eval/src/tests/tensor/tensor_add_operation/tensor_add_operation_test.cpp
+++ b/eval/src/tests/tensor/tensor_add_operation/tensor_add_operation_test.cpp
@@ -82,4 +82,4 @@ TEST(TensorAddTest, tensors_of_different_types_cannot_be_added_together)
assertNullTensor(TensorSpec("tensor(x{},y[2])"), TensorSpec("tensor(x{},y[3])"));
}
-GTEST_MAIN_RUN_ALL_TESTS
+GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/eval/src/tests/tensor/tensor_modify_operation/tensor_modify_operation_test.cpp b/eval/src/tests/tensor/tensor_modify_operation/tensor_modify_operation_test.cpp
index 31f17b3eed2..00ee55ed7af 100644
--- a/eval/src/tests/tensor/tensor_modify_operation/tensor_modify_operation_test.cpp
+++ b/eval/src/tests/tensor/tensor_modify_operation/tensor_modify_operation_test.cpp
@@ -108,4 +108,4 @@ TEST(TensorModifyTest, mixed_tensors_ignore_updates_to_missing_or_out_of_range_c
.add({{"x","a"},{"y",1}}, 3));
}
-GTEST_MAIN_RUN_ALL_TESTS
+GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/eval/src/tests/tensor/tensor_remove_operation/tensor_remove_operation_test.cpp b/eval/src/tests/tensor/tensor_remove_operation/tensor_remove_operation_test.cpp
index df21b46691d..ceeaf2c99da 100644
--- a/eval/src/tests/tensor/tensor_remove_operation/tensor_remove_operation_test.cpp
+++ b/eval/src/tests/tensor/tensor_remove_operation/tensor_remove_operation_test.cpp
@@ -92,4 +92,4 @@ TEST(TensorRemoveTest, all_cells_can_be_removed_from_a_mixed_tensor)
TensorSpec("tensor(x{},y[2])"));
}
-GTEST_MAIN_RUN_ALL_TESTS
+GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/metrics/src/tests/CMakeLists.txt b/metrics/src/tests/CMakeLists.txt
index 691b1a618b0..afb56757bdd 100644
--- a/metrics/src/tests/CMakeLists.txt
+++ b/metrics/src/tests/CMakeLists.txt
@@ -15,7 +15,6 @@ vespa_add_executable(metrics_gtest_runner_app TEST
vespa_add_test(
NAME metrics_gtest_runner_app
COMMAND metrics_gtest_runner_app
- DEPENDS metrics_gtest_runner_app
)
# Runner for unit tests written in CppUnit (DEPRECATED).
diff --git a/metrics/src/tests/gtest_runner.cpp b/metrics/src/tests/gtest_runner.cpp
index 2f0e0705792..3672752b2c2 100644
--- a/metrics/src/tests/gtest_runner.cpp
+++ b/metrics/src/tests/gtest_runner.cpp
@@ -5,4 +5,4 @@
#include <vespa/log/log.h>
LOG_SETUP("metrics_gtest_runner");
-GTEST_MAIN_RUN_ALL_TESTS
+GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/staging_vespalib/src/vespa/vespalib/gtest/gtest.h b/staging_vespalib/src/vespa/vespalib/gtest/gtest.h
index ed4e65b71cb..67d3d438a52 100644
--- a/staging_vespalib/src/vespa/vespalib/gtest/gtest.h
+++ b/staging_vespalib/src/vespa/vespalib/gtest/gtest.h
@@ -5,7 +5,7 @@
/**
* Macro for creating a main function that runs all gtests.
*/
-#define GTEST_MAIN_RUN_ALL_TESTS \
+#define GTEST_MAIN_RUN_ALL_TESTS() \
int \
main(int argc, char* argv[]) \
{ \
diff --git a/storage/src/tests/CMakeLists.txt b/storage/src/tests/CMakeLists.txt
index e3da883280a..c4436161f28 100644
--- a/storage/src/tests/CMakeLists.txt
+++ b/storage/src/tests/CMakeLists.txt
@@ -12,7 +12,6 @@ vespa_add_executable(storage_gtest_runner_app TEST
vespa_add_test(
NAME storage_gtest_runner_app
COMMAND storage_gtest_runner_app
- DEPENDS storage_gtest_runner_app
)
# Runner for unit tests written in CppUnit (DEPRECATED).
diff --git a/storage/src/tests/gtest_runner.cpp b/storage/src/tests/gtest_runner.cpp
index 762f6dba6db..0eb65b00d49 100644
--- a/storage/src/tests/gtest_runner.cpp
+++ b/storage/src/tests/gtest_runner.cpp
@@ -5,4 +5,4 @@
#include <vespa/log/log.h>
LOG_SETUP("storage_gtest_runner");
-GTEST_MAIN_RUN_ALL_TESTS
+GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/storageapi/src/tests/CMakeLists.txt b/storageapi/src/tests/CMakeLists.txt
index d4486105c8b..2045cca89e1 100644
--- a/storageapi/src/tests/CMakeLists.txt
+++ b/storageapi/src/tests/CMakeLists.txt
@@ -14,7 +14,6 @@ vespa_add_executable(storageapi_gtest_runner_app TEST
vespa_add_test(
NAME storageapi_gtest_runner_app
COMMAND storageapi_gtest_runner_app
- DEPENDS storageapi_gtest_runner_app
)
# Runner for unit tests written in CppUnit (DEPRECATED).
diff --git a/storageapi/src/tests/gtest_runner.cpp b/storageapi/src/tests/gtest_runner.cpp
index d499a54af50..9d412b163f8 100644
--- a/storageapi/src/tests/gtest_runner.cpp
+++ b/storageapi/src/tests/gtest_runner.cpp
@@ -5,4 +5,4 @@
#include <vespa/log/log.h>
LOG_SETUP("storageapi_gtest_runner");
-GTEST_MAIN_RUN_ALL_TESTS
+GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/storageframework/src/tests/CMakeLists.txt b/storageframework/src/tests/CMakeLists.txt
index 0e562508d4c..49c25a275f2 100644
--- a/storageframework/src/tests/CMakeLists.txt
+++ b/storageframework/src/tests/CMakeLists.txt
@@ -13,7 +13,6 @@ vespa_add_executable(storageframework_gtest_runner_app TEST
vespa_add_test(
NAME storageframework_gtest_runner_app
COMMAND storageframework_gtest_runner_app
- DEPENDS storageframework_gtest_runner_app
)
# Runner for unit tests written in CppUnit (DEPRECATED).
diff --git a/storageframework/src/tests/gtest_runner.cpp b/storageframework/src/tests/gtest_runner.cpp
index e9a1c9b1ed8..22088bd87b2 100644
--- a/storageframework/src/tests/gtest_runner.cpp
+++ b/storageframework/src/tests/gtest_runner.cpp
@@ -5,4 +5,4 @@
#include <vespa/log/log.h>
LOG_SETUP("storageframework_gtest_runner");
-GTEST_MAIN_RUN_ALL_TESTS
+GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/vdslib/src/tests/CMakeLists.txt b/vdslib/src/tests/CMakeLists.txt
index b445dc3e016..e1853ab05bd 100644
--- a/vdslib/src/tests/CMakeLists.txt
+++ b/vdslib/src/tests/CMakeLists.txt
@@ -13,7 +13,6 @@ vespa_add_executable(vdslib_gtest_runner_app TEST
vespa_add_test(
NAME vdslib_gtest_runner_app
COMMAND vdslib_gtest_runner_app
- DEPENDS vdslib_gtest_runner_app
)
# Runner for unit tests written in CppUnit (DEPRECATED).
diff --git a/vdslib/src/tests/gtest_runner.cpp b/vdslib/src/tests/gtest_runner.cpp
index e200813ef61..ed432b3c890 100644
--- a/vdslib/src/tests/gtest_runner.cpp
+++ b/vdslib/src/tests/gtest_runner.cpp
@@ -5,4 +5,4 @@
#include <vespa/log/log.h>
LOG_SETUP("vdslib_gtest_runner");
-GTEST_MAIN_RUN_ALL_TESTS
+GTEST_MAIN_RUN_ALL_TESTS()