提交 8ffb89d2 编写于 作者: S starlord 提交者: jinhai

add more unittest


Former-commit-id: 853d82c0f7b81579d1332c5f1eb08234bc49a065
上级 fa4f8643
......@@ -265,5 +265,8 @@ TEST_F(MetaTest, TABLE_FILES_TEST) {
ASSERT_EQ(dated_files[table_file.date_].size(),
to_index_files_cnt+raw_files_cnt+index_files_cnt);
status = impl_->FilesToSearch(table_id, meta::DatesT(), dated_files);
ASSERT_TRUE(status.ok());
ASSERT_EQ(dated_files[table_file.date_].size(),
to_index_files_cnt+raw_files_cnt+index_files_cnt);
}
......@@ -13,11 +13,19 @@
#include "db/Status.h"
#include "db/Options.h"
#include "db/DBMetaImpl.h"
#include "db/EngineFactory.h"
#include <vector>
using namespace zilliz::milvus;
namespace {
void CopyStatus(engine::Status& st1, engine::Status& st2) {
st1 = st2;
}
}
TEST(DBMiscTest, ENGINE_API_TEST) {
//engine api AddWithIdArray
const uint16_t dim = 512;
......@@ -34,6 +42,15 @@ TEST(DBMiscTest, ENGINE_API_TEST) {
auto status = engine.AddWithIdArray(vectors, ids);
ASSERT_TRUE(status.ok());
auto engine_ptr = engine::EngineFactory::Build(128, "/tmp", engine::EngineType::INVALID);
ASSERT_EQ(engine_ptr, nullptr);
engine_ptr = engine::EngineFactory::Build(128, "/tmp", engine::EngineType::FAISS_IVFFLAT);
ASSERT_NE(engine_ptr, nullptr);
engine_ptr = engine::EngineFactory::Build(128, "/tmp", engine::EngineType::FAISS_IDMAP);
ASSERT_NE(engine_ptr, nullptr);
}
TEST(DBMiscTest, EXCEPTION_TEST) {
......@@ -65,6 +82,10 @@ TEST(DBMiscTest, STATUS_TEST) {
ASSERT_TRUE(status.IsDBTransactionError());
str = status.ToString();
ASSERT_FALSE(str.empty());
engine::Status status_copy = engine::Status::OK();
CopyStatus(status_copy, status);
ASSERT_TRUE(status.IsDBTransactionError());
}
TEST(DBMiscTest, OPTIONS_TEST) {
......@@ -88,6 +109,19 @@ TEST(DBMiscTest, OPTIONS_TEST) {
engine::ArchiveConf archive("delete", "1:2:3");
ASSERT_TRUE(archive.GetCriterias().empty());
}
{
engine::ArchiveConf archive("delete");
engine::ArchiveConf::CriteriaT criterial = {
{"disk", 1024},
{"days", 100}
};
archive.SetCriterias(criterial);
auto crit = archive.GetCriterias();
ASSERT_EQ(criterial["disk"], 1024);
ASSERT_EQ(criterial["days"], 100);
}
}
TEST(DBMiscTest, META_TEST) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册