Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
40002db4
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看板
提交
40002db4
编写于
4月 13, 2021
作者:
O
openharmony_ci
提交者:
Gitee
4月 13, 2021
浏览文件
操作
浏览文件
下载
差异文件
!135 解决kvstore_func_test.c依赖true\false\bool问题
Merge pull request !135 from jiyong/myfeature
上级
379f09aa
020dac9f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
43 addition
and
43 deletion
+43
-43
utils_lite/kv_store_hal/src/kvstore_func_test.c
utils_lite/kv_store_hal/src/kvstore_func_test.c
+43
-43
未找到文件。
utils_lite/kv_store_hal/src/kvstore_func_test.c
浏览文件 @
40002db4
...
...
@@ -55,7 +55,7 @@ static BOOL KvStoreFuncTestSuiteTearDown(void)
}
/* Create files in batches. */
bool
SetKVFiles
(
int
num
,
const
char
*
key
,
const
char
*
value
)
BOOL
SetKVFiles
(
int
num
,
const
char
*
key
,
const
char
*
value
)
{
int
size
;
int
ret
;
...
...
@@ -63,16 +63,16 @@ bool SetKVFiles (int num, const char* key, const char* value)
char
valuetemp
[
MAX_VALUE_LEN_TEST
]
=
{
0
};
char
temp
[
MAX_VALUE_LEN_TEST
]
=
{
0
};
if
(
num
<=
0
)
{
return
false
;
return
FALSE
;
}
for
(
int
i
=
1
;
i
<=
num
;
i
++
)
{
size
=
sprintf_s
(
keytemp
,
MAX_KEY_LEN_TEST
,
"%s_%d"
,
key
,
i
);
if
(
size
<
0
)
{
return
false
;
return
FALSE
;
}
size
=
sprintf_s
(
valuetemp
,
MAX_VALUE_LEN_TEST
,
"%s_%d"
,
value
,
i
);
if
(
size
<
0
)
{
return
false
;
return
FALSE
;
}
ret
=
UtilsSetValue
(
keytemp
,
valuetemp
);
if
(
i
<=
MAX_KEY_NUM_TEST
)
{
...
...
@@ -97,11 +97,11 @@ bool SetKVFiles (int num, const char* key, const char* value)
IoTWatchDogKick
();
}
IoTWatchDogKick
();
return
true
;
return
TRUE
;
}
/* Read files in batches. */
bool
ReadKVFiles
(
int
num
,
const
char
*
key
,
const
char
*
value
)
BOOL
ReadKVFiles
(
int
num
,
const
char
*
key
,
const
char
*
value
)
{
int
size
;
int
ret
;
...
...
@@ -110,16 +110,16 @@ bool ReadKVFiles (int num, const char* key, const char* value)
char
valuetemp
[
MAX_VALUE_LEN_TEST
]
=
{
0
};
char
temp
[
MAX_VALUE_LEN_TEST
]
=
{
0
};
if
(
num
<=
0
)
{
return
false
;
return
FALSE
;
}
for
(
int
loop
=
num
;
loop
>
0
;
loop
--
)
{
size
=
sprintf_s
(
keytemp
,
MAX_KEY_LEN_TEST
,
"%s_%d"
,
key
,
loop
);
if
(
size
<
0
)
{
return
false
;
return
FALSE
;
}
size
=
sprintf_s
(
valuetemp
,
MAX_VALUE_LEN_TEST
,
"%s_%d"
,
value
,
loop
);
if
(
size
<
0
)
{
return
false
;
return
FALSE
;
}
ret
=
UtilsGetValue
(
keytemp
,
temp
,
MAX_VALUE_LEN_TEST
);
if
(
loop
<=
MAX_KEY_NUM_TEST
)
{
...
...
@@ -143,23 +143,23 @@ bool ReadKVFiles (int num, const char* key, const char* value)
IoTWatchDogKick
();
}
IoTWatchDogKick
();
return
true
;
return
TRUE
;
}
/* Delete files in batches. */
bool
DeleteKVFiles
(
int
num
,
const
char
*
key
)
BOOL
DeleteKVFiles
(
int
num
,
const
char
*
key
)
{
int
size
;
int
ret
;
char
keytemp
[
MAX_KEY_LEN_TEST
]
=
{
0
};
if
(
num
<=
0
)
{
return
false
;
return
FALSE
;
}
for
(
int
i
=
1
;
i
<=
num
;
i
++
)
{
size
=
sprintf_s
(
keytemp
,
MAX_KEY_LEN_TEST
,
"%s_%d"
,
key
,
i
);
if
(
size
<
0
)
{
return
false
;
return
FALSE
;
}
ret
=
UtilsDeleteValue
(
keytemp
);
if
(
i
<=
MAX_KEY_NUM_TEST
)
{
...
...
@@ -171,7 +171,7 @@ bool DeleteKVFiles (int num, const char* key)
IoTWatchDogKick
();
}
IoTWatchDogKick
();
return
true
;
return
TRUE
;
}
/**
...
...
@@ -621,20 +621,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreCacheSize001, Function | MediumT
{
char
key
[]
=
"rw.sys.version"
;
char
value
[]
=
"It is never too old to learn"
;
bool
ret
=
false
;
BOOL
ret
=
FALSE
;
ret
=
SetKVFiles
(
MAX_CACHE_NUM_TEST
-
1
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
ReadKVFiles
(
MAX_CACHE_NUM_TEST
-
1
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
DeleteKVFiles
(
MAX_CACHE_NUM_TEST
-
1
,
key
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
...
...
@@ -649,20 +649,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreCacheSize002, Function | MediumT
{
char
key
[]
=
"rw.sys.version"
;
char
value
[]
=
"It is never too old to learn"
;
bool
ret
=
false
;
BOOL
ret
=
FALSE
;
ret
=
SetKVFiles
(
MAX_CACHE_NUM_TEST
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
ReadKVFiles
(
MAX_CACHE_NUM_TEST
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
DeleteKVFiles
(
MAX_CACHE_NUM_TEST
,
key
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
...
...
@@ -677,20 +677,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreCacheSize003, Function | MediumT
{
char
key
[]
=
"rw.sys.version"
;
char
value
[]
=
"It is never too old to learn"
;
bool
ret
=
false
;
BOOL
ret
=
FALSE
;
ret
=
SetKVFiles
(
MAX_CACHE_NUM_TEST
+
1
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
ReadKVFiles
(
MAX_CACHE_NUM_TEST
+
1
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
DeleteKVFiles
(
MAX_CACHE_NUM_TEST
+
1
,
key
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
...
...
@@ -705,20 +705,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize001, Function | MediumTes
{
char
key
[]
=
"rw.sys.version"
;
char
value
[]
=
"It is never too old to learn"
;
bool
ret
=
false
;
BOOL
ret
=
FALSE
;
ret
=
SetKVFiles
(
MAX_KEY_NUM_TEST
-
1
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
ReadKVFiles
(
MAX_KEY_NUM_TEST
-
1
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
DeleteKVFiles
(
MAX_KEY_NUM_TEST
-
1
,
key
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
...
...
@@ -733,20 +733,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize002, Function | MediumTes
{
char
key
[]
=
"rw.sys.version"
;
char
value
[]
=
"It is never too old to learn"
;
bool
ret
=
false
;
BOOL
ret
=
FALSE
;
ret
=
SetKVFiles
(
MAX_KEY_NUM_TEST
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
ReadKVFiles
(
MAX_KEY_NUM_TEST
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
DeleteKVFiles
(
MAX_KEY_NUM_TEST
,
key
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
...
...
@@ -761,20 +761,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize003, Function | MediumTes
{
char
key
[]
=
"rw.sys.version"
;
char
value
[]
=
"It is never too old to learn"
;
bool
ret
=
false
;
BOOL
ret
=
FALSE
;
ret
=
SetKVFiles
(
MAX_KEY_NUM_TEST
+
1
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
ReadKVFiles
(
MAX_KEY_NUM_TEST
+
1
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
DeleteKVFiles
(
MAX_KEY_NUM_TEST
+
1
,
key
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
...
...
@@ -791,26 +791,26 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize004, Function | MediumTes
char
value
[]
=
"It is never too old to learn"
;
char
value1
[]
=
"Two tigers Two tigers two tiger running so fast \
running so fast one has no ears one has no tail How strange How strange"
;
bool
ret
=
false
;
BOOL
ret
=
FALSE
;
ret
=
SetKVFiles
(
INVALID_KEY_NUM
,
key
,
value
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
// Update operation
ret
=
SetKVFiles
(
INVALID_KEY_NUM
,
key
,
value1
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
ReadKVFiles
(
INVALID_KEY_NUM
,
key
,
value1
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
ret
=
DeleteKVFiles
(
INVALID_KEY_NUM
,
key
);
if
(
ret
!=
true
)
if
(
ret
!=
TRUE
)
{
TEST_FAIL
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录