test named fields

This commit is contained in:
Quaternions 2024-09-05 16:53:30 -07:00
parent 504ff37c47
commit e95f675e91
2 changed files with 32 additions and 0 deletions

View File

@ -1,5 +1,7 @@
mod tests; mod tests;
#[cfg(feature="named-fields")]
mod named;
#[cfg(feature="fixed_wide")] #[cfg(feature="fixed_wide")]
mod fixed_wide; mod fixed_wide;

View 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);
}