From ff5832479087f2587a8a8ea34ccc4cf674aeb8b6 Mon Sep 17 00:00:00 2001 From: A Date: Sat, 2 May 2020 19:39:11 -0700 Subject: [PATCH] added more tests --- main.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 2b73b0f..0daaee7 100644 --- a/main.c +++ b/main.c @@ -90,8 +90,41 @@ int main() printf("printed %d %d\n", a, b); print_disk_struct(); + printf("\ntruncating that large file\n"); + fs_truncate(d, 10); + memset(target, 0, 13); + bytes = fs_read(d, target, 12); + fs_lseek(d, 0); + printf("result should be '%.10s': |%s|\n", chonk, target); + printf("%d bytes read\n", bytes); + print_disk_struct(); + + printf("\ndeleting file\n"); + fs_close(d); + fs_delete("example"); + print_disk_struct(); + + printf("\ncreating max number of files\n"); + char name[2] = { 'a' }; + for (int i = 0; i < MAX_FILES; i++) + { + printf("creating file '%s'\n", name); + fs_create(name); + name[0]++; + } + print_disk_struct(); + + printf("\ndeleting all those files\n"); + name[0] = 'a'; + for (int i = 0; i < MAX_FILES; i++) + { + printf("deleting file '%s'\n", name); + fs_delete(name); + name[0]++; + } + print_disk_struct(); + - fs_close(0); if (umount_fs(diskname) < 0) return 1;