Skip to content

Commit

Permalink
modify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aawsome committed Sep 29, 2024
1 parent 0741576 commit dde2269
Show file tree
Hide file tree
Showing 5 changed files with 591 additions and 2,911 deletions.
14 changes: 7 additions & 7 deletions crates/core/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,10 +654,6 @@ mod tests {
#[case("5/12")]
#[case("5%")]
#[case("250MiB")]
// we need some casts to compute percentage...
#[allow(clippy::cast_possible_truncation)]
#[allow(clippy::cast_precision_loss)]
#[allow(clippy::cast_sign_loss)]
fn test_read_subset(mut rng: StdRng, #[case] s: &str) {
let size =
|packs: &[IndexPack]| -> u64 { packs.iter().map(|p| u64::from(p.pack_size())).sum() };
Expand All @@ -671,14 +667,18 @@ mod tests {

match subset {
ReadSubsetOption::All => assert_eq!(test_size, total_size),
#[allow(clippy::cast_possible_truncation)]
#[allow(clippy::cast_precision_loss)]
#[allow(clippy::cast_sign_loss)]
ReadSubsetOption::Percentage(s) => assert!(test_size <= (total_size as f64 * s) as u64),
ReadSubsetOption::Size(size) => {
assert!(test_size < size && size < test_size + PACK_SIZE as u64)
assert!(test_size <= size && size <= test_size + u64::from(PACK_SIZE))
}
_ => {}
ReadSubsetOption::IdSubSet(_) => {}
};

assert_ron_snapshot!(s, packs);
let ids: Vec<_> = packs.iter().map(|pack| pack.id).collect();
assert_ron_snapshot!(s, ids);
}

fn test_read_subset_n_m() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,66 +1,18 @@
---
source: crates/core/src/commands/check.rs
expression: packs
expression: ids
---
[
IndexPack(
id: Id("50ec36b55a9b35de779a2757571d2e4b16f6d1ca3ff73ade120901262c2b265d"),
blobs: [],
size: Some(25543042),
),
IndexPack(
id: Id("d07f392b1dfebfdf50bb10a4a7857b543cbe246f84549af8902dfde9737fd425"),
blobs: [],
size: Some(16489215),
),
IndexPack(
id: Id("f879520cb3e653a0c77dcc37dcd813a71ec7d972a4a6185b13f2ed240c6e72e1"),
blobs: [],
size: Some(3342498),
),
IndexPack(
id: Id("8ba2cc8cf44054f35be413f12ba83969deb01f1c44660822cee1b960d69a7526"),
blobs: [],
size: Some(46887261),
),
IndexPack(
id: Id("e6bae2c9c6b9d8b8a72b45590ffc6c8e034083d6a8180877f6d270537a1ac214"),
blobs: [],
size: Some(47685315),
),
IndexPack(
id: Id("f77e206f69693ae3490de38ce00f5e89ae7db4808b770c60e07d64815ee0478d"),
blobs: [],
size: Some(9217773),
),
IndexPack(
id: Id("20b51c8c49aff07d7063c76a863cbdcea845989ef79d4a3f8ff599687eaebe48"),
blobs: [],
size: Some(83677501),
),
IndexPack(
id: Id("9630b7b1e6329e7c28eb0eeb4e0df36bbf45acf3ba5de4a0403b77e47216857a"),
blobs: [],
size: Some(24144078),
),
IndexPack(
id: Id("33e053041d2de235e03cc219a8b8300d8f1e35ee034c45f4613ea782d5e672f2"),
blobs: [],
size: Some(2254122),
),
IndexPack(
id: Id("7583c1099bf604771a03af7627f4122a59da07db7358484b8543e881a7939b3f"),
blobs: [],
size: Some(68829),
),
IndexPack(
id: Id("a94f61701a165181c6940584ca0cd2c2355e5e1eb65a3a295fc4d1c02fa81138"),
blobs: [],
size: Some(2347337),
),
IndexPack(
id: Id("5ae22a813d32049b56ac2760a5a34b8f66e30b5232f66bb8eae420c7022197e8"),
blobs: [],
size: Some(452910),
),
Id("50ec36b55a9b35de779a2757571d2e4b16f6d1ca3ff73ade120901262c2b265d"),
Id("d07f392b1dfebfdf50bb10a4a7857b543cbe246f84549af8902dfde9737fd425"),
Id("f879520cb3e653a0c77dcc37dcd813a71ec7d972a4a6185b13f2ed240c6e72e1"),
Id("8ba2cc8cf44054f35be413f12ba83969deb01f1c44660822cee1b960d69a7526"),
Id("e6bae2c9c6b9d8b8a72b45590ffc6c8e034083d6a8180877f6d270537a1ac214"),
Id("f77e206f69693ae3490de38ce00f5e89ae7db4808b770c60e07d64815ee0478d"),
Id("20b51c8c49aff07d7063c76a863cbdcea845989ef79d4a3f8ff599687eaebe48"),
Id("9630b7b1e6329e7c28eb0eeb4e0df36bbf45acf3ba5de4a0403b77e47216857a"),
Id("33e053041d2de235e03cc219a8b8300d8f1e35ee034c45f4613ea782d5e672f2"),
Id("7583c1099bf604771a03af7627f4122a59da07db7358484b8543e881a7939b3f"),
Id("a94f61701a165181c6940584ca0cd2c2355e5e1eb65a3a295fc4d1c02fa81138"),
Id("5ae22a813d32049b56ac2760a5a34b8f66e30b5232f66bb8eae420c7022197e8"),
]
Original file line number Diff line number Diff line change
@@ -1,181 +1,41 @@
---
source: crates/core/src/commands/check.rs
expression: packs
expression: ids
---
[
IndexPack(
id: Id("50ec36b55a9b35de779a2757571d2e4b16f6d1ca3ff73ade120901262c2b265d"),
blobs: [],
size: Some(25543042),
),
IndexPack(
id: Id("d07f392b1dfebfdf50bb10a4a7857b543cbe246f84549af8902dfde9737fd425"),
blobs: [],
size: Some(16489215),
),
IndexPack(
id: Id("f879520cb3e653a0c77dcc37dcd813a71ec7d972a4a6185b13f2ed240c6e72e1"),
blobs: [],
size: Some(3342498),
),
IndexPack(
id: Id("8ba2cc8cf44054f35be413f12ba83969deb01f1c44660822cee1b960d69a7526"),
blobs: [],
size: Some(46887261),
),
IndexPack(
id: Id("e6bae2c9c6b9d8b8a72b45590ffc6c8e034083d6a8180877f6d270537a1ac214"),
blobs: [],
size: Some(47685315),
),
IndexPack(
id: Id("f77e206f69693ae3490de38ce00f5e89ae7db4808b770c60e07d64815ee0478d"),
blobs: [],
size: Some(9217773),
),
IndexPack(
id: Id("20b51c8c49aff07d7063c76a863cbdcea845989ef79d4a3f8ff599687eaebe48"),
blobs: [],
size: Some(83677501),
),
IndexPack(
id: Id("e9d65ff27f350d46ab7b1147511723ad88a2453311ae209230072fa3ad7061b9"),
blobs: [],
size: Some(85870775),
),
IndexPack(
id: Id("9630b7b1e6329e7c28eb0eeb4e0df36bbf45acf3ba5de4a0403b77e47216857a"),
blobs: [],
size: Some(24144078),
),
IndexPack(
id: Id("80d81feb02d330b1b19847eef1799b5eef1f49d86b5868a5aac20489765690ec"),
blobs: [],
size: Some(22861060),
),
IndexPack(
id: Id("4fbdeb3d00095e28cef9efae2c412ef8a22e685f90fa555eaa6bcc37b25c6508"),
blobs: [],
size: Some(79074939),
),
IndexPack(
id: Id("73400ac961c6e3d938ba106167a73495e76243cc531b6487fbbb9f00c5cb2818"),
blobs: [],
size: Some(66656665),
),
IndexPack(
id: Id("0aecc98eb1e9c7ab4a04a0fa3dbc86ac17f7448e05bdab4f59f2761b86ed5e9c"),
blobs: [],
size: Some(6459506),
),
IndexPack(
id: Id("32fb9db957fc10ac2812e9490533757f17602dc0f514e0ef7cd4d0a19645b6b6"),
blobs: [],
size: Some(68515164),
),
IndexPack(
id: Id("57e3f93b1ac0928db8a55e77824e043bcf25ee28bfed1e60aaa9d568dd79e574"),
blobs: [],
size: Some(93597568),
),
IndexPack(
id: Id("1afe739c8f3703e6b2807107db592d0ef6269c43a44716e08f99311844904b87"),
blobs: [],
size: Some(87610524),
),
IndexPack(
id: Id("ed49d37e5e9404c82f1373c604335b546e962b6b997fea552ce44a1ab12765a7"),
blobs: [],
size: Some(13510682),
),
IndexPack(
id: Id("b7c3c37a41c4504ed46348908978eeece1732e2414d6eeed10f3b27fb07cfded"),
blobs: [],
size: Some(56975313),
),
IndexPack(
id: Id("213d4565ca5161123aec22060b362fc6188e2ee41c11df09e5db868050c251bd"),
blobs: [],
size: Some(7883153),
),
IndexPack(
id: Id("476746a3956f3fc56c4391c1f2a6485de2e707f97b43e6fde302d8ef58d03b14"),
blobs: [],
size: Some(99496649),
),
IndexPack(
id: Id("0e5f2ece590104cea9da3366217853c49f3ebbd949721a1ba225648453a6158e"),
blobs: [],
size: Some(33703536),
),
IndexPack(
id: Id("e2c2a4449c2fd35beedfa98d006f9ec2c638c41e745dc7e51c45c341abab1769"),
blobs: [],
size: Some(8720062),
),
IndexPack(
id: Id("0bc1f65e245a4716b44b80f79fe66af53caf1625ec57d94ed063411f04fef7f4"),
blobs: [],
size: Some(98462709),
),
IndexPack(
id: Id("adf972f778d97c5b1cd00e2fe04954af594a64e7b8b018e7e572794a0c33f47f"),
blobs: [],
size: Some(91729180),
),
IndexPack(
id: Id("d2d5c26249cf84a2822c710edfe0e9f10eeed8ae74cf318e0530f6cb08c51425"),
blobs: [],
size: Some(8024813),
),
IndexPack(
id: Id("cd3049b4967c028ae7459698cdc110cea7eb197c60d8a7488f2793a0f87a47d4"),
blobs: [],
size: Some(6894690),
),
IndexPack(
id: Id("bac90a9cf3bcd7e7222369bbf00dc9de9c183780a0e602a6213f8c1134fb22c4"),
blobs: [],
size: Some(16398765),
),
IndexPack(
id: Id("069df78d3a7f51f0171a9d64ed58c1728fc0f86fe725680d920ffb384d0068bd"),
blobs: [],
size: Some(8971656),
),
IndexPack(
id: Id("b0aa5dc32c279b4a9b0c026e41fe0925b12f70a32d3bb854110c16dcf70ae9c4"),
blobs: [],
size: Some(20947321),
),
IndexPack(
id: Id("33e053041d2de235e03cc219a8b8300d8f1e35ee034c45f4613ea782d5e672f2"),
blobs: [],
size: Some(2254122),
),
IndexPack(
id: Id("a39e69f47f6617866beeff292c25613aa4776abe8f11108035fa38bc72030c59"),
blobs: [],
size: Some(4277145),
),
IndexPack(
id: Id("7583c1099bf604771a03af7627f4122a59da07db7358484b8543e881a7939b3f"),
blobs: [],
size: Some(68829),
),
IndexPack(
id: Id("5ae22a813d32049b56ac2760a5a34b8f66e30b5232f66bb8eae420c7022197e8"),
blobs: [],
size: Some(452910),
),
IndexPack(
id: Id("01324e1657f32d887da2be566b060d1f53902a399498869b56f942cfbae50705"),
blobs: [],
size: Some(332870),
),
IndexPack(
id: Id("3e26211a1a4e63cfaf22d5f3e4c87a0fdc521f177535620336301813d4a335b6"),
blobs: [],
size: Some(122381),
),
Id("50ec36b55a9b35de779a2757571d2e4b16f6d1ca3ff73ade120901262c2b265d"),
Id("d07f392b1dfebfdf50bb10a4a7857b543cbe246f84549af8902dfde9737fd425"),
Id("f879520cb3e653a0c77dcc37dcd813a71ec7d972a4a6185b13f2ed240c6e72e1"),
Id("8ba2cc8cf44054f35be413f12ba83969deb01f1c44660822cee1b960d69a7526"),
Id("e6bae2c9c6b9d8b8a72b45590ffc6c8e034083d6a8180877f6d270537a1ac214"),
Id("f77e206f69693ae3490de38ce00f5e89ae7db4808b770c60e07d64815ee0478d"),
Id("20b51c8c49aff07d7063c76a863cbdcea845989ef79d4a3f8ff599687eaebe48"),
Id("e9d65ff27f350d46ab7b1147511723ad88a2453311ae209230072fa3ad7061b9"),
Id("9630b7b1e6329e7c28eb0eeb4e0df36bbf45acf3ba5de4a0403b77e47216857a"),
Id("80d81feb02d330b1b19847eef1799b5eef1f49d86b5868a5aac20489765690ec"),
Id("4fbdeb3d00095e28cef9efae2c412ef8a22e685f90fa555eaa6bcc37b25c6508"),
Id("73400ac961c6e3d938ba106167a73495e76243cc531b6487fbbb9f00c5cb2818"),
Id("0aecc98eb1e9c7ab4a04a0fa3dbc86ac17f7448e05bdab4f59f2761b86ed5e9c"),
Id("32fb9db957fc10ac2812e9490533757f17602dc0f514e0ef7cd4d0a19645b6b6"),
Id("57e3f93b1ac0928db8a55e77824e043bcf25ee28bfed1e60aaa9d568dd79e574"),
Id("1afe739c8f3703e6b2807107db592d0ef6269c43a44716e08f99311844904b87"),
Id("ed49d37e5e9404c82f1373c604335b546e962b6b997fea552ce44a1ab12765a7"),
Id("b7c3c37a41c4504ed46348908978eeece1732e2414d6eeed10f3b27fb07cfded"),
Id("213d4565ca5161123aec22060b362fc6188e2ee41c11df09e5db868050c251bd"),
Id("476746a3956f3fc56c4391c1f2a6485de2e707f97b43e6fde302d8ef58d03b14"),
Id("0e5f2ece590104cea9da3366217853c49f3ebbd949721a1ba225648453a6158e"),
Id("e2c2a4449c2fd35beedfa98d006f9ec2c638c41e745dc7e51c45c341abab1769"),
Id("0bc1f65e245a4716b44b80f79fe66af53caf1625ec57d94ed063411f04fef7f4"),
Id("adf972f778d97c5b1cd00e2fe04954af594a64e7b8b018e7e572794a0c33f47f"),
Id("d2d5c26249cf84a2822c710edfe0e9f10eeed8ae74cf318e0530f6cb08c51425"),
Id("cd3049b4967c028ae7459698cdc110cea7eb197c60d8a7488f2793a0f87a47d4"),
Id("bac90a9cf3bcd7e7222369bbf00dc9de9c183780a0e602a6213f8c1134fb22c4"),
Id("069df78d3a7f51f0171a9d64ed58c1728fc0f86fe725680d920ffb384d0068bd"),
Id("b0aa5dc32c279b4a9b0c026e41fe0925b12f70a32d3bb854110c16dcf70ae9c4"),
Id("33e053041d2de235e03cc219a8b8300d8f1e35ee034c45f4613ea782d5e672f2"),
Id("a39e69f47f6617866beeff292c25613aa4776abe8f11108035fa38bc72030c59"),
Id("7583c1099bf604771a03af7627f4122a59da07db7358484b8543e881a7939b3f"),
Id("5ae22a813d32049b56ac2760a5a34b8f66e30b5232f66bb8eae420c7022197e8"),
Id("01324e1657f32d887da2be566b060d1f53902a399498869b56f942cfbae50705"),
Id("3e26211a1a4e63cfaf22d5f3e4c87a0fdc521f177535620336301813d4a335b6"),
]
Loading

0 comments on commit dde2269

Please sign in to comment.