Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
cab57d6c
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看板
未验证
提交
cab57d6c
编写于
7月 01, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 01, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3806 【OpenHarmony开源贡献者计划2022】fix code style for 'utils_lite'
Merge pull request !3806 from c01dface/dev2
上级
97a05f5e
d32a17ce
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
33 deletion
+21
-33
utils_lite/file_hal/src/utils_file_reli_test.c
utils_lite/file_hal/src/utils_file_reli_test.c
+21
-33
未找到文件。
utils_lite/file_hal/src/utils_file_reli_test.c
浏览文件 @
cab57d6c
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录