Skip to content

Commit e8d3af8

Browse files
committed
test: <errno.h> istead of hardcoded error value
1 parent 98cff92 commit e8d3af8

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tests/storage/storage_compact_test.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include <assert.h>
8+
#include <errno.h>
89
#include <stdarg.h>
910
#include <stdbool.h>
1011
#include <stdint.h>
@@ -246,7 +247,7 @@ static void test_get_file_def_failure_missing_file(void)
246247
setup_tmp_root(tmp_root, sizeof(tmp_root));
247248
create_parent_dirs(tmp_root);
248249
test_path_init(&tp, fids, 2);
249-
assert(ss_storage_get_file_def(&tp.list) == -22);
250+
assert(ss_storage_get_file_def(&tp.list) == -EINVAL);
250251
teardown_tmp_root(tmp_root);
251252
printf("test_get_file_def_failure_missing_file passed\n");
252253
}
@@ -295,7 +296,7 @@ static void test_create_file_read_write_len_delete(void)
295296
assert(ss_storage_delete(&tp.list) == 0);
296297
assert(!path_exists(content_path));
297298
assert(!path_exists(def_path));
298-
assert(ss_storage_delete(&tp.list) == -22);
299+
assert(ss_storage_delete(&tp.list) == -EINVAL);
299300

300301
test_path_free_fci(&tp);
301302
teardown_tmp_root(tmp_root);
@@ -314,7 +315,7 @@ static void test_update_def_and_get_def_roundtrip(void)
314315
create_parent_dirs(tmp_root);
315316
test_path_init(&tp, fids, 3);
316317

317-
assert(ss_storage_update_def(&tp.list) == -22);
318+
assert(ss_storage_update_def(&tp.list) == -EINVAL);
318319

319320
test_path_set_fci(&tp, fci_data, sizeof(fci_data));
320321
assert(ss_storage_update_def(&tp.list) == 0);
@@ -507,14 +508,14 @@ static void test_empty_path_failures(void)
507508
uint8_t data[] = { 0x01 };
508509

509510
ss_list_init(&empty);
510-
assert(ss_storage_get_file_def(&empty) == -22);
511+
assert(ss_storage_get_file_def(&empty) == -EINVAL);
511512
assert(ss_storage_read_file(&empty, 0, 1) == NULL);
512-
assert(ss_storage_write_file(&empty, data, 0, 1) == -22);
513+
assert(ss_storage_write_file(&empty, data, 0, 1) == -EINVAL);
513514
assert(ss_storage_get_file_len(&empty) == 0);
514-
assert(ss_storage_delete(&empty) == -22);
515-
assert(ss_storage_update_def(&empty) == -22);
516-
assert(ss_storage_create_file(&empty, 1) == -22);
517-
assert(ss_storage_create_dir(&empty) == -22);
515+
assert(ss_storage_delete(&empty) == -EINVAL);
516+
assert(ss_storage_update_def(&empty) == -EINVAL);
517+
assert(ss_storage_create_file(&empty, 1) == -EINVAL);
518+
assert(ss_storage_create_dir(&empty) == -EINVAL);
518519
printf("test_empty_path_failures passed\n");
519520
}
520521

0 commit comments

Comments
 (0)