MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / test_dfs_write

Function test_dfs_write

components/dfs/utest/tc_dfs_api.c:77–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77static void test_dfs_write(void)
78{
79 rt_err_t rst;
80 rt_kprintf("[WRITE] Starting write operation to file: %s\n", TEST_FILE);
81
82 /* DFSV1: dfs_file_lseek(&fd, 0)
83 * DFSV2: dfs_file_lseek(&fd, 0, SEEK_SET)
84 */
85#ifdef RT_USING_DFS_V2
86 rst = dfs_file_lseek(&fd, 0, SEEK_SET);
87#else
88 rst = dfs_file_lseek(&fd, 0);
89#endif
90 if (rst < 0)
91 {
92 rt_kprintf("[WRITE] lseek failed with result = %d\n", rst);
93 }
94 uassert_true(rst >= 0);
95
96 rt_kprintf("[WRITE] Writing data: \"%s\" (length: %d)\n", write_buf, rt_strlen(write_buf));
97 rst = dfs_file_write(&fd, write_buf, rt_strlen(write_buf));
98 if (rst != rt_strlen(write_buf))
99 {
100 rt_kprintf("[WRITE] Write failed, result = %d, expected = %d\n", rst, rt_strlen(write_buf));
101 }
102 else
103 {
104 rt_kprintf("[WRITE] Write successful, %d bytes written\n", rst);
105 }
106 uassert_true(rst == rt_strlen(write_buf));
107}
108
109static void test_dfs_read(void)
110{

Callers

nothing calls this directly

Calls 4

rt_kprintfFunction · 0.85
rt_strlenFunction · 0.85
dfs_file_lseekFunction · 0.50
dfs_file_writeFunction · 0.50

Tested by

no test coverage detected