mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-27 00:00:03 +03:00
Compare commits
2 commits
67b52a7ff6
...
b3604b6c32
Author | SHA1 | Date | |
---|---|---|---|
b3604b6c32 | |||
2be69b0f8b |
|
@ -46,7 +46,7 @@ mod tests {
|
||||||
// Don't modify this function!
|
// Don't modify this function!
|
||||||
fn get_fruit_basket() -> HashMap<Fruit, u32> {
|
fn get_fruit_basket() -> HashMap<Fruit, u32> {
|
||||||
let content = [(Fruit::Apple, 4), (Fruit::Mango, 2), (Fruit::Lychee, 5)];
|
let content = [(Fruit::Apple, 4), (Fruit::Mango, 2), (Fruit::Lychee, 5)];
|
||||||
HashMap::from_iter(content)
|
HashMap::from(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -89,7 +89,7 @@ mod tests {
|
||||||
|
|
||||||
for fruit_kind in fruit_kinds {
|
for fruit_kind in fruit_kinds {
|
||||||
let Some(amount) = basket.get(&fruit_kind) else {
|
let Some(amount) = basket.get(&fruit_kind) else {
|
||||||
panic!("Fruit kind {fruit_kind:?} was not found in basket");
|
panic!("Fruit kind {:?} was not found in basket", fruit_kind);
|
||||||
};
|
};
|
||||||
assert!(*amount > 0);
|
assert!(*amount > 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ mod tests {
|
||||||
// Don't modify this function!
|
// Don't modify this function!
|
||||||
fn get_fruit_basket() -> HashMap<Fruit, u32> {
|
fn get_fruit_basket() -> HashMap<Fruit, u32> {
|
||||||
let content = [(Fruit::Apple, 4), (Fruit::Mango, 2), (Fruit::Lychee, 5)];
|
let content = [(Fruit::Apple, 4), (Fruit::Mango, 2), (Fruit::Lychee, 5)];
|
||||||
HashMap::from_iter(content)
|
HashMap::from(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -88,7 +88,7 @@ mod tests {
|
||||||
|
|
||||||
for fruit_kind in fruit_kinds {
|
for fruit_kind in fruit_kinds {
|
||||||
let Some(amount) = basket.get(&fruit_kind) else {
|
let Some(amount) = basket.get(&fruit_kind) else {
|
||||||
panic!("Fruit kind {fruit_kind:?} was not found in basket");
|
panic!("Fruit kind {:?} was not found in basket", fruit_kind);
|
||||||
};
|
};
|
||||||
assert!(*amount > 0);
|
assert!(*amount > 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue