test named fields
This commit is contained in:
parent
504ff37c47
commit
e95f675e91
@ -1,5 +1,7 @@
|
||||
mod tests;
|
||||
|
||||
#[cfg(feature="named-fields")]
|
||||
mod named;
|
||||
|
||||
#[cfg(feature="fixed_wide")]
|
||||
mod fixed_wide;
|
||||
|
30
fixed_wide_vectors/src/tests/named.rs
Normal file
30
fixed_wide_vectors/src/tests/named.rs
Normal file
@ -0,0 +1,30 @@
|
||||
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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user