Skip to content

Commit

Permalink
add const column be ut
Browse files Browse the repository at this point in the history
  • Loading branch information
xiedeyantu committed Apr 8, 2024
1 parent 3181054 commit 6ba3425
Showing 1 changed file with 61 additions and 15 deletions.
76 changes: 61 additions & 15 deletions be/test/vec/function/function_string_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,22 +1189,68 @@ TEST(function_string_test, function_uuid_test) {

TEST(function_string_test, function_strcmp_test) {
std::string func_name = "strcmp";
InputTypeSet input_types = {TypeIndex::String, TypeIndex::String};
{
InputTypeSet input_types = {TypeIndex::String, TypeIndex::String};

DataSet data_set = {{{Null(), Null()}, Null()},
{{std::string(""), std::string("")}, (int16_t)0},
{{std::string("test"), std::string("test")}, (int16_t)0},
{{std::string("test1"), std::string("test")}, (int16_t)1},
{{std::string("test"), std::string("test1")}, (int16_t)-1},
{{Null(), std::string("test")}, Null()},
{{std::string("test"), Null()}, Null()},
{{VARCHAR(""), VARCHAR("")}, (int16_t)0},
{{VARCHAR("test"), VARCHAR("test")}, (int16_t)0},
{{VARCHAR("test1"), VARCHAR("test")}, (int16_t)1},
{{VARCHAR("test"), VARCHAR("test1")}, (int16_t)-1},
{{Null(), VARCHAR("test")}, Null()},
{{VARCHAR("test"), Null()}, Null()}};
static_cast<void>(check_function<DataTypeInt16, true>(func_name, input_types, data_set));
DataSet data_set = {{{Null(), Null()}, Null()},
{{std::string(""), std::string("")}, (int16_t)0},
{{std::string("test"), std::string("test")}, (int16_t)0},
{{std::string("test1"), std::string("test")}, (int16_t)1},
{{std::string("test"), std::string("test1")}, (int16_t)-1},
{{Null(), std::string("test")}, Null()},
{{std::string("test"), Null()}, Null()},
{{VARCHAR(""), VARCHAR("")}, (int16_t)0},
{{VARCHAR("test"), VARCHAR("test")}, (int16_t)0},
{{VARCHAR("test1"), VARCHAR("test")}, (int16_t)1},
{{VARCHAR("test"), VARCHAR("test1")}, (int16_t)-1},
{{Null(), VARCHAR("test")}, Null()},
{{VARCHAR("test"), Null()}, Null()}};
static_cast<void>(check_function<DataTypeInt16, true>(func_name, input_types, data_set));
}
{
InputTypeSet input_types = {Consted {TypeIndex::String}, TypeIndex::String};
DataSet data_set = {{{Null(), Null()}, Null()},
{{std::string(""), std::string("")}, (int16_t)0},
{{std::string("test"), std::string("test")}, (int16_t)0},
{{std::string("test1"), std::string("test")}, (int16_t)1},
{{std::string("test"), std::string("test1")}, (int16_t)-1},
{{Null(), std::string("test")}, Null()},
{{std::string("test"), Null()}, Null()},
{{VARCHAR(""), VARCHAR("")}, (int16_t)0},
{{VARCHAR("test"), VARCHAR("test")}, (int16_t)0},
{{VARCHAR("test1"), VARCHAR("test")}, (int16_t)1},
{{VARCHAR("test"), VARCHAR("test1")}, (int16_t)-1},
{{Null(), VARCHAR("test")}, Null()},
{{VARCHAR("test"), Null()}, Null()}};

for (const auto& line : data_set) {
DataSet const_dataset = {line};
static_cast<void>(check_function<DataTypeInt16, true>(func_name, input_types,
const_dataset));
}
}
{
InputTypeSet input_types = {TypeIndex::String, Consted {TypeIndex::String}};
DataSet data_set = {{{Null(), Null()}, Null()},
{{std::string(""), std::string("")}, (int16_t)0},
{{std::string("test"), std::string("test")}, (int16_t)0},
{{std::string("test1"), std::string("test")}, (int16_t)1},
{{std::string("test"), std::string("test1")}, (int16_t)-1},
{{Null(), std::string("test")}, Null()},
{{std::string("test"), Null()}, Null()},
{{VARCHAR(""), VARCHAR("")}, (int16_t)0},
{{VARCHAR("test"), VARCHAR("test")}, (int16_t)0},
{{VARCHAR("test1"), VARCHAR("test")}, (int16_t)1},
{{VARCHAR("test"), VARCHAR("test1")}, (int16_t)-1},
{{Null(), VARCHAR("test")}, Null()},
{{VARCHAR("test"), Null()}, Null()}};

for (const auto& line : data_set) {
DataSet const_dataset = {line};
static_cast<void>(check_function<DataTypeInt16, true>(func_name, input_types,
const_dataset));
}
}
}

} // namespace doris::vectorized

0 comments on commit 6ba3425

Please sign in to comment.