Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression test modify #3041

Merged
merged 11 commits into from
Oct 13, 2021
Merged
88 changes: 88 additions & 0 deletions src/common/expression/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,50 @@
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.

set(expression_test_common_libs
$<TARGET_OBJECTS:parser_obj>
$<TARGET_OBJECTS:expression_obj>
$<TARGET_OBJECTS:encryption_obj>
$<TARGET_OBJECTS:network_obj>
$<TARGET_OBJECTS:fs_obj>
$<TARGET_OBJECTS:stats_obj>
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:common_thrift_obj>
$<TARGET_OBJECTS:thrift_obj>
$<TARGET_OBJECTS:thread_obj>
$<TARGET_OBJECTS:datatypes_obj>
$<TARGET_OBJECTS:base_obj>
$<TARGET_OBJECTS:function_manager_obj>
$<TARGET_OBJECTS:wkt_wkb_io_obj>
$<TARGET_OBJECTS:agg_function_manager_obj>
$<TARGET_OBJECTS:meta_thrift_obj>
$<TARGET_OBJECTS:graph_thrift_obj>
$<TARGET_OBJECTS:http_client_obj>
$<TARGET_OBJECTS:storage_thrift_obj>
$<TARGET_OBJECTS:meta_obj>
$<TARGET_OBJECTS:meta_client_obj>
$<TARGET_OBJECTS:conf_obj>
$<TARGET_OBJECTS:charset_obj>
$<TARGET_OBJECTS:file_based_cluster_id_man_obj>
$<TARGET_OBJECTS:process_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:ft_es_graph_adapter_obj>
$<TARGET_OBJECTS:ws_common_obj>
$<TARGET_OBJECTS:version_obj>
$<TARGET_OBJECTS:graph_session_obj>
$<TARGET_OBJECTS:graph_flags_obj>
$<TARGET_OBJECTS:graph_auth_obj>
$<TARGET_OBJECTS:util_obj>
$<TARGET_OBJECTS:expr_visitor_obj>
$<TARGET_OBJECTS:graph_context_obj>
$<TARGET_OBJECTS:planner_obj>
$<TARGET_OBJECTS:validator_obj>
$<TARGET_OBJECTS:idgenerator_obj>
$<TARGET_OBJECTS:graph_obj>
$<TARGET_OBJECTS:ssl_obj>
$<TARGET_OBJECTS:memory_obj>
)

nebula_add_library(
expr_ctx_mock_obj OBJECT
ExpressionContextMock.cpp
Expand All @@ -24,9 +68,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_executable(
Expand All @@ -45,10 +91,12 @@ nebula_add_executable(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
follybenchmark
boost_regex
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_executable(
Expand Down Expand Up @@ -110,9 +158,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -129,9 +179,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -148,9 +200,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -167,9 +221,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -186,9 +242,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -205,9 +263,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -224,9 +284,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -243,9 +305,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -262,9 +326,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -281,9 +347,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -300,9 +368,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -319,9 +389,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -338,9 +410,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -357,9 +431,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -376,9 +452,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -395,9 +473,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -414,9 +494,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -433,9 +515,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -452,9 +536,11 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)

nebula_add_test(
Expand All @@ -471,7 +557,9 @@ nebula_add_test(
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:time_utils_obj>
$<TARGET_OBJECTS:fs_obj>
${expression_test_common_libs}
LIBRARIES
gtest
${THRIFT_LIBRARIES}
${PROXYGEN_LIBRARIES}
)
8 changes: 4 additions & 4 deletions src/common/expression/test/FunctionCallExpressionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ TEST_F(FunctionCallExpressionTest, FunctionCallTest) {
path.src.vid = "1";
STEP("2", "edge", 0, 1);
STEP("1", "edge", 0, -1);
TEST_FUNCTION(hasSameEdgeInPath, {path}, true);
Copy link
Contributor

@Shylock-Hg Shylock-Hg Oct 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should provide some new test utilities instead of expand them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't use TEST_FUNCTION?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TEST_FUNCTION is a parser process, here cannot construct a sentence to call parser.

TEST_PATH_FUNCTION(hasSameEdgeInPath, {path}, true);
}
{
// hasSameEdgeInPath
Expand All @@ -70,7 +70,7 @@ TEST_F(FunctionCallExpressionTest, FunctionCallTest) {
STEP("2", "edge", 0, 1);
STEP("1", "edge", 0, -1);
STEP("2", "edge", 0, 1);
TEST_FUNCTION(hasSameEdgeInPath, {path}, true);
TEST_PATH_FUNCTION(hasSameEdgeInPath, {path}, true);
}
{
// hasSameEdgeInPath
Expand All @@ -80,7 +80,7 @@ TEST_F(FunctionCallExpressionTest, FunctionCallTest) {
STEP("2", "edge", 0, 1);
STEP("1", "edge", 0, 1);
STEP("2", "edge", 0, 1);
TEST_FUNCTION(hasSameEdgeInPath, {path}, false);
TEST_PATH_FUNCTION(hasSameEdgeInPath, {path}, false);
}
{
// hasSameEdgeInPath
Expand All @@ -90,7 +90,7 @@ TEST_F(FunctionCallExpressionTest, FunctionCallTest) {
STEP("2", "edge", 0, 1);
STEP("1", "edge", 0, -1);
STEP("2", "edge", 1, 1);
TEST_FUNCTION(hasSameEdgeInPath, {path}, false);
TEST_PATH_FUNCTION(hasSameEdgeInPath, {path}, false);
}
// Check function
{
Expand Down
Loading