newton 0.5.1

A Newtonian physics simulator written in Rust.
Documentation
// Newton - A Newtonian physics simulator written in Rust.
// Copyright (C) 2017 Cooper Paul EdenDay
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// Electronic mail: cedenday@protonmail.com

use units::{self, Eval};

// Test Mass.
#[test]
fn simple_mass() {
    assert_eq!(units::Mass::new(10.0).eval(), 10.0);
}

// Test Time.
#[test]
fn simple_time() {
    assert_eq!(units::Time::new(10.0).eval(), 10.0);
}

// Test Length.
#[test]
fn simple_length() {
    assert_eq!(units::Length::new(10.0).eval(), 10.0);

}
#[test]
fn length_velocity_time() {
    let length = units::Length::new(10.0);
    let time = units::Time::new(2.0);
    let velocity = length.velocity_time(time);
    assert_eq!(velocity.eval(), 5.0);
}

// Test Velocity.
#[test]
fn simple_velocity() {
    assert_eq!(units::Velocity::new(10.0).eval(), 10.0);
}
#[test]
fn velocity_displacement_time() {
    let velocity = units::Velocity::new(10.0);
    let time = units::Time::new(10.0);
    let displacement = velocity.displacement_time(time);
    assert_eq!(displacement.eval(), 100.0);
}
#[test]
fn velocity_acceleration_time() {
    let velocity = units::Velocity::new(10.0);
    let time = units::Time::new(2.0);
    let acceleration = velocity.acceleration_time(time);
    assert_eq!(acceleration.eval(), 5.0);
}

// Test Acceleration.
#[test]
fn simple_acceleration() {
    assert_eq!(units::Acceleration::new(10.0).eval(), 10.0);
}

#[test]
fn acceleration_velocity_time() {
    let acceleration = units::Acceleration::new(10.0);
    let time = units::Time::new(2.0);
    let velocity = acceleration.velocity_time(time);
    assert_eq!(velocity.eval(), 20.0);
}

// Test Force.
#[test]
fn simple_force() {
    assert_eq!(units::Force::new(10.0).eval(), 10.0);
}
#[test]
fn force_acceleration_mass() {
    let force = units::Force::new(10.0);
    let mass = units::Mass::new(2.0);
    let acceleration = force.acceleration_mass(mass);
    assert_eq!(acceleration.eval(), 5.0);
}