mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 19:18:53 +08:00
improve fs test code
This commit is contained in:
parent
04385e2626
commit
926c0c0cd2
16
src/tkc/fs.c
16
src/tkc/fs.c
@ -284,11 +284,9 @@ bool_t file_exist(const char* name) {
|
||||
return fs_file_exist(os_fs(), name);
|
||||
}
|
||||
|
||||
ret_t fs_test(fs_t* fs) {
|
||||
ret_t fs_test_file(fs_t* fs) {
|
||||
char buff[32];
|
||||
fs_item_t item;
|
||||
fs_file_t* fp = NULL;
|
||||
fs_dir_t* dir = NULL;
|
||||
const char* filename = "./test.txt";
|
||||
|
||||
memset(buff, 0x00, sizeof(buff));
|
||||
@ -325,6 +323,13 @@ ret_t fs_test(fs_t* fs) {
|
||||
assert(fs_remove_file(fs, "./test.bin") == RET_OK);
|
||||
assert(!fs_file_exist(fs, "./test.bin"));
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t fs_test_dir(fs_t* fs) {
|
||||
fs_item_t item;
|
||||
fs_dir_t* dir = NULL;
|
||||
|
||||
assert(!fs_dir_exist(fs, "./a"));
|
||||
assert(fs_create_dir(fs, "./a") == RET_OK);
|
||||
assert(fs_dir_exist(fs, "./a"));
|
||||
@ -376,3 +381,8 @@ ret_t fs_test(fs_t* fs) {
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t fs_test(fs_t* fs) {
|
||||
fs_test_file(fs);
|
||||
return fs_test_dir(fs);
|
||||
}
|
||||
|
@ -669,6 +669,8 @@ ret_t file_write(const char* name, const void* buff, uint32_t size);
|
||||
|
||||
/*basic function test*/
|
||||
ret_t fs_test(fs_t* fs);
|
||||
ret_t fs_test_file(fs_t* fs);
|
||||
ret_t fs_test_dir(fs_t* fs);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user