diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-19 21:57:59 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-20 12:38:48 +0000 |
commit | 64500ab17deb86b394edc81f4ad42b5a2c43fe30 (patch) | |
tree | 64334ba1513b697dacd5068981a8ee5b7ad92f3b /staging_vespalib/src/tests/memorydatastore | |
parent | cfa6ec5cdbd1cf39558d3f85101de05230d6c225 (diff) |
Fold staging_vespalib into vespalib
Diffstat (limited to 'staging_vespalib/src/tests/memorydatastore')
3 files changed, 0 insertions, 81 deletions
diff --git a/staging_vespalib/src/tests/memorydatastore/.gitignore b/staging_vespalib/src/tests/memorydatastore/.gitignore deleted file mode 100644 index 634cea1ae88..00000000000 --- a/staging_vespalib/src/tests/memorydatastore/.gitignore +++ /dev/null @@ -1 +0,0 @@ -staging_vespalib_memorydatastore_test_app diff --git a/staging_vespalib/src/tests/memorydatastore/CMakeLists.txt b/staging_vespalib/src/tests/memorydatastore/CMakeLists.txt deleted file mode 100644 index f3709aeea65..00000000000 --- a/staging_vespalib/src/tests/memorydatastore/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(staging_vespalib_memorydatastore_test_app TEST - SOURCES - memorydatastore.cpp - DEPENDS - staging_vespalib -) -vespa_add_test(NAME staging_vespalib_memorydatastore_test_app COMMAND staging_vespalib_memorydatastore_test_app) diff --git a/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp b/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp deleted file mode 100644 index 1d49b0af91b..00000000000 --- a/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/vespalib/data/memorydatastore.h> -#include <vespa/vespalib/stllike/asciistream.h> - -using namespace vespalib; - -class MemoryDataStoreTest : public vespalib::TestApp -{ -private: - void testMemoryDataStore(); - void testVariableSizeVector(); -public: - int Main() override; -}; - -void -MemoryDataStoreTest::testMemoryDataStore() -{ - MemoryDataStore s(alloc::Alloc::alloc(256)); - std::vector<MemoryDataStore::Reference> v; - v.push_back(s.push_back("mumbo", 5)); - for (size_t i(0); i < 50; i++) { - v.push_back(s.push_back("mumbo", 5)); - EXPECT_EQUAL(static_cast<const char *>(v[i].data()) + 5, v[i+1].data()); - } - v.push_back(s.push_back("mumbo", 5)); - EXPECT_EQUAL(52ul, v.size()); - EXPECT_NOT_EQUAL(static_cast<const char *>(v[50].data()) + 5, v[51].data()); - for (size_t i(0); i < v.size(); i++) { - EXPECT_EQUAL(0, memcmp("mumbo", v[i].data(), 5)); - } -} - -void -MemoryDataStoreTest::testVariableSizeVector() -{ - VariableSizeVector v(20000, 5*20000); - for (size_t i(0); i < 10000; i++) { - asciistream os; - os << i; - v.push_back(os.str().data(), os.str().size()); - } - for (size_t i(0); i < v.size(); i++) { - asciistream os; - os << i; - EXPECT_EQUAL(os.str().size(), v[i].size()); - EXPECT_EQUAL(0, memcmp(os.str().data(), v[i].data(), os.str().size())); - } - size_t i(0); - for (auto it(v.begin()), mt(v.end()); it != mt; it++, i++) { - asciistream os; - os << i; - EXPECT_EQUAL(os.str().size(), it->size()); - EXPECT_EQUAL(0, memcmp(os.str().data(), (*it).data(), os.str().size())); - } - -} - -int -MemoryDataStoreTest::Main() -{ - TEST_INIT("data_test"); - testMemoryDataStore(); - testVariableSizeVector(); - - TEST_DONE(); -} - -TEST_APPHOOK(MemoryDataStoreTest); - |