mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
add ut
This commit is contained in:
parent
1c87bfe475
commit
1e462e02ed
14
src/Common/tests/gtest_base_json.cpp
Normal file
14
src/Common/tests/gtest_base_json.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <base/JSON.h>
|
||||
|
||||
TEST(JSON, searchField)
|
||||
{
|
||||
const JSON json = JSON(std::string_view(R"({"k1":1,"k2":{"k3":2,"k4":3,"k":4},"k":5})"));
|
||||
ASSERT_EQ(json["k1"], 1);
|
||||
ASSERT_EQ(json["k2"].toString(), R"({"k3":2,"k4":3,"k":4})");
|
||||
ASSERT_EQ(json["k2"]["k3"].getUInt(), 2);
|
||||
ASSERT_EQ(json["k2"]["k4"].getUInt(), 3);
|
||||
ASSERT_EQ(json["k2"]["k"].getUInt(), 4);
|
||||
ASSERT_EQ(json["k"].getUInt(), 5);
|
||||
}
|
Loading…
Reference in New Issue
Block a user