Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
033b2519
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
033b2519
编写于
8月 24, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: update the unit test cases.
上级
b8753573
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
23 deletion
+28
-23
source/libs/executor/test/executorTests.cpp
source/libs/executor/test/executorTests.cpp
+0
-1
source/libs/executor/test/lhashTests.cpp
source/libs/executor/test/lhashTests.cpp
+26
-19
source/libs/executor/test/sortTests.cpp
source/libs/executor/test/sortTests.cpp
+2
-3
未找到文件。
source/libs/executor/test/executorTests.cpp
浏览文件 @
033b2519
...
...
@@ -26,7 +26,6 @@
#include "executor.h"
#include "executorimpl.h"
#include "function.h"
#include "stub.h"
#include "taos.h"
#include "tdatablock.h"
#include "tdef.h"
...
...
source/libs/executor/test/lhashTests.cpp
浏览文件 @
033b2519
...
...
@@ -26,40 +26,47 @@
TEST
(
testCase
,
linear_hash_Tests
)
{
taosSeedRand
(
taosGetTimestampSec
());
strcpy
(
tsTempDir
,
"/tmp/"
);
_hash_fn_t
fn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
);
#if 0
SLHashObj* pHashObj = tHashInit(256, 4096, fn, 320);
for(int32_t i = 0; i < 5000000; ++i) {
int64_t
st
=
taosGetTimestampUs
();
SLHashObj
*
pHashObj
=
tHashInit
(
4098
*
4
*
2
,
512
,
fn
,
40
);
for
(
int32_t
i
=
0
;
i
<
1000000
;
++
i
)
{
int32_t
code
=
tHashPut
(
pHashObj
,
&
i
,
sizeof
(
i
),
&
i
,
sizeof
(
i
));
assert
(
code
==
0
);
}
// tHashPrint(pHashObj, LINEAR_HASH_STATIS);
int64_t
et
=
taosGetTimestampUs
();
// for(int32_t i = 0; i < 10000; ++i) {
// char* v = tHashGet(pHashObj, &i, sizeof(i));
// if (v != NULL) {
//// printf("find value: %d, key:%d\n", *(int32_t*) v, i);
// } else {
for
(
int32_t
i
=
0
;
i
<
1000000
;
++
i
)
{
if
(
i
==
950000
)
{
printf
(
"kf
\n
"
);
}
char
*
v
=
tHashGet
(
pHashObj
,
&
i
,
sizeof
(
i
));
if
(
v
!=
NULL
)
{
// printf("find value: %d, key:%d\n", *(int32_t*) v, i);
}
else
{
// printf("failed to found key:%d in hash\n", i);
//
}
//
}
}
}
tHashPrint(pHashObj, LINEAR_HASH_STATIS);
//
tHashPrint(pHashObj, LINEAR_HASH_STATIS);
tHashCleanup
(
pHashObj
);
#endif
int64_t
et1
=
taosGetTimestampUs
();
#if 0
SHashObj* pHashObj = taosHashInit(1000, fn, false, HASH_NO_LOCK);
SHashObj
*
pHashObj1
=
taosHashInit
(
1000
,
fn
,
false
,
HASH_NO_LOCK
);
for
(
int32_t
i
=
0
;
i
<
1000000
;
++
i
)
{
taosHashPut(pHashObj, &i, sizeof(i), &i, sizeof(i));
taosHashPut
(
pHashObj
1
,
&
i
,
sizeof
(
i
),
&
i
,
sizeof
(
i
));
}
for(int32_t i = 0; i < 10000; ++i) {
void* v = taosHashGet(pHashObj, &i, sizeof(i));
for
(
int32_t
i
=
0
;
i
<
10000
00
;
++
i
)
{
void
*
v
=
taosHashGet
(
pHashObj
1
,
&
i
,
sizeof
(
i
));
}
taosHashCleanup(pHashObj);
#endif
taosHashCleanup
(
pHashObj1
);
int64_t
et2
=
taosGetTimestampUs
();
printf
(
"linear hash time:%.2f ms, buildHash:%.2f ms, hash:%.2f
\n
"
,
(
et1
-
st
)
/
1000.0
,
(
et
-
st
)
/
1000.0
,
(
et2
-
et1
)
/
1000.0
);
}
\ No newline at end of file
source/libs/executor/test/sortTests.cpp
浏览文件 @
033b2519
...
...
@@ -27,7 +27,6 @@
#include "executorimpl.h"
#include "executor.h"
#include "stub.h"
#include "taos.h"
#include "tdatablock.h"
#include "tdef.h"
...
...
@@ -196,7 +195,7 @@ int32_t docomp(const void* p1, const void* p2, void* param) {
}
}
// namespace
#if
1
#if
0
TEST(testCase, inMem_sort_Test) {
SBlockOrderInfo oi = {0};
oi.order = TSDB_ORDER_ASC;
...
...
@@ -382,7 +381,7 @@ TEST(testCase, ordered_merge_sort_Test) {
}
void* v = tsortGetValue(pTupleHandle, 0);
printf
(
"%d: %d
\n
"
,
row
,
*
(
int32_t
*
)
v
);
//
printf("%d: %d\n", row, *(int32_t*) v);
ASSERT_EQ(row++, *(int32_t*) v);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录