This removes one of each pair of equivalent tests duplicated within `gix-index` and (separately) within `gix-pack`. See #1685.
Unified · Split
| @@ -237,36 +237,3 @@ pub(crate) mod util { · 236 unmodified lines | |||
| 237 | data.split_at(pos).into() | 237 | data.split_at(pos).into() |
| 238 | } | 238 | } |
| 239 | } | 239 | } |
| 240 | |||
| 241 | // FIXME: Probably remove these in favor of the equivalent tests in `gix-index/tests/index/mod.rs`. | ||
| 242 | #[cfg(test)] | ||
| 243 | mod tests { | ||
| 244 | use gix_testtools::size_ok; | ||
| 245 | |||
| 246 | #[test] | ||
| 247 | fn size_of_entry() { | ||
| 248 | let actual = std::mem::size_of::<crate::Entry>(); | ||
| 249 | let expected = 80; | ||
| 250 | assert!( | ||
| 251 | size_ok(actual, expected), | ||
| 252 | "the size of this structure should not change unexpectedly: {actual} <~ {expected}" | ||
| 253 | ); | ||
| 254 | } | ||
| 255 | |||
| 256 | #[test] | ||
| 257 | fn size_of_entry_time() { | ||
| 258 | // The reason we have our own time is that it is half the size. | ||
| 259 | let ent_actual = std::mem::size_of::<crate::entry::stat::Time>(); | ||
| 260 | let ent_expected = 8; | ||
| 261 | assert!( | ||
| 262 | size_ok(ent_actual, ent_expected), | ||
| 263 | "the size of this structure should not change unexpectedly: {ent_actual} <~ {ent_expected}" | ||
| 264 | ); | ||
| 265 | let ft_actual = std::mem::size_of::<filetime::FileTime>(); | ||
| 266 | let ft_expected = 16; | ||
| 267 | assert!( | ||
| 268 | size_ok(ft_actual, ft_expected), | ||
| 269 | "we will want to know if the size of this structure changes: {ft_actual} <~ {ft_expected}" | ||
| 270 | ); | ||
| 271 | } | ||
| 272 | } | ||
| @@ -22,40 +22,3 @@ pub mod from_offsets; · 21 unmodified lines | |||
| 22 | mod tree; | 22 | mod tree; |
| 23 | 23 | ||
| 24 | pub use tree::{Item, Tree}; | 24 | pub use tree::{Item, Tree}; |
| 25 | |||
| 26 | // FIXME: Probably remove this pair of tests or the equivalent pair in `gix-pack/src/cache/delta/tree.rs`. | ||
| 27 | #[cfg(test)] | ||
| 28 | mod tests { | ||
| 29 | use super::Item; | ||
| 30 | use gix_testtools::size_ok; | ||
| 31 | |||
| 32 | #[test] | ||
| 33 | fn size_of_pack_tree_item() { | ||
| 34 | let actual = std::mem::size_of::<[Item<()>; 7_500_000]>(); | ||
| 35 | let expected = 300_000_000; | ||
| 36 | assert!( | ||
| 37 | size_ok(actual, expected), | ||
| 38 | "we don't want these to grow unnoticed: {actual} <~ {expected}" | ||
| 39 | ); | ||
| 40 | } | ||
| 41 | |||
| 42 | #[test] | ||
| 43 | fn size_of_pack_verify_data_structure() { | ||
| 44 | pub struct EntryWithDefault { | ||
| 45 | _index_entry: crate::index::Entry, | ||
| 46 | _kind: gix_object::Kind, | ||
| 47 | _object_size: u64, | ||
| 48 | _decompressed_size: u64, | ||
| 49 | _compressed_size: u64, | ||
| 50 | _header_size: u16, | ||
| 51 | _level: u16, | ||
| 52 | } | ||
| 53 | |||
| 54 | let actual = std::mem::size_of::<[Item<EntryWithDefault>; 7_500_000]>(); | ||
| 55 | let expected = 840_000_000; | ||
| 56 | assert!( | ||
| 57 | size_ok(actual, expected), | ||
| 58 | "we don't want these to grow unnoticed: {actual} <~ {expected}" | ||
| 59 | ); | ||
| 60 | } | ||
| 61 | } | ||
| @@ -226,7 +226,6 @@ mod tests { · 225 unmodified lines | |||
| 226 | } | 226 | } |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | // FIXME: Probably remove this pair of tests or the equivalent pair in `gix-pack/src/cache/delta/mod.rs`. | ||
| 230 | mod size { | 229 | mod size { |
| 231 | use super::super::Item; | 230 | use super::super::Item; |
| 232 | use gix_testtools::size_ok; | 231 | use gix_testtools::size_ok; |