1 /* 2 * Copyright (c) 2018 Intel Corporation. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/fs/fs.h> 8 #include "test_common.h" 9 #include "test_littlefs.h" 10 #include "test_littlefs_priv.h" 11 12 static struct fs_file_t test_file; 13 static const char *test_str = "Hello world LITTLEFS"; 14 test_littlefs_open(void)15void test_littlefs_open(void) 16 { 17 fs_file_t_init(&test_file); 18 zassert_true(test_file_open(&test_file, TEST_FILE_PATH) == TC_PASS, 19 NULL); 20 } 21 test_littlefs_write(void)22void test_littlefs_write(void) 23 { 24 TC_PRINT("Write to file %s\n", TEST_FILE_PATH); 25 zassert_true(test_file_write(&test_file, test_str) == TC_PASS, 26 NULL); 27 } 28 test_littlefs_read(void)29void test_littlefs_read(void) 30 { 31 zassert_true(test_file_read(&test_file, test_str) == TC_PASS); 32 } 33 test_littlefs_close(void)34void test_littlefs_close(void) 35 { 36 zassert_true(test_file_close(&test_file) == TC_PASS); 37 } test_littlefs_unlink(void)38void test_littlefs_unlink(void) 39 { 40 zassert_true(test_file_delete(TEST_FILE_PATH) == TC_PASS); 41 } 42