[improve](function) add error msg if exceeded maximum default value in repeat function (#32219)

add some error msg from repeat function, so the user could know the count is greater than default value.
This commit is contained in:
zhangstar333
2024-03-20 21:10:33 +08:00
committed by yiguolei
parent 8e3d28b93a
commit 7486e96b12
4 changed files with 51 additions and 28 deletions

View File

@ -174,15 +174,20 @@ TEST(function_string_test, function_string_repeat_test) {
std::string func_name = "repeat";
InputTypeSet input_types = {TypeIndex::String, TypeIndex::Int32};
DataSet data_set = {
{{std::string("a"), 3}, std::string("aaa")},
{{std::string("hel lo"), 2}, std::string("hel lohel lo")},
{{std::string("hello word"), -1}, std::string("")},
{{std::string(""), 1}, std::string("")},
{{std::string("a"), 1073741825}, std::string("aaaaaaaaaa")}, // ut repeat max num 10
{{std::string("HELLO,!^%"), 2}, std::string("HELLO,!^%HELLO,!^%")},
{{std::string(""), 2}, std::string("你你")}};
DataSet data_set = {{{std::string("a"), 3}, std::string("aaa")},
{{std::string("hel lo"), 2}, std::string("hel lohel lo")},
{{std::string("hello word"), -1}, std::string("")},
{{std::string(""), 1}, std::string("")},
{{std::string("HELLO,!^%"), 2}, std::string("HELLO,!^%HELLO,!^%")},
{{std::string(""), 2}, std::string("你你")}};
static_cast<void>(check_function<DataTypeString, true>(func_name, input_types, data_set));
{
DataSet data_set = {{{std::string("a"), 1073741825},
std::string("aaaaaaaaaa")}}; // ut repeat max num 10
Status st = check_function<DataTypeString, true>(func_name, input_types, data_set, true);
EXPECT_NE(Status::OK(), st);
}
}
TEST(function_string_test, function_string_reverse_test) {