Files
mkrtos-real/mkrtos_user/server/shell/test/fs_test.c
2023-09-24 20:05:55 +08:00

22 lines
458 B
C

#include "fs_cli.h"
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <stddef.h>
void fs_test(void)
{
char tmp[4] = "123";
int fd = fs_open("/test", 0, 0x1 | 0x2 | 0x8);
assert(fd >= 0);
int wlen = fs_write(fd, tmp, 4);
assert(wlen == 4);
int ret = fs_lseek(fd, 0, SEEK_SET);
assert(ret >= 0);
int rlen = fs_read(fd, tmp, 4);
assert(rlen == 4);
assert(strcmp(tmp, "123") == 0);
fs_close(fd);
}