提交 40002db4 编写于 作者: O openharmony_ci 提交者: Gitee

!135 解决kvstore_func_test.c依赖true\false\bool问题

Merge pull request !135 from jiyong/myfeature
...@@ -55,7 +55,7 @@ static BOOL KvStoreFuncTestSuiteTearDown(void) ...@@ -55,7 +55,7 @@ static BOOL KvStoreFuncTestSuiteTearDown(void)
} }
/* Create files in batches. */ /* 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 size;
int ret; int ret;
...@@ -63,16 +63,16 @@ bool SetKVFiles (int num, const char* key, const char* value) ...@@ -63,16 +63,16 @@ bool SetKVFiles (int num, const char* key, const char* value)
char valuetemp[MAX_VALUE_LEN_TEST] = {0}; char valuetemp[MAX_VALUE_LEN_TEST] = {0};
char temp[MAX_VALUE_LEN_TEST] = {0}; char temp[MAX_VALUE_LEN_TEST] = {0};
if (num <= 0) { if (num <= 0) {
return false; return FALSE;
} }
for (int i = 1; i <= num; i++) { for (int i = 1; i <= num; i++) {
size = sprintf_s(keytemp, MAX_KEY_LEN_TEST, "%s_%d", key, i); size = sprintf_s(keytemp, MAX_KEY_LEN_TEST, "%s_%d", key, i);
if (size < 0) { if (size < 0) {
return false; return FALSE;
} }
size = sprintf_s(valuetemp, MAX_VALUE_LEN_TEST, "%s_%d", value, i); size = sprintf_s(valuetemp, MAX_VALUE_LEN_TEST, "%s_%d", value, i);
if (size < 0) { if (size < 0) {
return false; return FALSE;
} }
ret = UtilsSetValue(keytemp, valuetemp); ret = UtilsSetValue(keytemp, valuetemp);
if (i <= MAX_KEY_NUM_TEST) { if (i <= MAX_KEY_NUM_TEST) {
...@@ -97,11 +97,11 @@ bool SetKVFiles (int num, const char* key, const char* value) ...@@ -97,11 +97,11 @@ bool SetKVFiles (int num, const char* key, const char* value)
IoTWatchDogKick(); IoTWatchDogKick();
} }
IoTWatchDogKick(); IoTWatchDogKick();
return true; return TRUE;
} }
/* Read files in batches. */ /* 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 size;
int ret; int ret;
...@@ -110,16 +110,16 @@ bool ReadKVFiles (int num, const char* key, const char* value) ...@@ -110,16 +110,16 @@ bool ReadKVFiles (int num, const char* key, const char* value)
char valuetemp[MAX_VALUE_LEN_TEST] = {0}; char valuetemp[MAX_VALUE_LEN_TEST] = {0};
char temp[MAX_VALUE_LEN_TEST] = {0}; char temp[MAX_VALUE_LEN_TEST] = {0};
if (num <= 0) { if (num <= 0) {
return false; return FALSE;
} }
for (int loop = num; loop > 0; loop--) { for (int loop = num; loop > 0; loop--) {
size = sprintf_s(keytemp, MAX_KEY_LEN_TEST, "%s_%d", key, loop); size = sprintf_s(keytemp, MAX_KEY_LEN_TEST, "%s_%d", key, loop);
if (size < 0) { if (size < 0) {
return false; return FALSE;
} }
size = sprintf_s(valuetemp, MAX_VALUE_LEN_TEST, "%s_%d", value, loop); size = sprintf_s(valuetemp, MAX_VALUE_LEN_TEST, "%s_%d", value, loop);
if (size < 0) { if (size < 0) {
return false; return FALSE;
} }
ret = UtilsGetValue(keytemp, temp, MAX_VALUE_LEN_TEST); ret = UtilsGetValue(keytemp, temp, MAX_VALUE_LEN_TEST);
if (loop <= MAX_KEY_NUM_TEST) { if (loop <= MAX_KEY_NUM_TEST) {
...@@ -143,23 +143,23 @@ bool ReadKVFiles (int num, const char* key, const char* value) ...@@ -143,23 +143,23 @@ bool ReadKVFiles (int num, const char* key, const char* value)
IoTWatchDogKick(); IoTWatchDogKick();
} }
IoTWatchDogKick(); IoTWatchDogKick();
return true; return TRUE;
} }
/* Delete files in batches. */ /* Delete files in batches. */
bool DeleteKVFiles (int num, const char* key) BOOL DeleteKVFiles (int num, const char* key)
{ {
int size; int size;
int ret; int ret;
char keytemp[MAX_KEY_LEN_TEST] = {0}; char keytemp[MAX_KEY_LEN_TEST] = {0};
if (num <= 0) { if (num <= 0) {
return false; return FALSE;
} }
for (int i = 1; i <= num; i++) { for (int i = 1; i <= num; i++) {
size = sprintf_s(keytemp, MAX_KEY_LEN_TEST, "%s_%d", key, i); size = sprintf_s(keytemp, MAX_KEY_LEN_TEST, "%s_%d", key, i);
if (size < 0) { if (size < 0) {
return false; return FALSE;
} }
ret = UtilsDeleteValue(keytemp); ret = UtilsDeleteValue(keytemp);
if (i <= MAX_KEY_NUM_TEST) { if (i <= MAX_KEY_NUM_TEST) {
...@@ -171,7 +171,7 @@ bool DeleteKVFiles (int num, const char* key) ...@@ -171,7 +171,7 @@ bool DeleteKVFiles (int num, const char* key)
IoTWatchDogKick(); IoTWatchDogKick();
} }
IoTWatchDogKick(); IoTWatchDogKick();
return true; return TRUE;
} }
/** /**
...@@ -621,20 +621,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreCacheSize001, Function | MediumT ...@@ -621,20 +621,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreCacheSize001, Function | MediumT
{ {
char key[] = "rw.sys.version"; char key[] = "rw.sys.version";
char value[] = "It is never too old to learn"; char value[] = "It is never too old to learn";
bool ret = false; BOOL ret = FALSE;
ret = SetKVFiles(MAX_CACHE_NUM_TEST-1, key, value); ret = SetKVFiles(MAX_CACHE_NUM_TEST-1, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = ReadKVFiles(MAX_CACHE_NUM_TEST-1, key, value); ret = ReadKVFiles(MAX_CACHE_NUM_TEST-1, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = DeleteKVFiles(MAX_CACHE_NUM_TEST-1, key); ret = DeleteKVFiles(MAX_CACHE_NUM_TEST-1, key);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
...@@ -649,20 +649,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreCacheSize002, Function | MediumT ...@@ -649,20 +649,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreCacheSize002, Function | MediumT
{ {
char key[] = "rw.sys.version"; char key[] = "rw.sys.version";
char value[] = "It is never too old to learn"; char value[] = "It is never too old to learn";
bool ret = false; BOOL ret = FALSE;
ret = SetKVFiles(MAX_CACHE_NUM_TEST, key, value); ret = SetKVFiles(MAX_CACHE_NUM_TEST, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = ReadKVFiles(MAX_CACHE_NUM_TEST, key, value); ret = ReadKVFiles(MAX_CACHE_NUM_TEST, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = DeleteKVFiles(MAX_CACHE_NUM_TEST, key); ret = DeleteKVFiles(MAX_CACHE_NUM_TEST, key);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
...@@ -677,20 +677,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreCacheSize003, Function | MediumT ...@@ -677,20 +677,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreCacheSize003, Function | MediumT
{ {
char key[] = "rw.sys.version"; char key[] = "rw.sys.version";
char value[] = "It is never too old to learn"; char value[] = "It is never too old to learn";
bool ret = false; BOOL ret = FALSE;
ret = SetKVFiles(MAX_CACHE_NUM_TEST+1, key, value); ret = SetKVFiles(MAX_CACHE_NUM_TEST+1, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = ReadKVFiles(MAX_CACHE_NUM_TEST+1, key, value); ret = ReadKVFiles(MAX_CACHE_NUM_TEST+1, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = DeleteKVFiles(MAX_CACHE_NUM_TEST+1, key); ret = DeleteKVFiles(MAX_CACHE_NUM_TEST+1, key);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
...@@ -705,20 +705,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize001, Function | MediumTes ...@@ -705,20 +705,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize001, Function | MediumTes
{ {
char key[] = "rw.sys.version"; char key[] = "rw.sys.version";
char value[] = "It is never too old to learn"; char value[] = "It is never too old to learn";
bool ret = false; BOOL ret = FALSE;
ret = SetKVFiles(MAX_KEY_NUM_TEST-1, key, value); ret = SetKVFiles(MAX_KEY_NUM_TEST-1, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = ReadKVFiles(MAX_KEY_NUM_TEST-1, key, value); ret = ReadKVFiles(MAX_KEY_NUM_TEST-1, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = DeleteKVFiles(MAX_KEY_NUM_TEST-1, key); ret = DeleteKVFiles(MAX_KEY_NUM_TEST-1, key);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
...@@ -733,20 +733,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize002, Function | MediumTes ...@@ -733,20 +733,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize002, Function | MediumTes
{ {
char key[] = "rw.sys.version"; char key[] = "rw.sys.version";
char value[] = "It is never too old to learn"; char value[] = "It is never too old to learn";
bool ret = false; BOOL ret = FALSE;
ret = SetKVFiles(MAX_KEY_NUM_TEST, key, value); ret = SetKVFiles(MAX_KEY_NUM_TEST, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = ReadKVFiles(MAX_KEY_NUM_TEST, key, value); ret = ReadKVFiles(MAX_KEY_NUM_TEST, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = DeleteKVFiles(MAX_KEY_NUM_TEST, key); ret = DeleteKVFiles(MAX_KEY_NUM_TEST, key);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
...@@ -761,20 +761,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize003, Function | MediumTes ...@@ -761,20 +761,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize003, Function | MediumTes
{ {
char key[] = "rw.sys.version"; char key[] = "rw.sys.version";
char value[] = "It is never too old to learn"; char value[] = "It is never too old to learn";
bool ret = false; BOOL ret = FALSE;
ret = SetKVFiles(MAX_KEY_NUM_TEST+1, key, value); ret = SetKVFiles(MAX_KEY_NUM_TEST+1, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = ReadKVFiles(MAX_KEY_NUM_TEST+1, key, value); ret = ReadKVFiles(MAX_KEY_NUM_TEST+1, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = DeleteKVFiles(MAX_KEY_NUM_TEST+1, key); ret = DeleteKVFiles(MAX_KEY_NUM_TEST+1, key);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
...@@ -791,26 +791,26 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize004, Function | MediumTes ...@@ -791,26 +791,26 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize004, Function | MediumTes
char value[] = "It is never too old to learn"; char value[] = "It is never too old to learn";
char value1[] = "Two tigers Two tigers two tiger running so fast \ 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"; 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); ret = SetKVFiles(INVALID_KEY_NUM, key, value);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
// Update operation // Update operation
ret = SetKVFiles(INVALID_KEY_NUM, key, value1); ret = SetKVFiles(INVALID_KEY_NUM, key, value1);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = ReadKVFiles(INVALID_KEY_NUM, key, value1); ret = ReadKVFiles(INVALID_KEY_NUM, key, value1);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
ret = DeleteKVFiles(INVALID_KEY_NUM, key); ret = DeleteKVFiles(INVALID_KEY_NUM, key);
if (ret != true) if (ret != TRUE)
{ {
TEST_FAIL(); TEST_FAIL();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册