diff --git a/src/ndb.rs b/src/ndb.rs index 8294af8..fa04f1f 100644 --- a/src/ndb.rs +++ b/src/ndb.rs @@ -448,4 +448,35 @@ mod tests { assert_eq!(note.kind(), 1); } } + + #[test] + #[cfg(target_os = "windows")] + fn test_windows_large_mapsize() { + use std::{fs, path::Path}; + + let db = "target/testdbs/event_works"; + test_util::cleanup_db(&db); + + { + // 32 TiB should be way too big for CI + let config = Config::new().set_mapsize(1024usize * 1024usize * 1024usize * 1024usize * 32usize); + let ndb = Ndb::new(db, &config); + assert!(ndb.is_ok()); + } + + let file_len = fs::metadata(Path::new(db).join("data.mdb")) + .expect("metadata") + .len(); + + assert!(file_len > 0); + + if cfg!(target_os = "windows") { + assert_ne!(file_len, 1048576); + } else { + assert!(file_len < 1024u64 * 1024u64); + } + + // If the file size is the default mapsize on windows, this is a bug! + + } }