Skip to content

Commit 0838b39

Browse files
test: new storage apis
1 parent 91fb26d commit 0838b39

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

applications/debug/unit_tests/tests/storage/storage_test.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,33 @@ MU_TEST(storage_dir_rename) {
409409
furi_record_close(RECORD_STORAGE);
410410
}
411411

412+
MU_TEST(storage_equiv_and_subdir) {
413+
Storage* storage = furi_record_open(RECORD_STORAGE);
414+
415+
mu_assert_int_eq(
416+
true, storage_common_equivalent_path(storage, EXT_PATH("blah"), EXT_PATH("blah")));
417+
mu_assert_int_eq(
418+
true, storage_common_equivalent_path(storage, EXT_PATH("blah/"), EXT_PATH("blah/")));
419+
mu_assert_int_eq(
420+
false, storage_common_equivalent_path(storage, EXT_PATH("blah"), EXT_PATH("blah-blah")));
421+
mu_assert_int_eq(
422+
false, storage_common_equivalent_path(storage, EXT_PATH("blah/"), EXT_PATH("blah-blah/")));
423+
424+
mu_assert_int_eq(true, storage_common_is_subdir(storage, EXT_PATH("blah"), EXT_PATH("blah")));
425+
mu_assert_int_eq(
426+
true, storage_common_is_subdir(storage, EXT_PATH("blah"), EXT_PATH("blah/blah")));
427+
mu_assert_int_eq(
428+
false, storage_common_is_subdir(storage, EXT_PATH("blah/blah"), EXT_PATH("blah")));
429+
mu_assert_int_eq(
430+
false, storage_common_is_subdir(storage, EXT_PATH("blah"), EXT_PATH("blah-blah")));
431+
432+
furi_record_close(RECORD_STORAGE);
433+
}
434+
412435
MU_TEST_SUITE(storage_rename) {
413436
MU_RUN_TEST(storage_file_rename);
414437
MU_RUN_TEST(storage_dir_rename);
438+
MU_RUN_TEST(storage_equiv_and_subdir);
415439

416440
Storage* storage = furi_record_open(RECORD_STORAGE);
417441
for(size_t i = 0; i < COUNT_OF(dir_rename_tests); i++) {

0 commit comments

Comments
 (0)