Skip to content

Commit

Permalink
track future size
Browse files Browse the repository at this point in the history
  • Loading branch information
Nugine committed Apr 11, 2023
1 parent c1b941f commit 1ffe0d6
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions crates/s3s/src/ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,22 +697,30 @@ mod tests {

#[test]
fn track_future_size() {
macro_rules! future_size {
($f:path, $v:expr) => {
(stringify!($f), output_size(&$f), $v)
};
}

#[rustfmt::skip]
let sizes = [
(output_size(&S3Service::call), 2616),
(output_size(&call), 1448),
(output_size(&prepare), 1360),
(output_size(&SignatureContext::check), 752),
(output_size(&SignatureContext::v2_check), 280),
(output_size(&SignatureContext::v2_check_presigned_url), 184),
(output_size(&SignatureContext::v2_check_header_auth), 184),
(output_size(&SignatureContext::v4_check), 728),
(output_size(&SignatureContext::v4_check_post_signature), 368),
(output_size(&SignatureContext::v4_check_presigned_url), 456),
(output_size(&SignatureContext::v4_check_header_auth), 632),
future_size!(S3Service::call, 2616),
future_size!(call, 1432),
future_size!(prepare, 1360),
future_size!(SignatureContext::check, 752),
future_size!(SignatureContext::v2_check, 280),
future_size!(SignatureContext::v2_check_presigned_url, 184),
future_size!(SignatureContext::v2_check_header_auth, 184),
future_size!(SignatureContext::v4_check, 728),
future_size!(SignatureContext::v4_check_post_signature, 368),
future_size!(SignatureContext::v4_check_presigned_url, 456),
future_size!(SignatureContext::v4_check_header_auth, 632),
];
println!("{:?}", sizes);
for (size, expected) in sizes {
assert_eq!(size, expected);

println!("{:#?}", sizes);
for (name, size, expected) in sizes {
assert_eq!(size, expected, "{name:?} size changed: prev {expected}, now {size}");
}
}
}

0 comments on commit 1ffe0d6

Please sign in to comment.