summaryrefslogtreecommitdiffstats
path: root/src/test-storage-mmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test-storage-mmap.c')
-rw-r--r--src/test-storage-mmap.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/test-storage-mmap.c b/src/test-storage-mmap.c
new file mode 100644
index 0000000..64c9044
--- /dev/null
+++ b/src/test-storage-mmap.c
@@ -0,0 +1,40 @@
+
+#include <stdio.h>
+#include "test.h"
+#include "storage.h"
+
+#define FILENAME "/tmp/tsnif-storage-mmap.tsnif"
+
+int tsnif_debug = 0;
+
+int test_storage_mmap_init(void)
+{
+ int rc = 0;
+ struct tsnif_storage_handle handle;
+ struct tsnif_storage_opts opts = {
+ .flags = TSNIF_STORAGE_OPT_CREATE | TSNIF_STORAGE_OPT_WRITE,
+ .size_max = 1024*1024,
+ };
+
+ TEST_ASSERT(0 == tsnif_storage_init(&handle, &opts, FILENAME), out);
+ TEST_ASSERT(0 == tsnif_storage_close(&handle), out);
+
+out:
+ return rc;
+}
+
+int test_storage_mmap_write(void)
+{
+ int rc = 0;
+ struct tsnif_storage_handle handle;
+ struct tsnif_storage_opts opts = {
+ .flags = TSNIF_STORAGE_OPT_CREATE | TSNIF_STORAGE_OPT_WRITE,
+ .size_max = 1024*1024,
+ };
+
+ TEST_ASSERT(0 == tsnif_storage_init(&handle, &opts, FILENAME), out);
+ TEST_ASSERT(0 == tsnif_storage_close(&handle), out);
+
+out:
+ return rc;
+}