31 lines
465 B
Rust
31 lines
465 B
Rust
|
use crate::types::{Vector3,Matrix3};
|
||
|
|
||
|
#[test]
|
||
|
fn test_vector(){
|
||
|
let mut v=Vector3::new([1,2,3]);
|
||
|
assert_eq!(v.x,1);
|
||
|
assert_eq!(v.y,2);
|
||
|
assert_eq!(v.z,3);
|
||
|
|
||
|
v.x=5;
|
||
|
assert_eq!(v.x,5);
|
||
|
|
||
|
v.y*=v.x;
|
||
|
assert_eq!(v.y,10);
|
||
|
}
|
||
|
|
||
|
|
||
|
#[test]
|
||
|
fn test_matrix(){
|
||
|
let mut v=Matrix3::from_value(2);
|
||
|
assert_eq!(v.x_axis.x,2);
|
||
|
assert_eq!(v.y_axis.y,2);
|
||
|
assert_eq!(v.z_axis.z,2);
|
||
|
|
||
|
v.x_axis.x=5;
|
||
|
assert_eq!(v.x_axis.x,5);
|
||
|
|
||
|
v.y_axis.z*=v.x_axis.x;
|
||
|
assert_eq!(v.y_axis.z,10);
|
||
|
}
|