未验证 提交 cab57d6c 编写于 作者: O openharmony_ci 提交者: Gitee

!3806 【OpenHarmony开源贡献者计划2022】fix code style for 'utils_lite'

Merge pull request !3806 from c01dface/dev2
......@@ -64,13 +64,12 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testCreatFileAfterMaxFilesOpened, Functio
{
// Open 32 files
int fd32[MAX_NUM_OF_OPENED_FILES] = {0};
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++)
{
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) {
int j = i + 1;
char fileName32[LENGTH_OF_FILE_NAME_BUF] = {0};
int size = sprintf_s(fileName32, sizeof(fileName32), "%s%d", "testReli101-", j);
if (size < 0) {
TEST_ASSERT_EQUAL_INT(0, 1);
TEST_ASSERT_EQUAL_INT(0, 1);
}
fd32[i] = UtilsFileOpen(fileName32, O_RDWR_FS | O_CREAT_FS, 0);
TEST_ASSERT_GREATER_THAN_INT(0, fd32[i]);
......@@ -85,17 +84,15 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testCreatFileAfterMaxFilesOpened, Functio
TEST_ASSERT_GREATER_THAN_INT(0, fd33);
UtilsFileClose(fd33);
// Delete all files
for (int i = 1; i < MAX_NUM_OF_OPENED_FILES; i++)
{
for (int i = 1; i < MAX_NUM_OF_OPENED_FILES; i++) {
UtilsFileClose(fd32[i]);
}
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++)
{
}
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) {
int j = i + 1;
char fileName32[LENGTH_OF_FILE_NAME_BUF] = {0};
int size = sprintf_s(fileName32, sizeof(fileName32), "%s%d", "testReli101-", j);
if (size < 0) {
TEST_ASSERT_EQUAL_INT(0, 1);
TEST_ASSERT_EQUAL_INT(0, 1);
}
UtilsFileDelete(fileName32);
}
......@@ -111,13 +108,12 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testDeleteFileAfterMaxFilesOpened, Functi
{
// Open 32 files
int fd32[MAX_NUM_OF_OPENED_FILES] = {0};
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++)
{
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) {
int j = i + 1;
char fileName32[LENGTH_OF_FILE_NAME_BUF] = {0};
int size = sprintf_s(fileName32, sizeof(fileName32), "%s%d", "testReli101-", j);
if (size < 0) {
TEST_ASSERT_EQUAL_INT(0, 1);
TEST_ASSERT_EQUAL_INT(0, 1);
}
fd32[i] = UtilsFileOpen(fileName32, O_RDWR_FS | O_CREAT_FS, 0);
UtilsFileWrite(fd32[i], g_def, strlen(g_def));
......@@ -128,17 +124,15 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testDeleteFileAfterMaxFilesOpened, Functi
int ret = UtilsFileDelete(fileName1);
TEST_ASSERT_EQUAL_INT(0, ret);
// Delete all files
for (int i = 1; i < MAX_NUM_OF_OPENED_FILES; i++)
{
for (int i = 1; i < MAX_NUM_OF_OPENED_FILES; i++) {
UtilsFileClose(fd32[i]);
}
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++)
{
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) {
int j = i + 1;
char fileName32[LENGTH_OF_FILE_NAME_BUF] = {0};
int size = sprintf_s(fileName32, sizeof(fileName32), "%s%d", "testReli101-", j);
if (size < 0) {
TEST_ASSERT_EQUAL_INT(0, 1);
TEST_ASSERT_EQUAL_INT(0, 1);
}
UtilsFileDelete(fileName32);
}
......@@ -153,13 +147,12 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testCopyFileAfterMaxFilesOpened, Function
{
// Open 32 files
int fd32[MAX_NUM_OF_OPENED_FILES] = {0};
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++)
{
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) {
int j = i + 1;
char fileName32[LENGTH_OF_FILE_NAME_BUF] = {0};
int size = sprintf_s(fileName32, sizeof(fileName32), "%s%d", "testReli101-", j);
if (size < 0) {
TEST_ASSERT_EQUAL_INT(0, 1);
TEST_ASSERT_EQUAL_INT(0, 1);
}
fd32[i] = UtilsFileOpen(fileName32, O_RDWR_FS | O_CREAT_FS, 0);
UtilsFileWrite(fd32[i], g_def, strlen(g_def));
......@@ -178,17 +171,15 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testCopyFileAfterMaxFilesOpened, Function
ret = UtilsFileCopy(fileName1, fileNameCopy);
TEST_ASSERT_EQUAL_INT(0, ret);
// Delete all files
for (int i = 2; i < MAX_NUM_OF_OPENED_FILES; i++)
{
for (int i = 2; i < MAX_NUM_OF_OPENED_FILES; i++) {
UtilsFileClose(fd32[i]);
}
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++)
{
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) {
int j = i + 1;
char fileName32[LENGTH_OF_FILE_NAME_BUF] = {0};
int size = sprintf_s(fileName32, sizeof(fileName32), "%s%d", "testReli101-", j);
if (size < 0) {
TEST_ASSERT_EQUAL_INT(0, 1);
TEST_ASSERT_EQUAL_INT(0, 1);
}
UtilsFileDelete(fileName32);
}
......@@ -204,13 +195,12 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testMoveFileAfterMaxFilesOpened, Function
{
// Open 32 files
int fd32[MAX_NUM_OF_OPENED_FILES] = {0};
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++)
{
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) {
int j = i + 1;
char fileName32[LENGTH_OF_FILE_NAME_BUF] = {0};
int size = sprintf_s(fileName32, sizeof(fileName32), "%s%d", "testReli101-", j);
if (size < 0) {
TEST_ASSERT_EQUAL_INT(0, 1);
TEST_ASSERT_EQUAL_INT(0, 1);
}
fd32[i] = UtilsFileOpen(fileName32, O_RDWR_FS | O_CREAT_FS, 0);
UtilsFileWrite(fd32[i], g_def, strlen(g_def));
......@@ -229,17 +219,15 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testMoveFileAfterMaxFilesOpened, Function
ret = UtilsFileMove(fileName1, fileNameMove);
TEST_ASSERT_EQUAL_INT(0, ret);
// Delete all files
for (int i = 2; i < MAX_NUM_OF_OPENED_FILES; i++)
{
for (int i = 2; i < MAX_NUM_OF_OPENED_FILES; i++) {
UtilsFileClose(fd32[i]);
}
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++)
{
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) {
int j = i + 1;
char fileName32[LENGTH_OF_FILE_NAME_BUF] = {0};
int size = sprintf_s(fileName32, sizeof(fileName32), "%s%d", "testReli101-", j);
if (size < 0) {
TEST_ASSERT_EQUAL_INT(0, 1);
TEST_ASSERT_EQUAL_INT(0, 1);
}
UtilsFileDelete(fileName32);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册