Skip to content

Commit

Permalink
Only test control in controls unit tests
Browse files Browse the repository at this point in the history
The `Alternator` code is tested in the related file
  • Loading branch information
Guillaume Fraux committed Sep 18, 2017
1 parent 3a0ba57 commit ceaaf17
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions src/core/src/sim/md/controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ mod tests {
use super::*;
use sys::{System, UnitCell, Particle};
use sys::veloc::{BoltzmannVelocities, InitVelocities};
// use types::*;
use sim::Alternator;
use utils::system_from_xyz;

fn testing_system() -> System {
Expand Down Expand Up @@ -268,19 +266,7 @@ mod tests {
Ag 1 1 1 1 0 0
");

let mut control = Alternator::new(4, RemoveTranslation::new());

// The three first controls do nothing
let vel_0 = system.particle(0).velocity;
let vel_1 = system.particle(1).velocity;
for _ in 0..3 {
control.control(&mut system);
assert_ulps_eq!(system.particle(0).velocity, vel_0);
assert_ulps_eq!(system.particle(1).velocity, vel_1);
}

// The fourth one removes global translation
control.control(&mut system);
RemoveTranslation::new().control(&mut system);
assert_ulps_eq!(system.particle(0).velocity, Vector3D::new(0.0, 1.0, 0.0));
assert_ulps_eq!(system.particle(1).velocity, Vector3D::new(0.0, -1.0, 0.0));
}
Expand All @@ -293,19 +279,7 @@ mod tests {
Ag 1 0 0 0 -1 2
");

let mut control = Alternator::new(4, RemoveRotation::new());

// The three first controls do nothing
let vel_0 = system.particle(0).velocity;
let vel_1 = system.particle(1).velocity;
for _ in 0..3 {
control.control(&mut system);
assert_ulps_eq!(system.particle(0).velocity, vel_0);
assert_ulps_eq!(system.particle(1).velocity, vel_1);
}

// The fourth one removes global rotation
control.control(&mut system);
RemoveRotation::new().control(&mut system);
assert_ulps_eq!(system.particle(0).velocity, Vector3D::new(0.0, 0.0, 1.0));
assert_ulps_eq!(system.particle(1).velocity, Vector3D::new(0.0, 0.0, 1.0));
}
Expand Down

0 comments on commit ceaaf17

Please sign in to comment.