aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-02-01 20:12:37 +0100
committerGitHub <noreply@github.com>2023-02-01 20:12:37 +0100
commitdd298cd4b09c455eb0c82a5c95fabb4bb711ab3c (patch)
tree4fd9ab0fcd2caf5d98ace01856789d154c4836bb /searchlib/src/tests
parent4bec1d0124600b1032b6341daadfab4dc7230a29 (diff)
parent743234433a8fdaffe5d655c11ef258d6e1a40438 (diff)
Merge pull request #25838 from vespa-engine/toregge/throw-exception-when-datastore-buffer-max-size-is-too-small
Throw exception when data store buffer max size is too small.
Diffstat (limited to 'searchlib/src/tests')
-rw-r--r--searchlib/src/tests/memoryindex/datastore/word_store_test.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/searchlib/src/tests/memoryindex/datastore/word_store_test.cpp b/searchlib/src/tests/memoryindex/datastore/word_store_test.cpp
index 1de7b4a3efd..5c2bf0d634f 100644
--- a/searchlib/src/tests/memoryindex/datastore/word_store_test.cpp
+++ b/searchlib/src/tests/memoryindex/datastore/word_store_test.cpp
@@ -1,6 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/searchlib/memoryindex/word_store.h>
#include <vespa/vespalib/gtest/gtest.h>
+#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/log/log.h>
LOG_SETUP("word_store_test");
@@ -64,6 +66,13 @@ TEST(WordStoreTest, add_word_triggers_change_of_buffer)
EXPECT_EQ(4u, lastId);
}
+TEST(WordStoreTest, long_word_triggers_exception)
+{
+ WordStore ws;
+ vespalib::string word(16_Mi + 1_Ki, 'z');
+ EXPECT_THROW(ws.addWord(word), vespalib::OverflowException);
+}
+
}
GTEST_MAIN_RUN_ALL_TESTS()