diff --git a/Cargo.lock b/Cargo.lock index 54a3a3f..2d89507 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -346,6 +346,7 @@ dependencies = [ name = "coremem_cross" version = "0.2.0" dependencies = [ + "coremem_cross", "serde", ] diff --git a/crates/cross/Cargo.toml b/crates/cross/Cargo.toml index ca129b8..aa81004 100644 --- a/crates/cross/Cargo.toml +++ b/crates/cross/Cargo.toml @@ -11,3 +11,5 @@ fmt = [] [dependencies] serde = { version = "1.0", optional = true } # MIT or Apache 2.0 +[dev-dependencies] +coremem_cross = { path = ".", default-features = false, features = ["fmt"] } diff --git a/crates/cross/src/dim/dim_slice.rs b/crates/cross/src/dim/dim_slice.rs index d573615..63569b2 100644 --- a/crates/cross/src/dim/dim_slice.rs +++ b/crates/cross/src/dim/dim_slice.rs @@ -190,64 +190,64 @@ mod test { fn dim_slice_indices() { let s = DimSlice::new(Vec3u::new(4, 3, 2), &[()]); let mut i = s.indices(); - assert!(i.next().unwrap() == Vec3u::new(0, 0, 0)); - assert!(i.next().unwrap() == Vec3u::new(1, 0, 0)); - assert!(i.next().unwrap() == Vec3u::new(2, 0, 0)); - assert!(i.next().unwrap() == Vec3u::new(3, 0, 0)); + assert_eq!(i.next().unwrap(), Vec3u::new(0, 0, 0)); + assert_eq!(i.next().unwrap(), Vec3u::new(1, 0, 0)); + assert_eq!(i.next().unwrap(), Vec3u::new(2, 0, 0)); + assert_eq!(i.next().unwrap(), Vec3u::new(3, 0, 0)); - assert!(i.next().unwrap() == Vec3u::new(0, 1, 0)); - assert!(i.next().unwrap() == Vec3u::new(1, 1, 0)); - assert!(i.next().unwrap() == Vec3u::new(2, 1, 0)); - assert!(i.next().unwrap() == Vec3u::new(3, 1, 0)); + assert_eq!(i.next().unwrap(), Vec3u::new(0, 1, 0)); + assert_eq!(i.next().unwrap(), Vec3u::new(1, 1, 0)); + assert_eq!(i.next().unwrap(), Vec3u::new(2, 1, 0)); + assert_eq!(i.next().unwrap(), Vec3u::new(3, 1, 0)); - assert!(i.next().unwrap() == Vec3u::new(0, 2, 0)); - assert!(i.next().unwrap() == Vec3u::new(1, 2, 0)); - assert!(i.next().unwrap() == Vec3u::new(2, 2, 0)); - assert!(i.next().unwrap() == Vec3u::new(3, 2, 0)); + assert_eq!(i.next().unwrap(), Vec3u::new(0, 2, 0)); + assert_eq!(i.next().unwrap(), Vec3u::new(1, 2, 0)); + assert_eq!(i.next().unwrap(), Vec3u::new(2, 2, 0)); + assert_eq!(i.next().unwrap(), Vec3u::new(3, 2, 0)); - assert!(i.next().unwrap() == Vec3u::new(0, 0, 1)); - assert!(i.next().unwrap() == Vec3u::new(1, 0, 1)); - assert!(i.next().unwrap() == Vec3u::new(2, 0, 1)); - assert!(i.next().unwrap() == Vec3u::new(3, 0, 1)); + assert_eq!(i.next().unwrap(), Vec3u::new(0, 0, 1)); + assert_eq!(i.next().unwrap(), Vec3u::new(1, 0, 1)); + assert_eq!(i.next().unwrap(), Vec3u::new(2, 0, 1)); + assert_eq!(i.next().unwrap(), Vec3u::new(3, 0, 1)); - assert!(i.next().unwrap() == Vec3u::new(0, 1, 1)); - assert!(i.next().unwrap() == Vec3u::new(1, 1, 1)); - assert!(i.next().unwrap() == Vec3u::new(2, 1, 1)); - assert!(i.next().unwrap() == Vec3u::new(3, 1, 1)); + assert_eq!(i.next().unwrap(), Vec3u::new(0, 1, 1)); + assert_eq!(i.next().unwrap(), Vec3u::new(1, 1, 1)); + assert_eq!(i.next().unwrap(), Vec3u::new(2, 1, 1)); + assert_eq!(i.next().unwrap(), Vec3u::new(3, 1, 1)); - assert!(i.next().unwrap() == Vec3u::new(0, 2, 1)); - assert!(i.next().unwrap() == Vec3u::new(1, 2, 1)); - assert!(i.next().unwrap() == Vec3u::new(2, 2, 1)); - assert!(i.next().unwrap() == Vec3u::new(3, 2, 1)); + assert_eq!(i.next().unwrap(), Vec3u::new(0, 2, 1)); + assert_eq!(i.next().unwrap(), Vec3u::new(1, 2, 1)); + assert_eq!(i.next().unwrap(), Vec3u::new(2, 2, 1)); + assert_eq!(i.next().unwrap(), Vec3u::new(3, 2, 1)); - assert!(i.next() == None); - assert!(i.next() == None); + assert_eq!(i.next(), None); + assert_eq!(i.next(), None); } #[test] fn dim_slice_indices_zero_dim() { let s = DimSlice::new(Vec3u::new(4, 3, 0), &[()]); - assert!(s.indices().next() == None); - assert!(s.indices().next() == None); + assert_eq!(s.indices().next(), None); + assert_eq!(s.indices().next(), None); let s = DimSlice::new(Vec3u::new(4, 0, 2), &[()]); - assert!(s.indices().next() == None); - assert!(s.indices().next() == None); + assert_eq!(s.indices().next(), None); + assert_eq!(s.indices().next(), None); let s = DimSlice::new(Vec3u::new(0, 3, 2), &[()]); - assert!(s.indices().next() == None); - assert!(s.indices().next() == None); + assert_eq!(s.indices().next(), None); + assert_eq!(s.indices().next(), None); let s = DimSlice::new(Vec3u::new(3, 0, 0), &[()]); - assert!(s.indices().next() == None); - assert!(s.indices().next() == None); + assert_eq!(s.indices().next(), None); + assert_eq!(s.indices().next(), None); let s = DimSlice::new(Vec3u::new(0, 1, 0), &[()]); - assert!(s.indices().next() == None); - assert!(s.indices().next() == None); + assert_eq!(s.indices().next(), None); + assert_eq!(s.indices().next(), None); let s = DimSlice::new(Vec3u::new(0, 0, 2), &[()]); - assert!(s.indices().next() == None); - assert!(s.indices().next() == None); + assert_eq!(s.indices().next(), None); + assert_eq!(s.indices().next(), None); } #[test] @@ -259,13 +259,13 @@ mod test { ]; let s = DimSlice::new(Vec3u::new(1, 2, 3), &data); let mut i = s.enumerated(); - assert!(i.next().unwrap() == (Vec3u::new(0, 0, 0), &10)); - assert!(i.next().unwrap() == (Vec3u::new(0, 1, 0), &11)); - assert!(i.next().unwrap() == (Vec3u::new(0, 0, 1), &20)); - assert!(i.next().unwrap() == (Vec3u::new(0, 1, 1), &21)); - assert!(i.next().unwrap() == (Vec3u::new(0, 0, 2), &30)); - assert!(i.next().unwrap() == (Vec3u::new(0, 1, 2), &31)); - assert!(i.next() == None); + assert_eq!(i.next().unwrap(), (Vec3u::new(0, 0, 0), &10)); + assert_eq!(i.next().unwrap(), (Vec3u::new(0, 1, 0), &11)); + assert_eq!(i.next().unwrap(), (Vec3u::new(0, 0, 1), &20)); + assert_eq!(i.next().unwrap(), (Vec3u::new(0, 1, 1), &21)); + assert_eq!(i.next().unwrap(), (Vec3u::new(0, 0, 2), &30)); + assert_eq!(i.next().unwrap(), (Vec3u::new(0, 1, 2), &31)); + assert_eq!(i.next(), None); } #[test] @@ -279,16 +279,16 @@ mod test { let mut i = s.enumerated(); let (idx, v) = i.next().unwrap(); - assert!(idx == Vec3u::new(0, 0, 0)); + assert_eq!(idx, Vec3u::new(0, 0, 0)); *v = 100; let (idx, v) = i.next().unwrap(); - assert!(idx == Vec3u::new(1, 0, 0)); + assert_eq!(idx, Vec3u::new(1, 0, 0)); *v = 110; i.next().unwrap(); let (idx, v) = i.next().unwrap(); - assert!(idx == Vec3u::new(1, 0, 1)); + assert_eq!(idx, Vec3u::new(1, 0, 1)); *v = 210; assert_eq!(data, [100, 110, 20, 210, 30, 31]);