mirror of
https://github.com/typesense/typesense.git
synced 2025-05-19 05:08:43 +08:00
Improve test harness to cover some missing cases.
This commit is contained in:
parent
b0cb3ceb41
commit
b3689e16aa
16
TODO.md
16
TODO.md
@ -62,17 +62,17 @@
|
||||
- ~~init_collection of Collection manager should probably take seq_id as param~~
|
||||
- ~~node score should be int32, no longer uint16 like in document struct~~
|
||||
- ~~Typo in prefix search~~
|
||||
- ~~When field of "id" but not string, what happens?~~
|
||||
- ~~test for num_documents~~
|
||||
- ~~test for string filter comparison: title < "foo"~~
|
||||
- ~~Test for sorted_array::indexOf when length is 0~~
|
||||
- test for token ranking on float field
|
||||
- test for float int field deletion during doc deletion
|
||||
- Test for snippets
|
||||
- Test for pagination
|
||||
- Proper logging
|
||||
- https support
|
||||
- Validate before string to int conversion in the http api layer
|
||||
- When field of "id" but not string, what happens?
|
||||
- test for num_documents
|
||||
- test for string filter comparison: title < "foo"
|
||||
- test for token ranking on float field
|
||||
- test for float int field deletion during doc deletion
|
||||
- Test for sorted_array::indexOf when length is 0
|
||||
- Test for snippets
|
||||
- Test for pagination
|
||||
- > INT32_MAX validation for float field
|
||||
- art bool support
|
||||
- Add docs/explanation around ranking calc
|
||||
|
@ -63,6 +63,11 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(CollectionTest, VerifyCountOfDocuments) {
|
||||
// we have 1 dummy record to match the line numbers on the fixtures file with sequence numbers
|
||||
ASSERT_EQ(24+1, collection->get_num_documents());
|
||||
}
|
||||
|
||||
TEST_F(CollectionTest, RetrieveADocumentById) {
|
||||
Option<nlohmann::json> doc_option = collection->get("1");
|
||||
ASSERT_TRUE(doc_option.ok());
|
||||
@ -908,6 +913,16 @@ TEST_F(CollectionTest, FilterOnTextFields) {
|
||||
results = coll_array_fields->search("Jeremy", query_fields, "tags: BRONZE", facets, sort_fields, 0, 10, 1, FREQUENCY, false).get();
|
||||
ASSERT_EQ(0, results["hits"].size());
|
||||
|
||||
// when comparators are used, should just treat them as part of search string
|
||||
results = coll_array_fields->search("Jeremy", query_fields, "tags:<BRONZE", facets, sort_fields, 0, 10, 1, FREQUENCY, false).get();
|
||||
ASSERT_EQ(0, results["hits"].size());
|
||||
|
||||
results = coll_array_fields->search("Jeremy", query_fields, "tags:<=BRONZE", facets, sort_fields, 0, 10, 1, FREQUENCY, false).get();
|
||||
ASSERT_EQ(0, results["hits"].size());
|
||||
|
||||
results = coll_array_fields->search("Jeremy", query_fields, "tags:>BRONZE", facets, sort_fields, 0, 10, 1, FREQUENCY, false).get();
|
||||
ASSERT_EQ(0, results["hits"].size());
|
||||
|
||||
collectionManager.drop_collection("coll_array_fields");
|
||||
}
|
||||
|
||||
@ -1342,6 +1357,8 @@ TEST_F(CollectionTest, DeletionOfADocument) {
|
||||
collection_for_del->add(json_line);
|
||||
}
|
||||
|
||||
ASSERT_EQ(25, collection_for_del->get_num_documents());
|
||||
|
||||
infile.close();
|
||||
|
||||
nlohmann::json results;
|
||||
@ -1376,6 +1393,8 @@ TEST_F(CollectionTest, DeletionOfADocument) {
|
||||
collection_for_del->remove(std::to_string(id));
|
||||
}
|
||||
|
||||
ASSERT_EQ(0, collection_for_del->get_num_documents());
|
||||
|
||||
it = store->get_iterator();
|
||||
num_keys = 0;
|
||||
for (it->SeekToFirst(); it->Valid(); it->Next()) {
|
||||
|
@ -9,6 +9,7 @@ TEST(SortedArrayTest, Append) {
|
||||
const int SIZE = 10 * 1000;
|
||||
|
||||
EXPECT_EQ(arr.getLength(), 0);
|
||||
EXPECT_EQ(arr.indexOf(100), 0); // when not found must be equal to length (0 in this case)
|
||||
|
||||
for(uint32_t i=0; i < SIZE; i++) {
|
||||
arr.append(i);
|
||||
|
Loading…
x
Reference in New Issue
Block a user