Add test setup with first test
This commit is contained in:
parent
3bad9e2e92
commit
eb32027546
3 changed files with 42 additions and 0 deletions
|
@ -18,3 +18,6 @@ serde = "1"
|
|||
libimagstore = { version = "0.4.0", path = "../../../lib/core/libimagstore" }
|
||||
libimagerror = { version = "0.4.0", path = "../../../lib/core/libimagerror" }
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = "0.3"
|
||||
|
||||
|
|
|
@ -53,3 +53,39 @@ impl GPSEntry for Entry {
|
|||
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::path::PathBuf;
|
||||
|
||||
use libimagstore::store::Store;
|
||||
|
||||
use entry::*;
|
||||
|
||||
fn setup_logging() {
|
||||
use env_logger;
|
||||
let _ = env_logger::init().unwrap_or(());
|
||||
}
|
||||
|
||||
fn get_store() -> Store {
|
||||
Store::new(PathBuf::from("/"), None).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_set_gps() {
|
||||
setup_logging();
|
||||
|
||||
let store = get_store();
|
||||
|
||||
let mut entry = store.create(PathBuf::from("test_set_gps")).unwrap();
|
||||
|
||||
let coordinates = Coordinates {
|
||||
latitude: GPSValue::new(0, 0, 0),
|
||||
longitude: GPSValue::new(0, 0, 0),
|
||||
};
|
||||
|
||||
let res = entry.set_coordinates(coordinates);
|
||||
|
||||
assert!(res.is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@ extern crate toml_query;
|
|||
extern crate libimagstore;
|
||||
#[macro_use] extern crate libimagerror;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate env_logger;
|
||||
|
||||
pub mod entry;
|
||||
pub mod error;
|
||||
pub mod result;
|
||||
|
|
Loading…
Reference in a new issue