Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2e290b12
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2e290b12
编写于
1月 08, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225]udpate the test cases.
上级
ba1ec97b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
55 addition
and
55 deletion
+55
-55
src/query/tests/tsBufTest.cpp
src/query/tests/tsBufTest.cpp
+21
-21
src/query/tests/unitTest.cpp
src/query/tests/unitTest.cpp
+34
-34
未找到文件。
src/query/tests/tsBufTest.cpp
浏览文件 @
2e290b12
...
@@ -34,7 +34,7 @@ void simpleTest() {
...
@@ -34,7 +34,7 @@ void simpleTest() {
int32_t
num
=
10
;
int32_t
num
=
10
;
tVariant
t
=
{
0
};
tVariant
t
=
{
0
};
t
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
t
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
t
.
i64
Key
=
1
;
t
.
i64
=
1
;
int64_t
*
list
=
createTsList
(
10
,
10000000
,
30
);
int64_t
*
list
=
createTsList
(
10
,
10000000
,
30
);
tsBufAppend
(
pTSBuf
,
0
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
tsBufAppend
(
pTSBuf
,
0
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
...
@@ -61,7 +61,7 @@ void largeTSTest() {
...
@@ -61,7 +61,7 @@ void largeTSTest() {
int32_t
num
=
1000000
;
int32_t
num
=
1000000
;
tVariant
t
=
{
0
};
tVariant
t
=
{
0
};
t
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
t
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
t
.
i64
Key
=
1
;
t
.
i64
=
1
;
int64_t
*
list
=
createTsList
(
num
,
10000000
,
30
);
int64_t
*
list
=
createTsList
(
num
,
10000000
,
30
);
tsBufAppend
(
pTSBuf
,
0
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
tsBufAppend
(
pTSBuf
,
0
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
...
@@ -93,7 +93,7 @@ void multiTagsTest() {
...
@@ -93,7 +93,7 @@ void multiTagsTest() {
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
t
.
i64
Key
=
i
;
t
.
i64
=
i
;
tsBufAppend
(
pTSBuf
,
0
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
tsBufAppend
(
pTSBuf
,
0
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
free
(
list
);
free
(
list
);
...
@@ -104,7 +104,7 @@ void multiTagsTest() {
...
@@ -104,7 +104,7 @@ void multiTagsTest() {
EXPECT_EQ
(
pTSBuf
->
tsOrder
,
TSDB_ORDER_ASC
);
EXPECT_EQ
(
pTSBuf
->
tsOrder
,
TSDB_ORDER_ASC
);
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
num
*
sizeof
(
int64_t
));
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
num
*
sizeof
(
int64_t
));
EXPECT_EQ
(
pTSBuf
->
block
.
tag
.
i64
Key
,
numOfTags
-
1
);
EXPECT_EQ
(
pTSBuf
->
block
.
tag
.
i64
,
numOfTags
-
1
);
EXPECT_EQ
(
pTSBuf
->
numOfGroups
,
1
);
EXPECT_EQ
(
pTSBuf
->
numOfGroups
,
1
);
tsBufFlush
(
pTSBuf
);
tsBufFlush
(
pTSBuf
);
...
@@ -131,7 +131,7 @@ void multiVnodeTagsTest() {
...
@@ -131,7 +131,7 @@ void multiVnodeTagsTest() {
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
t
.
i64
Key
=
i
;
t
.
i64
=
i
;
tsBufAppend
(
pTSBuf
,
j
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
tsBufAppend
(
pTSBuf
,
j
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
free
(
list
);
free
(
list
);
...
@@ -144,11 +144,11 @@ void multiVnodeTagsTest() {
...
@@ -144,11 +144,11 @@ void multiVnodeTagsTest() {
EXPECT_EQ
(
pTSBuf
->
tsOrder
,
TSDB_ORDER_ASC
);
EXPECT_EQ
(
pTSBuf
->
tsOrder
,
TSDB_ORDER_ASC
);
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
num
*
sizeof
(
int64_t
));
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
num
*
sizeof
(
int64_t
));
EXPECT_EQ
(
pTSBuf
->
block
.
tag
.
i64
Key
,
numOfTags
-
1
);
EXPECT_EQ
(
pTSBuf
->
block
.
tag
.
i64
,
numOfTags
-
1
);
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
num
*
sizeof
(
int64_t
));
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
num
*
sizeof
(
int64_t
));
EXPECT_EQ
(
pTSBuf
->
block
.
tag
.
i64
Key
,
numOfTags
-
1
);
EXPECT_EQ
(
pTSBuf
->
block
.
tag
.
i64
,
numOfTags
-
1
);
tsBufFlush
(
pTSBuf
);
tsBufFlush
(
pTSBuf
);
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
0
);
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
0
);
...
@@ -175,7 +175,7 @@ void loadDataTest() {
...
@@ -175,7 +175,7 @@ void loadDataTest() {
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
t
.
i64
Key
=
i
;
t
.
i64
=
i
;
tsBufAppend
(
pTSBuf
,
j
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
tsBufAppend
(
pTSBuf
,
j
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
printf
(
"%d - %"
PRIu64
"
\n
"
,
i
,
list
[
0
]);
printf
(
"%d - %"
PRIu64
"
\n
"
,
i
,
list
[
0
]);
...
@@ -190,11 +190,11 @@ void loadDataTest() {
...
@@ -190,11 +190,11 @@ void loadDataTest() {
EXPECT_EQ
(
pTSBuf
->
tsOrder
,
TSDB_ORDER_ASC
);
EXPECT_EQ
(
pTSBuf
->
tsOrder
,
TSDB_ORDER_ASC
);
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
num
*
sizeof
(
int64_t
));
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
num
*
sizeof
(
int64_t
));
EXPECT_EQ
(
pTSBuf
->
block
.
tag
.
i64
Key
,
numOfTags
-
1
);
EXPECT_EQ
(
pTSBuf
->
block
.
tag
.
i64
,
numOfTags
-
1
);
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
num
*
sizeof
(
int64_t
));
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
num
*
sizeof
(
int64_t
));
EXPECT_EQ
(
pTSBuf
->
block
.
tag
.
i64
Key
,
numOfTags
-
1
);
EXPECT_EQ
(
pTSBuf
->
block
.
tag
.
i64
,
numOfTags
-
1
);
tsBufFlush
(
pTSBuf
);
tsBufFlush
(
pTSBuf
);
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
0
);
EXPECT_EQ
(
pTSBuf
->
tsData
.
len
,
0
);
...
@@ -253,7 +253,7 @@ void TSTraverse() {
...
@@ -253,7 +253,7 @@ void TSTraverse() {
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
t
.
i64
Key
=
i
;
t
.
i64
=
i
;
tsBufAppend
(
pTSBuf
,
j
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
tsBufAppend
(
pTSBuf
,
j
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
printf
(
"%d - %d - %"
PRIu64
", %"
PRIu64
"
\n
"
,
j
,
i
,
list
[
0
],
list
[
num
-
1
]);
printf
(
"%d - %d - %"
PRIu64
", %"
PRIu64
"
\n
"
,
j
,
i
,
list
[
0
],
list
[
num
-
1
]);
...
@@ -297,14 +297,14 @@ void TSTraverse() {
...
@@ -297,14 +297,14 @@ void TSTraverse() {
tVariant
t
=
{
0
};
tVariant
t
=
{
0
};
t
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
t
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
t
.
i64
Key
=
startTag
;
t
.
i64
=
startTag
;
tsBufGetElemStartPos
(
pTSBuf
,
startVnode
,
&
t
);
tsBufGetElemStartPos
(
pTSBuf
,
startVnode
,
&
t
);
int32_t
totalOutput
=
10
;
int32_t
totalOutput
=
10
;
while
(
1
)
{
while
(
1
)
{
STSElem
elem
=
tsBufGetElem
(
pTSBuf
);
STSElem
elem
=
tsBufGetElem
(
pTSBuf
);
printf
(
"%d-%"
PRIu64
"-%"
PRIu64
"
\n
"
,
elem
.
id
,
elem
.
tag
->
i64
Key
,
elem
.
ts
);
printf
(
"%d-%"
PRIu64
"-%"
PRIu64
"
\n
"
,
elem
.
id
,
elem
.
tag
->
i64
,
elem
.
ts
);
if
(
!
tsBufNextPos
(
pTSBuf
))
{
if
(
!
tsBufNextPos
(
pTSBuf
))
{
break
;
break
;
...
@@ -314,7 +314,7 @@ void TSTraverse() {
...
@@ -314,7 +314,7 @@ void TSTraverse() {
totalOutput
=
10
;
totalOutput
=
10
;
startTag
-=
1
;
startTag
-=
1
;
t
.
i64
Key
=
startTag
;
t
.
i64
=
startTag
;
tsBufGetElemStartPos
(
pTSBuf
,
startVnode
,
&
t
);
tsBufGetElemStartPos
(
pTSBuf
,
startVnode
,
&
t
);
if
(
startTag
==
0
)
{
if
(
startTag
==
0
)
{
...
@@ -345,14 +345,14 @@ void TSTraverse() {
...
@@ -345,14 +345,14 @@ void TSTraverse() {
startVnode
=
1
;
startVnode
=
1
;
startTag
=
2
;
startTag
=
2
;
t
.
i64
Key
=
startTag
;
t
.
i64
=
startTag
;
tsBufGetElemStartPos
(
pTSBuf
,
startVnode
,
&
t
);
tsBufGetElemStartPos
(
pTSBuf
,
startVnode
,
&
t
);
totalOutput
=
10
;
totalOutput
=
10
;
while
(
1
)
{
while
(
1
)
{
STSElem
elem
=
tsBufGetElem
(
pTSBuf
);
STSElem
elem
=
tsBufGetElem
(
pTSBuf
);
printf
(
"%d-%"
PRIu64
"-%"
PRIu64
"
\n
"
,
elem
.
id
,
elem
.
tag
->
i64
Key
,
elem
.
ts
);
printf
(
"%d-%"
PRIu64
"-%"
PRIu64
"
\n
"
,
elem
.
id
,
elem
.
tag
->
i64
,
elem
.
ts
);
if
(
!
tsBufNextPos
(
pTSBuf
))
{
if
(
!
tsBufNextPos
(
pTSBuf
))
{
break
;
break
;
...
@@ -362,7 +362,7 @@ void TSTraverse() {
...
@@ -362,7 +362,7 @@ void TSTraverse() {
totalOutput
=
10
;
totalOutput
=
10
;
startTag
-=
1
;
startTag
-=
1
;
t
.
i64
Key
=
startTag
;
t
.
i64
=
startTag
;
tsBufGetElemStartPos
(
pTSBuf
,
startVnode
,
&
t
);
tsBufGetElemStartPos
(
pTSBuf
,
startVnode
,
&
t
);
if
(
startTag
<
0
)
{
if
(
startTag
<
0
)
{
...
@@ -414,7 +414,7 @@ void mergeDiffVnodeBufferTest() {
...
@@ -414,7 +414,7 @@ void mergeDiffVnodeBufferTest() {
int64_t
start
=
10000000
;
int64_t
start
=
10000000
;
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
t
.
i64
Key
=
i
;
t
.
i64
=
i
;
tsBufAppend
(
pTSBuf1
,
1
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
tsBufAppend
(
pTSBuf1
,
1
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
tsBufAppend
(
pTSBuf2
,
9
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
tsBufAppend
(
pTSBuf2
,
9
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
...
@@ -451,7 +451,7 @@ void mergeIdenticalVnodeBufferTest() {
...
@@ -451,7 +451,7 @@ void mergeIdenticalVnodeBufferTest() {
int64_t
start
=
10000000
;
int64_t
start
=
10000000
;
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
t
.
i64
Key
=
i
;
t
.
i64
=
i
;
tsBufAppend
(
pTSBuf1
,
12
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
tsBufAppend
(
pTSBuf1
,
12
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
free
(
list
);
free
(
list
);
...
@@ -462,7 +462,7 @@ void mergeIdenticalVnodeBufferTest() {
...
@@ -462,7 +462,7 @@ void mergeIdenticalVnodeBufferTest() {
for
(
int32_t
i
=
numOfTags
;
i
<
numOfTags
*
2
;
++
i
)
{
for
(
int32_t
i
=
numOfTags
;
i
<
numOfTags
*
2
;
++
i
)
{
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
int64_t
*
list
=
createTsList
(
num
,
start
,
step
);
t
.
i64
Key
=
i
;
t
.
i64
=
i
;
tsBufAppend
(
pTSBuf2
,
77
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
tsBufAppend
(
pTSBuf2
,
77
,
&
t
,
(
const
char
*
)
list
,
num
*
sizeof
(
int64_t
));
free
(
list
);
free
(
list
);
...
@@ -487,7 +487,7 @@ void mergeIdenticalVnodeBufferTest() {
...
@@ -487,7 +487,7 @@ void mergeIdenticalVnodeBufferTest() {
EXPECT_EQ
(
elem
.
id
,
77
);
EXPECT_EQ
(
elem
.
id
,
77
);
}
}
printf
(
"%d-%"
PRIu64
"-%"
PRIu64
"
\n
"
,
elem
.
id
,
elem
.
tag
->
i64
Key
,
elem
.
ts
);
printf
(
"%d-%"
PRIu64
"-%"
PRIu64
"
\n
"
,
elem
.
id
,
elem
.
tag
->
i64
,
elem
.
ts
);
}
}
tsBufDestroy
(
pTSBuf1
);
tsBufDestroy
(
pTSBuf1
);
...
...
src/query/tests/unitTest.cpp
浏览文件 @
2e290b12
...
@@ -27,22 +27,22 @@ int32_t testValidateName(char* name) {
...
@@ -27,22 +27,22 @@ int32_t testValidateName(char* name) {
}
}
static
void
_init_tvariant_bool
(
tVariant
*
t
)
{
static
void
_init_tvariant_bool
(
tVariant
*
t
)
{
t
->
i64
Key
=
TSDB_FALSE
;
t
->
i64
=
TSDB_FALSE
;
t
->
nType
=
TSDB_DATA_TYPE_BOOL
;
t
->
nType
=
TSDB_DATA_TYPE_BOOL
;
}
}
static
void
_init_tvariant_tinyint
(
tVariant
*
t
)
{
static
void
_init_tvariant_tinyint
(
tVariant
*
t
)
{
t
->
i64
Key
=
-
27
;
t
->
i64
=
-
27
;
t
->
nType
=
TSDB_DATA_TYPE_TINYINT
;
t
->
nType
=
TSDB_DATA_TYPE_TINYINT
;
}
}
static
void
_init_tvariant_int
(
tVariant
*
t
)
{
static
void
_init_tvariant_int
(
tVariant
*
t
)
{
t
->
i64
Key
=
-
23997659
;
t
->
i64
=
-
23997659
;
t
->
nType
=
TSDB_DATA_TYPE_INT
;
t
->
nType
=
TSDB_DATA_TYPE_INT
;
}
}
static
void
_init_tvariant_bigint
(
tVariant
*
t
)
{
static
void
_init_tvariant_bigint
(
tVariant
*
t
)
{
t
->
i64
Key
=
-
3333333333333
;
t
->
i64
=
-
3333333333333
;
t
->
nType
=
TSDB_DATA_TYPE_BIGINT
;
t
->
nType
=
TSDB_DATA_TYPE_BIGINT
;
}
}
...
@@ -446,19 +446,19 @@ TEST(testCase, tvariant_convert) {
...
@@ -446,19 +446,19 @@ TEST(testCase, tvariant_convert) {
_init_tvariant_bool
(
&
t
);
_init_tvariant_bool
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
0
);
EXPECT_EQ
(
t
.
i64
,
0
);
_init_tvariant_bool
(
&
t
);
_init_tvariant_bool
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_TINYINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_TINYINT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
0
);
EXPECT_EQ
(
t
.
i64
,
0
);
_init_tvariant_bool
(
&
t
);
_init_tvariant_bool
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_SMALLINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_SMALLINT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
0
);
EXPECT_EQ
(
t
.
i64
,
0
);
_init_tvariant_bool
(
&
t
);
_init_tvariant_bool
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
0
);
EXPECT_EQ
(
t
.
i64
,
0
);
_init_tvariant_bool
(
&
t
);
_init_tvariant_bool
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
...
@@ -481,23 +481,23 @@ TEST(testCase, tvariant_convert) {
...
@@ -481,23 +481,23 @@ TEST(testCase, tvariant_convert) {
// 2. tinyint to other data types
// 2. tinyint to other data types
_init_tvariant_tinyint
(
&
t
);
_init_tvariant_tinyint
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
1
);
EXPECT_EQ
(
t
.
i64
,
1
);
_init_tvariant_tinyint
(
&
t
);
_init_tvariant_tinyint
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_TINYINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_TINYINT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
-
27
);
EXPECT_EQ
(
t
.
i64
,
-
27
);
_init_tvariant_tinyint
(
&
t
);
_init_tvariant_tinyint
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_SMALLINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_SMALLINT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
-
27
);
EXPECT_EQ
(
t
.
i64
,
-
27
);
_init_tvariant_tinyint
(
&
t
);
_init_tvariant_tinyint
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_INT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_INT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
-
27
);
EXPECT_EQ
(
t
.
i64
,
-
27
);
_init_tvariant_tinyint
(
&
t
);
_init_tvariant_tinyint
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
-
27
);
EXPECT_EQ
(
t
.
i64
,
-
27
);
_init_tvariant_tinyint
(
&
t
);
_init_tvariant_tinyint
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
...
@@ -521,7 +521,7 @@ TEST(testCase, tvariant_convert) {
...
@@ -521,7 +521,7 @@ TEST(testCase, tvariant_convert) {
// types//////////////////////////////////////////////////////////////////
// types//////////////////////////////////////////////////////////////////
_init_tvariant_int
(
&
t
);
_init_tvariant_int
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
1
);
EXPECT_EQ
(
t
.
i64
,
1
);
_init_tvariant_int
(
&
t
);
_init_tvariant_int
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_TINYINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_TINYINT
),
0
);
...
@@ -531,11 +531,11 @@ TEST(testCase, tvariant_convert) {
...
@@ -531,11 +531,11 @@ TEST(testCase, tvariant_convert) {
_init_tvariant_int
(
&
t
);
_init_tvariant_int
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_INT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_INT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
-
23997659
);
EXPECT_EQ
(
t
.
i64
,
-
23997659
);
_init_tvariant_int
(
&
t
);
_init_tvariant_int
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
-
23997659
);
EXPECT_EQ
(
t
.
i64
,
-
23997659
);
_init_tvariant_int
(
&
t
);
_init_tvariant_int
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
...
@@ -559,7 +559,7 @@ TEST(testCase, tvariant_convert) {
...
@@ -559,7 +559,7 @@ TEST(testCase, tvariant_convert) {
// type//////////////////////////////////////////////////////////////////////////////
// type//////////////////////////////////////////////////////////////////////////////
_init_tvariant_bigint
(
&
t
);
_init_tvariant_bigint
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
1
);
EXPECT_EQ
(
t
.
i64
,
1
);
_init_tvariant_bigint
(
&
t
);
_init_tvariant_bigint
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_TINYINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_TINYINT
),
0
);
...
@@ -572,7 +572,7 @@ TEST(testCase, tvariant_convert) {
...
@@ -572,7 +572,7 @@ TEST(testCase, tvariant_convert) {
_init_tvariant_bigint
(
&
t
);
_init_tvariant_bigint
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
-
3333333333333
);
EXPECT_EQ
(
t
.
i64
,
-
3333333333333
);
_init_tvariant_bigint
(
&
t
);
_init_tvariant_bigint
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
...
@@ -596,11 +596,11 @@ TEST(testCase, tvariant_convert) {
...
@@ -596,11 +596,11 @@ TEST(testCase, tvariant_convert) {
// types////////////////////////////////////////////////////////////////////////
// types////////////////////////////////////////////////////////////////////////
_init_tvariant_float
(
&
t
);
_init_tvariant_float
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
1
);
EXPECT_EQ
(
t
.
i64
,
1
);
_init_tvariant_float
(
&
t
);
_init_tvariant_float
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
-
8991212199
);
EXPECT_EQ
(
t
.
i64
,
-
8991212199
);
_init_tvariant_float
(
&
t
);
_init_tvariant_float
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
...
@@ -626,14 +626,14 @@ TEST(testCase, tvariant_convert) {
...
@@ -626,14 +626,14 @@ TEST(testCase, tvariant_convert) {
t
.
nLen
=
strlen
(
t
.
pz
);
t
.
nLen
=
strlen
(
t
.
pz
);
t
.
nType
=
TSDB_DATA_TYPE_BINARY
;
t
.
nType
=
TSDB_DATA_TYPE_BINARY
;
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
1
);
EXPECT_EQ
(
t
.
i64
,
1
);
_init_tvariant_binary
(
&
t
);
_init_tvariant_binary
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
-
1
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
-
1
);
_init_tvariant_binary
(
&
t
);
_init_tvariant_binary
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
200000
);
EXPECT_EQ
(
t
.
i64
,
200000
);
_init_tvariant_binary
(
&
t
);
_init_tvariant_binary
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
...
@@ -659,14 +659,14 @@ TEST(testCase, tvariant_convert) {
...
@@ -659,14 +659,14 @@ TEST(testCase, tvariant_convert) {
t
.
nLen
=
wcslen
(
t
.
wpz
);
t
.
nLen
=
wcslen
(
t
.
wpz
);
t
.
nType
=
TSDB_DATA_TYPE_NCHAR
;
t
.
nType
=
TSDB_DATA_TYPE_NCHAR
;
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
0
);
EXPECT_EQ
(
t
.
i64
,
0
);
_init_tvariant_nchar
(
&
t
);
_init_tvariant_nchar
(
&
t
);
EXPECT_LE
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
EXPECT_LE
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BOOL
),
0
);
_init_tvariant_nchar
(
&
t
);
_init_tvariant_nchar
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_BIGINT
),
0
);
EXPECT_EQ
(
t
.
i64
Key
,
-
2000000
);
EXPECT_EQ
(
t
.
i64
,
-
2000000
);
_init_tvariant_nchar
(
&
t
);
_init_tvariant_nchar
(
&
t
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
EXPECT_EQ
(
tVariantTypeSetType
(
&
t
,
TSDB_DATA_TYPE_FLOAT
),
0
);
...
@@ -732,34 +732,34 @@ static SStrToken createStrToken(char* s) {
...
@@ -732,34 +732,34 @@ static SStrToken createStrToken(char* s) {
TEST
(
testCase
,
isValidNumber_test
)
{
TEST
(
testCase
,
isValidNumber_test
)
{
SStrToken
t1
=
createStrToken
(
"123abc"
);
SStrToken
t1
=
createStrToken
(
"123abc"
);
EXPECT_EQ
(
isValidNumber
(
&
t1
),
TK_ILLEGAL
);
EXPECT_EQ
(
tGetNumericStringType
(
&
t1
),
TK_ILLEGAL
);
t1
=
createStrToken
(
"0xabc"
);
t1
=
createStrToken
(
"0xabc"
);
EXPECT_EQ
(
isValidNumber
(
&
t1
),
TK_HEX
);
EXPECT_EQ
(
tGetNumericStringType
(
&
t1
),
TK_HEX
);
t1
=
createStrToken
(
"0b11101"
);
t1
=
createStrToken
(
"0b11101"
);
EXPECT_EQ
(
isValidNumber
(
&
t1
),
TK_BIN
);
EXPECT_EQ
(
tGetNumericStringType
(
&
t1
),
TK_BIN
);
t1
=
createStrToken
(
".134abc"
);
t1
=
createStrToken
(
".134abc"
);
EXPECT_EQ
(
isValidNumber
(
&
t1
),
TK_ILLEGAL
);
EXPECT_EQ
(
tGetNumericStringType
(
&
t1
),
TK_ILLEGAL
);
t1
=
createStrToken
(
"1e1 "
);
t1
=
createStrToken
(
"1e1 "
);
EXPECT_EQ
(
isValidNumber
(
&
t1
),
TK_ILLEGAL
);
EXPECT_EQ
(
tGetNumericStringType
(
&
t1
),
TK_ILLEGAL
);
t1
=
createStrToken
(
"1+2"
);
t1
=
createStrToken
(
"1+2"
);
EXPECT_EQ
(
isValidNumber
(
&
t1
),
TK_ILLEGAL
);
EXPECT_EQ
(
tGetNumericStringType
(
&
t1
),
TK_ILLEGAL
);
t1
=
createStrToken
(
"-0x123"
);
t1
=
createStrToken
(
"-0x123"
);
EXPECT_EQ
(
isValidNumber
(
&
t1
),
TK_HEX
);
EXPECT_EQ
(
tGetNumericStringType
(
&
t1
),
TK_HEX
);
t1
=
createStrToken
(
"-1"
);
t1
=
createStrToken
(
"-1"
);
EXPECT_EQ
(
isValidNumber
(
&
t1
),
TK_INTEGER
);
EXPECT_EQ
(
tGetNumericStringType
(
&
t1
),
TK_INTEGER
);
t1
=
createStrToken
(
"-0b1110"
);
t1
=
createStrToken
(
"-0b1110"
);
EXPECT_EQ
(
isValidNumber
(
&
t1
),
TK_BIN
);
EXPECT_EQ
(
tGetNumericStringType
(
&
t1
),
TK_BIN
);
t1
=
createStrToken
(
"-.234"
);
t1
=
createStrToken
(
"-.234"
);
EXPECT_EQ
(
isValidNumber
(
&
t1
),
TK_FLOAT
);
EXPECT_EQ
(
tGetNumericStringType
(
&
t1
),
TK_FLOAT
);
}
}
TEST
(
testCase
,
getTempFilePath_test
)
{
TEST
(
testCase
,
getTempFilePath_test
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录