summaryrefslogtreecommitdiffstats
path: root/document/src/tests/fixed_bucket_spaces_test.cpp
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-04-16 08:56:00 +0200
committerTor Egge <Tor.Egge@broadpark.no>2019-04-16 11:08:52 +0200
commit7dd0e264a2778660ec22fdcad98e0118acf39d9e (patch)
tree44030a97fb7e947bf968cd2f87e77974609fda76 /document/src/tests/fixed_bucket_spaces_test.cpp
parent5ab193575090efa10cc5aa07744ad457e1af973f (diff)
Migrate document unit tests from cppunit to gtest.
Diffstat (limited to 'document/src/tests/fixed_bucket_spaces_test.cpp')
-rw-r--r--document/src/tests/fixed_bucket_spaces_test.cpp56
1 files changed, 21 insertions, 35 deletions
diff --git a/document/src/tests/fixed_bucket_spaces_test.cpp b/document/src/tests/fixed_bucket_spaces_test.cpp
index 12c248adf37..87903281c46 100644
--- a/document/src/tests/fixed_bucket_spaces_test.cpp
+++ b/document/src/tests/fixed_bucket_spaces_test.cpp
@@ -1,62 +1,48 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/document/bucket/fixed_bucket_spaces.h>
-#include <cppunit/extensions/HelperMacros.h>
+#include <gtest/gtest.h>
namespace document {
-struct FixedBucketSpacesTest : CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(FixedBucketSpacesTest);
- CPPUNIT_TEST(bucket_space_from_name_is_defined_for_default_space);
- CPPUNIT_TEST(bucket_space_from_name_is_defined_for_global_space);
- CPPUNIT_TEST(bucket_space_from_name_throws_exception_for_unknown_space);
- CPPUNIT_TEST(name_from_bucket_space_is_defined_for_default_space);
- CPPUNIT_TEST(name_from_bucket_space_is_defined_for_global_space);
- CPPUNIT_TEST(name_from_bucket_space_throws_exception_for_unknown_space);
- CPPUNIT_TEST_SUITE_END();
-
- void bucket_space_from_name_is_defined_for_default_space();
- void bucket_space_from_name_is_defined_for_global_space();
- void bucket_space_from_name_throws_exception_for_unknown_space();
- void name_from_bucket_space_is_defined_for_default_space();
- void name_from_bucket_space_is_defined_for_global_space();
- void name_from_bucket_space_throws_exception_for_unknown_space();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(FixedBucketSpacesTest);
-
-void FixedBucketSpacesTest::bucket_space_from_name_is_defined_for_default_space() {
- CPPUNIT_ASSERT_EQUAL(FixedBucketSpaces::default_space(), FixedBucketSpaces::from_string("default"));
+TEST(FixedBucketSpacesTest, bucket_space_from_name_is_defined_for_default_space)
+{
+ EXPECT_EQ(FixedBucketSpaces::default_space(), FixedBucketSpaces::from_string("default"));
}
-void FixedBucketSpacesTest::bucket_space_from_name_is_defined_for_global_space() {
- CPPUNIT_ASSERT_EQUAL(FixedBucketSpaces::global_space(), FixedBucketSpaces::from_string("global"));
+TEST(FixedBucketSpacesTest, bucket_space_from_name_is_defined_for_global_space)
+{
+ EXPECT_EQ(FixedBucketSpaces::global_space(), FixedBucketSpaces::from_string("global"));
}
-void FixedBucketSpacesTest::bucket_space_from_name_throws_exception_for_unknown_space() {
+TEST(FixedBucketSpacesTest, bucket_space_from_name_throws_exception_for_unknown_space)
+{
try {
FixedBucketSpaces::from_string("banana");
- CPPUNIT_FAIL("Expected exception on unknown bucket space name");
+ FAIL() << "Expected exception on unknown bucket space name";
} catch (document::UnknownBucketSpaceException& e) {
}
}
-void FixedBucketSpacesTest::name_from_bucket_space_is_defined_for_default_space() {
- CPPUNIT_ASSERT_EQUAL(vespalib::stringref("default"),
+TEST(FixedBucketSpacesTest, name_from_bucket_space_is_defined_for_default_space)
+{
+ EXPECT_EQ(vespalib::stringref("default"),
FixedBucketSpaces::to_string(FixedBucketSpaces::default_space()));
- CPPUNIT_ASSERT_EQUAL(vespalib::stringref("default"), FixedBucketSpaces::default_space_name());
+ EXPECT_EQ(vespalib::stringref("default"), FixedBucketSpaces::default_space_name());
}
-void FixedBucketSpacesTest::name_from_bucket_space_is_defined_for_global_space() {
- CPPUNIT_ASSERT_EQUAL(vespalib::stringref("global"),
+TEST(FixedBucketSpacesTest, name_from_bucket_space_is_defined_for_global_space)
+{
+ EXPECT_EQ(vespalib::stringref("global"),
FixedBucketSpaces::to_string(FixedBucketSpaces::global_space()));
- CPPUNIT_ASSERT_EQUAL(vespalib::stringref("global"), FixedBucketSpaces::global_space_name());
+ EXPECT_EQ(vespalib::stringref("global"), FixedBucketSpaces::global_space_name());
}
-void FixedBucketSpacesTest::name_from_bucket_space_throws_exception_for_unknown_space() {
+TEST(FixedBucketSpacesTest, name_from_bucket_space_throws_exception_for_unknown_space)
+{
try {
FixedBucketSpaces::to_string(BucketSpace(4567));
- CPPUNIT_FAIL("Expected exception on unknown bucket space value");
+ FAIL() << "Expected exception on unknown bucket space value";
} catch (document::UnknownBucketSpaceException& e) {
}
}