Skip to content

Commit

Permalink
Fix the parse_capacity tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eightbitraptor committed Oct 18, 2024
1 parent 80d4492 commit 3cf62aa
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions gc/mmtk/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,32 +132,32 @@ mod tests {

#[test]
fn test_parse_capacity_parses_bare_bytes() {
assert_eq!(1234, parse_capacity(String::from("1234"), 0));
assert_eq!(1234, parse_capacity(&String::from("1234"), 0));
}

#[test]
fn test_parse_capacity_parses_kibibytes() {
assert_eq!(10240, parse_capacity(String::from("10KiB"), 0))
assert_eq!(10240, parse_capacity(&String::from("10KiB"), 0))
}

#[test]
fn test_parse_capacity_parses_mebibytes() {
assert_eq!(10485760, parse_capacity(String::from("10MiB"), 0))
assert_eq!(10485760, parse_capacity(&String::from("10MiB"), 0))
}

#[test]
fn test_parse_capacity_parses_gibibytes() {
assert_eq!(10737418240, parse_capacity(String::from("10GiB"), 0))
assert_eq!(10737418240, parse_capacity(&String::from("10GiB"), 0))
}

#[test]
fn test_parses_nonsense_value_as_default_max() {
let default = 100;

assert_eq!(default, parse_capacity(String::from("notanumber"), default));
assert_eq!(default, parse_capacity(String::from("5tartswithanumber"), default));
assert_eq!(default, parse_capacity(String::from("number1nthemiddle"), default));
assert_eq!(default, parse_capacity(String::from("numberattheend111"), default));
assert_eq!(default, parse_capacity(String::from("mult1pl3numb3r5"), default));
assert_eq!(default, parse_capacity(&String::from("notanumber"), default));
assert_eq!(default, parse_capacity(&String::from("5tartswithanumber"), default));
assert_eq!(default, parse_capacity(&String::from("number1nthemiddle"), default));
assert_eq!(default, parse_capacity(&String::from("numberattheend111"), default));
assert_eq!(default, parse_capacity(&String::from("mult1pl3numb3r5"), default));
}
}

0 comments on commit 3cf62aa

Please sign in to comment.