summaryrefslogtreecommitdiff
path: root/tests/unit/mongo/sync-gridfs/sync_gridfs_get_set_chunk_size.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/mongo/sync-gridfs/sync_gridfs_get_set_chunk_size.c')
-rw-r--r--tests/unit/mongo/sync-gridfs/sync_gridfs_get_set_chunk_size.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/unit/mongo/sync-gridfs/sync_gridfs_get_set_chunk_size.c b/tests/unit/mongo/sync-gridfs/sync_gridfs_get_set_chunk_size.c
new file mode 100644
index 0000000..5d17986
--- /dev/null
+++ b/tests/unit/mongo/sync-gridfs/sync_gridfs_get_set_chunk_size.c
@@ -0,0 +1,33 @@
+#include "test.h"
+#include "mongo.h"
+
+void
+test_mongo_sync_gridfs_get_set_chunk_size (void)
+{
+ mongo_sync_gridfs *gfs;
+
+ ok (mongo_sync_gridfs_get_chunk_size (NULL) == -1,
+ "mongo_sync_gridfs_get_chunk_size() fails with a NULL gfs");
+ ok (mongo_sync_gridfs_set_chunk_size (NULL, 16 * 1024) == FALSE,
+ "mongo_sync_gridfs_set_chunk_size() fails with a NULL gfs");
+
+ begin_network_tests (3);
+
+ gfs = mongo_sync_gridfs_new (mongo_sync_connect (config.primary_host,
+ config.primary_port,
+ FALSE),
+ config.gfs_prefix);
+
+ ok (mongo_sync_gridfs_set_chunk_size (gfs, -1) == FALSE,
+ "mongo_sync_gridfs_set_chunk_size() fails if the size is invalid");
+ ok (mongo_sync_gridfs_set_chunk_size (gfs, 12345),
+ "mongo_sync_gridfs_set_chunk_size() works");
+ cmp_ok (mongo_sync_gridfs_get_chunk_size (gfs), "==", 12345,
+ "mongo_sync_gridfs_get_chunk_size() works");
+
+ mongo_sync_gridfs_free (gfs, TRUE);
+
+ end_network_tests ();
+}
+
+RUN_TEST (5, mongo_sync_gridfs_get_set_chunk_size);