Skip to content

Commit

Permalink
add more test
Browse files Browse the repository at this point in the history
  • Loading branch information
liujiwen-up committed Oct 12, 2024
1 parent 4452a4b commit 79d262c
Show file tree
Hide file tree
Showing 2 changed files with 226 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,102 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !empty_nullable --

-- !empty_not_nullable --

-- !all_null --
\N
\N
\N

-- !nullable --
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N
\N

-- !not_nullable --

hello
hello world
hello world
abcd

-- !nullable --



ehlowrd
ac

-- !not_nullable_null --
\N
\N
\N
\N
\N

-- !nullable_null --
\N
\N
\N
\N
\N

-- !const_nullable --
\N
\N
\N
\N
\N

-- !partial_const_nullable --
\N
\N
\N
\N
\N

-- !const_not_nullable --

-- !const_other_nullable --
-- !const_partial_nullable_no_null --
ab
ab
ab
ab
ab

-- !const_other_not_nullable --

-- !const_partial_nullable_no_null --
abc
hello
hello world
hello world
abcd

-- !const_not_nullable --
abdc
abdc
abdc
abdc
abdc

-- !1 --

Expand Down Expand Up @@ -228,3 +314,87 @@ hello
-- !72 --
hello world

-- !73 --

abcd
llo
llo world
llo world

-- !74 --

abcd
llo
llo world
llo world

-- !75 --

hello
hello world
hello world
abcd

-- !76 --



ac
lowrd

-- !77 --



ac
lowrd

-- !78 --



ehlowrd
ac

-- !79 --
\N
\N
\N
\N
\N

-- !80 --
\N
\N
\N
\N
\N

-- !81 --
\N
\N
\N
\N
\N

-- !82 --
\N
\N
\N
\N
\N

-- !83 --
\N
\N
\N
\N
\N

-- !84 --
\N
\N
\N
\N
\N

Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,46 @@ suite("test_trim_in") {
"replication_num" = "1"
);
"""
order_qt_empty_nullable "select trim_in(a, 'x') from test_trim_in"
order_qt_empty_not_nullable "select trim_in(b, 'x') from test_trim_in"

sql "insert into test_trim_in values (1, '1', null), (1, '1', null), (1, '1', null)"
order_qt_all_null "select trim_in(b, NULL) from test_trim_in"

sql "truncate table test_trim_in"
sql """ insert into test_trim_in values (1, "", ""), (2, "abcd", "ac"), (3, ' hello ', 'he '),
(4, ' hello world ', ' ehlowrd'),(5, ' hello world ', ' eh');
"""

/// all values
order_qt_nullable """
SELECT atan2(t.arg1_two_args, t.ARG2) as result
FROM (
SELECT hits_two_args.nothing, TABLE1.arg1_two_args, TABLE1.order1, TABLE2.ARG2, TABLE2.order2
FROM hits_two_args
CROSS JOIN (
SELECT b as arg1_two_args, k0 as order1
FROM test_trim_in
) as TABLE1
CROSS JOIN (
SELECT b as ARG2, k0 as order2
FROM test_trim_in
) as TABLE2
)t;
"""

/// nullables
order_qt_not_nullable "select trim_in(a, 'he') from test_trim_in"
order_qt_nullable "select trim_in(b, 'he') from test_trim_in"
order_qt_not_nullable_null "select trim_in(a, NULL) from test_trim_in"
order_qt_nullable_null "select trim_in(b, NULL) from test_trim_in"

/// consts. most by BE-UT
order_qt_const_nullable "select trim_in(NULL,NULL) from test_trim_in"
order_qt_partial_const_nullable "select trim_in(NULL, b) from test_trim_in"
order_qt_const_not_nullable "select trim_in(a,b) from test_trim_in"
order_qt_const_other_nullable "select trim_in('x',b) from test_trim_in"
order_qt_const_other_not_nullable "select trim_in('x',a) from test_trim_in"
order_qt_const_partial_nullable_no_null "select trim_in('abc', 'b')"
//[INVALID_ARGUMENT]Argument at index 1 for function trim must be constant
//order_qt_const_nullable_no_null "select trim_in(nullable('abc'),nullable('中文'))"
//order_qt_const_partial_nullable_no_null "select trim_in('abc',nullable('a'))"
//order_qt_const_nullable_no_null_multirows "select trim_in(nullable('abc'), nullable('a'))"
order_qt_partial_const_nullable "select trim_in(NULL, 'he') from test_trim_in"
order_qt_const_partial_nullable_no_null "select trim_in(nullable('abcd'), 'cde') from test_trim_in"
order_qt_const_other_not_nullable "select trim_in(a, 'x') from test_trim_in"
order_qt_const_not_nullable "select trim_in('abdc', 'df') from test_trim_in"



Expand Down Expand Up @@ -150,4 +179,17 @@ suite("test_trim_in") {
order_qt_70 "SELECT rtrim_in(CAST(' hello world ' AS CHAR(13)), ' eh');"
order_qt_71 "SELECT rtrim_in(CAST(' hello world ' AS CHAR(13)), ' ehlowrd');"
order_qt_72 "SELECT rtrim_in(CAST(' hello world ' AS CHAR(13)), ' x');"

order_qt_73 "SELECT trim_in(a, ' eh') from test_trim_in;"
order_qt_74 "SELECT ltrim_in(a, ' eh') from test_trim_in;"
order_qt_75 "SELECT rtrim_in(a, ' eh') from test_trim_in;"
order_qt_76 "SELECT trim_in(b, ' eh') from test_trim_in;"
order_qt_77 "SELECT ltrim_in(b, ' eh') from test_trim_in;"
order_qt_78 "SELECT rtrim_in(b, ' eh') from test_trim_in;"
order_qt_79 "SELECT trim_in(a, NULL) from test_trim_in;"
order_qt_80 "SELECT ltrim_in(a, NULL) from test_trim_in;"
order_qt_81 "SELECT rtrim_in(a, NULL) from test_trim_in;"
order_qt_82 "SELECT trim_in(b, NULL) from test_trim_in;"
order_qt_83 "SELECT ltrim_in(b, NULL) from test_trim_in;"
order_qt_84 "SELECT rtrim_in(b, NULL) from test_trim_in;"
}

0 comments on commit 79d262c

Please sign in to comment.