File: read.rs

package info (click to toggle)
rust-cdb 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 248 kB
  • sloc: makefile: 10; sh: 9
file content (17 lines) | stat: -rw-r--r-- 512 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extern crate cdb;

#[test]
fn test_one() {
    let cdb = cdb::CDB::open("tests/test1.cdb").unwrap();
    let mut i = cdb.find(b"one");
    assert_eq!(i.next().unwrap().unwrap(), b"Hello");
    assert_eq!(i.next().unwrap().unwrap(), b", World!");
}


#[test]
fn test_two() {
    let cdb = cdb::CDB::open("tests/test1.cdb").unwrap();
    assert_eq!(cdb.find(b"two").next().unwrap().unwrap(), b"Goodbye");
    assert_eq!(cdb.find(b"this key will be split across two reads").next().unwrap().unwrap(), b"Got it.");
}