提交 d3ab5ffa 编写于 作者: G groot

add unittest case

上级 e40c0674
......@@ -25,6 +25,8 @@
#include "utils/StringHelpFunctions.h"
#include "utils/ValidationUtil.h"
#include <limits>
namespace {
static constexpr uint64_t KB = 1024;
......@@ -63,9 +65,21 @@ TEST_F(ConfigTest, CONFIG_TEST) {
int64_t port = server_config.GetInt64Value("port");
ASSERT_NE(port, 0);
server_config.SetValue("test", "2.5");
double test = server_config.GetDoubleValue("test");
ASSERT_EQ(test, 2.5);
server_config.SetValue("float_test", "2.5");
double dbl = server_config.GetDoubleValue("float_test");
ASSERT_LE(abs(dbl - 2.5), std::numeric_limits<double>::epsilon());
float flt = server_config.GetFloatValue("float_test");
ASSERT_LE(abs(flt - 2.5), std::numeric_limits<float>::epsilon());
server_config.SetValue("bool_test", "true");
bool blt = server_config.GetBoolValue("bool_test");
ASSERT_TRUE(blt);
server_config.SetValue("int_test", "34");
int32_t it32 = server_config.GetInt32Value("int_test");
ASSERT_EQ(it32, 34);
int64_t it64 = server_config.GetInt64Value("int_test");
ASSERT_EQ(it64, 34);
milvus::server::ConfigNode fake;
server_config.AddChild("fake", fake);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册