mirror of
https://github.com/dnlbauer/xdrfile.git
synced 2026-09-10 22:25:30 +00:00
28 lines
761 B
Rust
28 lines
761 B
Rust
#[cfg(test)]
|
|
mod integration {
|
|
|
|
|
|
use std::rc::Rc;
|
|
use xdrfile::*;
|
|
|
|
#[test]
|
|
fn test_use_library() {
|
|
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);
|
|
|
|
trj.read(&mut frame).unwrap();
|
|
trj.read(&mut frame).unwrap();
|
|
assert_eq!(frame.step, 2);
|
|
}
|
|
|
|
#[test]
|
|
fn test_use_library_iterator() {
|
|
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);
|
|
}
|
|
}
|
|
}
|