Add some file-dumping tests
diff --git a/src/main.c b/src/main.c
index 8db750d..5775196 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdbool.h>
 #include <getopt.h>
+#include <ctype.h>
 
 #include "blockdev.h"
 #include "vfs.h"
@@ -14,6 +15,8 @@
 
 static int get_options(int argc, char* argv[], struct program_options* opt);
 
+static void fs_tests(void);
+static void fs_test_file(const char *path);
 
 int main(int argc, char* argv[])
 {
@@ -80,3 +83,52 @@
 	}
 	return 0;
 }
+
+static void fs_tests(void)
+{
+	if (!mount_fs(NULL)) {
+		fprintf(stderr, "ERROR: Failed to mount FS.\n");
+		return;
+	}
+
+	fs_test_file("/test");
+	fs_test_file("/dir/test");
+	fs_test_file("/dir/subdir/test");
+}
+
+static void fs_test_file(const char *path)
+{
+	if (!file_open(path)) {
+		fprintf(stderr, "ERROR: Failed to open `%s'.\n", path);
+		return;
+	}
+
+	unsigned char motd[1024];
+	const int read = file_read(motd, sizeof(motd));
+	if (read < 0) {
+		fprintf(stderr, "ERROR: Failed to read from `%s'.\n", path);
+		return;
+	}
+
+	for (size_t i = 0; i < (size_t)(read + 15) / 16 * 16; ++i) {
+		if (i % 16 == 0)
+			printf("%06x:  ", i);
+		else if (i % 8 == 0)
+			printf(" ");
+		if (i < read)
+			printf("%02x ", motd[i]);
+		else
+			printf("   ");
+		if (i % 16 == 15) {
+			printf(" |");
+			for (size_t j = i - 15; j <= (i < read ? i : read - 1); ++j)
+				printf("%c", isprint(motd[j]) ? motd[j] : '.');
+			for (size_t j = i % 16 + 1; j < 16; ++j)
+				printf(" ");
+			printf("|\n");
+		}
+	}
+	printf("\n");
+
+	file_close();
+}