feat(file): implemented tests for deleting files

This commit is contained in:
Mineplay5780 2025-12-20 12:17:19 +01:00
parent 3604be4b32
commit e7c977165d
4 changed files with 30 additions and 4 deletions

Binary file not shown.

View file

@ -1 +0,0 @@
Hello, World!Hello, World!

View file

@ -703,6 +703,29 @@ COSMS_CORE_TEST_TEST(file_write_full_file_using_wrong_mode,
return NULL; return NULL;
) )
COSMS_CORE_TEST_TEST(file_delete, COSMS_CORE_TEST_TEST(file_delete_small_file,
CosmsCoreFileError error = cosms_core_file_delete("tests/data/small-write-file.txt");
if (error != COSMS_CORE_FILE_OK) {
return cosms_core_file_error_string(error);
}
return NULL;
)
COSMS_CORE_TEST_TEST(file_delete_large_file,
CosmsCoreFileError error = cosms_core_file_delete("tests/data/large-write-file.txt");
if (error != COSMS_CORE_FILE_OK) {
return cosms_core_file_error_string(error);
}
return NULL;
)
COSMS_CORE_TEST_TEST(file_delete_non_existing_file,
CosmsCoreFileError error = cosms_core_file_delete("non-existing-file.cosms");
if (error != COSMS_CORE_FILE_NOT_FOUND) {
return cosms_core_file_error_string(error);
}
return NULL; return NULL;
) )

View file

@ -42,7 +42,9 @@ COSMS_CORE_TEST_DEFINE(file_write_append_large_file);
COSMS_CORE_TEST_DEFINE(file_write_using_wrong_mode); COSMS_CORE_TEST_DEFINE(file_write_using_wrong_mode);
COSMS_CORE_TEST_DEFINE(file_write_full_file_using_wrong_mode); COSMS_CORE_TEST_DEFINE(file_write_full_file_using_wrong_mode);
COSMS_CORE_TEST_DEFINE(file_delete); COSMS_CORE_TEST_DEFINE(file_delete_small_file);
COSMS_CORE_TEST_DEFINE(file_delete_large_file);
COSMS_CORE_TEST_DEFINE(file_delete_non_existing_file);
COSMS_CORE_TEST_EXPORT(file, COSMS_CORE_TEST_EXPORT(file,
COSMS_CORE_TEST_EXPORT_TEST(file_open_small_file_read), COSMS_CORE_TEST_EXPORT_TEST(file_open_small_file_read),
@ -76,7 +78,9 @@ COSMS_CORE_TEST_EXPORT(file,
COSMS_CORE_TEST_EXPORT_TEST(file_write_using_wrong_mode), COSMS_CORE_TEST_EXPORT_TEST(file_write_using_wrong_mode),
COSMS_CORE_TEST_EXPORT_TEST(file_write_full_file_using_wrong_mode), COSMS_CORE_TEST_EXPORT_TEST(file_write_full_file_using_wrong_mode),
COSMS_CORE_TEST_EXPORT_TEST(file_delete) COSMS_CORE_TEST_EXPORT_TEST(file_delete_small_file),
COSMS_CORE_TEST_EXPORT_TEST(file_delete_large_file),
COSMS_CORE_TEST_EXPORT_TEST(file_delete_non_existing_file)
); );
#endif #endif