Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2ab037b5
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
2ab037b5
编写于
8月 24, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 24, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9790 【distributeddatamgr】【master】rdb NDK测试用例补充,id接口测试
Merge pull request !9790 from wuxiaodan/master
上级
81ee00d6
c527c2e9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
88 addition
and
3 deletion
+88
-3
distributeddatamgr/relationalStoretest/rdbnapitest/entry/src/main/cpp/napi/rdb_store_test.cpp
...st/rdbnapitest/entry/src/main/cpp/napi/rdb_store_test.cpp
+77
-2
distributeddatamgr/relationalStoretest/rdbnapitest/entry/src/main/ets/test/RdbNdkStoreTest.ets
...t/rdbnapitest/entry/src/main/ets/test/RdbNdkStoreTest.ets
+11
-1
未找到文件。
distributeddatamgr/relationalStoretest/rdbnapitest/entry/src/main/cpp/napi/rdb_store_test.cpp
浏览文件 @
2ab037b5
...
...
@@ -156,7 +156,6 @@ static napi_value SUB_DDM_RDB_0100(napi_env env, napi_callback_info info) {
cursor
->
isNull
(
cursor
,
5
,
&
isNull
);
NAPI_ASSERT
(
env
,
isNull
==
true
,
"isNull is fail."
);
valueObject
->
destroy
(
valueObject
);
valueBucket
->
destroy
(
valueBucket
);
predicates
->
destroy
(
predicates
);
...
...
@@ -1597,6 +1596,81 @@ static napi_value SUB_DDM_RDB_3000(napi_env env, napi_callback_info info) {
return
returnCode
;
}
/**
* @tc.name: SUB_DDM_RDB_3100
* @tc.desc: napi test RDB store for id
* @tc.type: FUNC
*/
static
napi_value
SUB_DDM_RDB_3100
(
napi_env
env
,
napi_callback_info
info
)
{
int
errCode
=
0
;
OH_VBucket
*
valueBucket
=
OH_Rdb_CreateValuesBucket
();
valueBucket
->
putInt64
(
valueBucket
,
"id"
,
1
);
valueBucket
->
putText
(
valueBucket
,
"data1"
,
"zhangSan"
);
valueBucket
->
putInt64
(
valueBucket
,
"data2"
,
12800
);
valueBucket
->
putReal
(
valueBucket
,
"data3"
,
100.1
);
uint8_t
arr
[]
=
{
1
,
2
,
3
,
4
,
5
};
int
len
=
sizeof
(
arr
)
/
sizeof
(
arr
[
0
]);
valueBucket
->
putBlob
(
valueBucket
,
"data4"
,
arr
,
len
);
valueBucket
->
putText
(
valueBucket
,
"data5"
,
"ABCDEFG"
);
errCode
=
OH_Rdb_Insert
(
storeTestRdbStore_
,
"test"
,
valueBucket
);
NAPI_ASSERT
(
env
,
errCode
==
1
,
"OH_Rdb_Insert is fail."
);
OH_Predicates
*
predicates
=
OH_Rdb_CreatePredicates
(
"test"
);
OH_VObject
*
valueObject
=
OH_Rdb_CreateValueObject
();
const
char
*
data1Value
=
"zhangSan"
;
valueObject
->
putText
(
valueObject
,
data1Value
);
predicates
->
equalTo
(
predicates
,
"data1"
,
valueObject
);
const
char
*
columnNames
[]
=
{
"data1"
,
"data2"
,
"data3"
,
"data4"
,
"data5"
};
OH_Cursor
*
cursor
=
OH_Rdb_Query
(
storeTestRdbStore_
,
predicates
,
columnNames
,
5
);
NAPI_ASSERT
(
env
,
cursor
!=
NULL
,
"OH_Rdb_Query is fail."
);
errCode
=
valueBucket
->
capability
;
NAPI_ASSERT
(
env
,
errCode
==
6
,
"valueBucket capabilityis fail."
);
int
valueObjectID
=
valueObject
->
id
;
int
valueBucketID
=
valueBucket
->
id
;
int
predicatesID
=
predicates
->
id
;
int
cursorID
=
cursor
->
id
;
int
rdbID
=
storeTestRdbStore_
->
id
;
valueObject
->
id
=
11
;
valueBucket
->
id
=
12
;
predicates
->
id
=
13
;
cursor
->
id
=
14
;
storeTestRdbStore_
->
id
=
15
;
errCode
=
valueObject
->
destroy
(
valueObject
);
NAPI_ASSERT
(
env
,
errCode
==
OH_Rdb_ErrCode
::
RDB_E_INVALID_ARGS
,
"valueObject id is fail."
);
errCode
=
valueBucket
->
destroy
(
valueBucket
);
NAPI_ASSERT
(
env
,
errCode
==
OH_Rdb_ErrCode
::
RDB_E_INVALID_ARGS
,
"valueBucket id is fail."
);
errCode
=
predicates
->
destroy
(
predicates
);
NAPI_ASSERT
(
env
,
errCode
==
OH_Rdb_ErrCode
::
RDB_E_INVALID_ARGS
,
"predicates id is fail."
);
errCode
=
cursor
->
destroy
(
cursor
);
NAPI_ASSERT
(
env
,
errCode
==
OH_Rdb_ErrCode
::
RDB_E_INVALID_ARGS
,
"cursor id is fail."
);
errCode
=
OH_Rdb_CloseStore
(
storeTestRdbStore_
);
NAPI_ASSERT
(
env
,
errCode
==
OH_Rdb_ErrCode
::
RDB_E_INVALID_ARGS
,
"rdb id is fail."
);
valueObject
->
id
=
valueObjectID
;
valueBucket
->
id
=
valueBucketID
;
predicates
->
id
=
predicatesID
;
cursor
->
id
=
cursorID
;
storeTestRdbStore_
->
id
=
rdbID
;
errCode
=
valueObject
->
destroy
(
valueObject
);
NAPI_ASSERT
(
env
,
errCode
==
0
,
"valueObject id2 is fail."
);
errCode
=
valueBucket
->
destroy
(
valueBucket
);
NAPI_ASSERT
(
env
,
errCode
==
0
,
"valueBucket id2 is fail."
);
errCode
=
predicates
->
destroy
(
predicates
);
NAPI_ASSERT
(
env
,
errCode
==
0
,
"predicates id2 is fail."
);
errCode
=
cursor
->
destroy
(
cursor
);
NAPI_ASSERT
(
env
,
errCode
==
0
,
"cursor id2 is fail."
);
napi_value
returnCode
;
napi_create_double
(
env
,
errCode
,
&
returnCode
);
return
returnCode
;
}
EXTERN_C_START
static
napi_value
Init
(
napi_env
env
,
napi_value
exports
)
{
napi_property_descriptor
desc
[]
=
{
...
...
@@ -1631,7 +1705,8 @@ static napi_value Init(napi_env env, napi_value exports) {
{
"SUB_DDM_RDB_2700"
,
nullptr
,
SUB_DDM_RDB_2700
,
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
},
{
"SUB_DDM_RDB_2800"
,
nullptr
,
SUB_DDM_RDB_2800
,
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
},
{
"SUB_DDM_RDB_2900"
,
nullptr
,
SUB_DDM_RDB_2900
,
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
},
{
"SUB_DDM_RDB_3000"
,
nullptr
,
SUB_DDM_RDB_3000
,
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
}
{
"SUB_DDM_RDB_3000"
,
nullptr
,
SUB_DDM_RDB_3000
,
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
},
{
"SUB_DDM_RDB_3100"
,
nullptr
,
SUB_DDM_RDB_3100
,
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
}
};
...
...
distributeddatamgr/relationalStoretest/rdbnapitest/entry/src/main/ets/test/RdbNdkStoreTest.ets
浏览文件 @
2ab037b5
...
...
@@ -372,7 +372,17 @@ export default function RdbNdkStoreTest() {
expect(re == 0).assertTrue();
})
/**
* @tc.name: SUB_DDM_RDB_3100
* @tc.desc: Normal testCase of NDK store for Query with wrong length.
* @tc.type: FUNC
*/
it('SUB_DDM_RDB_3100',0, async function () {
hilog.info(0x0000, TAG, 'testTag SUB_DDM_RDB_3100' , ' begin');
let re = testNapi.SUB_DDM_RDB_3100();
hilog.info(0x0000, TAG, 'testTag errorCode is : '+ re , 'aa');
expect(re == 0).assertTrue();
})
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录