unit tests

This commit is contained in:
daniel
2020-11-08 09:56:27 +01:00
parent 0351857606
commit c998ded6bb
4 changed files with 17 additions and 28 deletions

View File

@@ -1,13 +1,13 @@
#[cfg(test)]
mod integration {
use std::path::Path;
use std::rc::Rc;
use xdrfile::*;
#[test]
fn test_use_library() {
let mut trj = XTCTrajectory::open("tests/1l2y.xtc", FileMode::Read).unwrap();
let mut trj = XTCTrajectory::open_read("tests/1l2y.xtc").unwrap();
let num_atoms = trj.get_num_atoms().unwrap();
let mut frame = Frame::with_capacity(num_atoms);
@@ -18,9 +18,7 @@ mod integration {
#[test]
fn test_use_library_iterator() {
let path = Path::new("tests/1l2y.xtc");
let trj = XTCTrajectory::open(path, FileMode::Read).unwrap();
let trj = XTCTrajectory::open_read("tests/1l2y.xtc").unwrap();
let frames: Vec<Rc<Frame>> = trj.into_iter().filter_map(Result::ok).collect();
for (idx, frame) in frames.iter().enumerate() {
assert_eq!(frame.step as usize, idx + 1);