gnitz-zset 0.1.3

The Z-set kernel of the gnitz database: schema, columnar batches, cursors and operators
1
2
3
4
5
6
7
8
9
10
use super::*;

#[test]
fn mmap_maps_the_whole_file_and_refuses_an_empty_one() {
    let mut tmp = tempfile::NamedTempFile::new().unwrap();
    let err = Mmap::from_file(tmp.as_file()).err().unwrap();
    assert_eq!(err.raw_os_error(), Some(libc::EINVAL));
    std::io::Write::write_all(&mut tmp, b"abc").unwrap();
    assert_eq!(Mmap::from_file(tmp.as_file()).unwrap().as_slice(), b"abc");
}