From afb4a7e06be6792af09b1d4d2df8a2ffe8a86784 Mon Sep 17 00:00:00 2001 From: Ankita Victor Date: Fri, 15 Mar 2024 21:08:46 +0530 Subject: [PATCH] Fix format --- velox/functions/sparksql/tests/StringTest.cpp | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/velox/functions/sparksql/tests/StringTest.cpp b/velox/functions/sparksql/tests/StringTest.cpp index 0e692c8f3b8c..995f9a96dc4a 100644 --- a/velox/functions/sparksql/tests/StringTest.cpp +++ b/velox/functions/sparksql/tests/StringTest.cpp @@ -456,23 +456,23 @@ TEST_F(StringTest, replace) { return evaluateOnce("replace(c0, c1)", str, replaced); }; - auto replace = [&](std::optional str, - std::optional replaced, - std::optional replacement) { + auto replaceWithReplacement = [&](std::optional str, + std::optional replaced, + std::optional replacement) { return evaluateOnce( "replace(c0, c1, c2)", str, replaced, replacement); }; EXPECT_EQ(replace("aaabaac", "a"), "bc"); EXPECT_EQ(replace("aaabaac", ""), "aaabaac"); - EXPECT_EQ(replace("aaabaac", "a", "z"), "zzzbzzc"); - EXPECT_EQ(replace("aaabaac", "", "z"), "aaabaac"); - EXPECT_EQ(replace("aaabaac", "a", ""), "bc"); - EXPECT_EQ(replace("aaabaac", "x", "z"), "aaabaac"); - EXPECT_EQ(replace("aaabaac", "aaa", "z"), "zbaac"); - EXPECT_EQ(replace("aaabaac", "a", "xyz"), "xyzxyzxyzbxyzxyzc"); - EXPECT_EQ(replace("aaabaac", "aaabaac", "z"), "z"); - EXPECT_EQ( - replace("123\u6570\u6570\u636E", "\u6570\u636E", "data"), + EXPECT_EQ(replaceWithReplacement("aaabaac", "a", "z"), "zzzbzzc"); + EXPECT_EQ(replaceWithReplacement("aaabaac", "", "z"), "aaabaac"); + EXPECT_EQ(replaceWithReplacement("aaabaac", "a", ""), "bc"); + EXPECT_EQ(replaceWithReplacement("aaabaac", "x", "z"), "aaabaac"); + EXPECT_EQ(replaceWithReplacement("aaabaac", "aaa", "z"), "zbaac"); + EXPECT_EQ(replaceWithReplacement("aaabaac", "a", "xyz"), "xyzxyzxyzbxyzxyzc"); + EXPECT_EQ(replaceWithReplacement("aaabaac", "aaabaac", "z"), "z"); + EXPECT_EQ( + replaceWithReplacement("123\u6570\u6570\u636E", "\u6570\u636E", "data"), "123\u6570data"); } @@ -526,8 +526,8 @@ TEST_F(StringTest, rtrim) { return evaluateOnce("rtrim(c0)", srcStr); }; - auto rtrim = [&](std::optional trimStr, - std::optional srcStr) { + auto rtrimWithTrimStr = [&](std::optional trimStr, + std::optional srcStr) { return evaluateOnce("rtrim(c0, c1)", trimStr, srcStr); }; EXPECT_EQ(rtrim(""), ""); @@ -540,21 +540,25 @@ TEST_F(StringTest, rtrim) { EXPECT_EQ(rtrim("\u6570\u636E\t "), "\u6570\u636E\t"); EXPECT_EQ(rtrim("\u6570\u636E\t"), "\u6570\u636E\t"); - EXPECT_EQ(rtrim("", ""), ""); - EXPECT_EQ(rtrim("", "srcStr"), "srcStr"); - EXPECT_EQ(rtrim("trimStr", ""), ""); - EXPECT_EQ(rtrim("data!egr< >int", "integer data!"), ""); - EXPECT_EQ(rtrim("int", "integer data!"), "integer data!"); - EXPECT_EQ(rtrim("!!at", "integer data!"), "integer d"); - EXPECT_EQ(rtrim("a", "integer data!"), "integer data!"); + EXPECT_EQ(rtrimWithTrimStr("", ""), ""); + EXPECT_EQ(rtrimWithTrimStr("", "srcStr"), "srcStr"); + EXPECT_EQ(rtrimWithTrimStr("trimStr", ""), ""); + EXPECT_EQ(rtrimWithTrimStr("data!egr< >int", "integer data!"), ""); + EXPECT_EQ(rtrimWithTrimStr("int", "integer data!"), "integer data!"); + EXPECT_EQ(rtrimWithTrimStr("!!at", "integer data!"), "integer d"); + EXPECT_EQ(rtrimWithTrimStr("a", "integer data!"), "integer data!"); EXPECT_EQ( - rtrim("\u6570\u6574!\u6570 \u636E!", "\u6574\u6570 \u6570\u636E!"), ""); + rtrimWithTrimStr( + "\u6570\u6574!\u6570 \u636E!", "\u6574\u6570 \u6570\u636E!"), + ""); EXPECT_EQ( - rtrim(" \u6574\u6570 ", "\u6574\u6570 \u6570\u636E!"), + rtrimWithTrimStr(" \u6574\u6570 ", "\u6574\u6570 \u6570\u636E!"), "\u6574\u6570 \u6570\u636E!"); - EXPECT_EQ(rtrim("! \u6570\u636E!", "\u6574\u6570 \u6570\u636E!"), "\u6574"); EXPECT_EQ( - rtrim("\u6570", "\u6574\u6570 \u6570\u636E!"), + rtrimWithTrimStr("! \u6570\u636E!", "\u6574\u6570 \u6570\u636E!"), + "\u6574"); + EXPECT_EQ( + rtrimWithTrimStr("\u6570", "\u6574\u6570 \u6570\u636E!"), "\u6574\u6570 \u6570\u636E!"); }