mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-25 23:04:17 -05:00
Move test array to be in test module as vec
This commit is contained in:
parent
8bfe2ec71e
commit
62afbb034f
1 changed files with 9 additions and 9 deletions
|
@ -27,14 +27,6 @@ enum Fruit {
|
||||||
Pineapple,
|
Pineapple,
|
||||||
}
|
}
|
||||||
|
|
||||||
const FRUIT_KINDS: [Fruit; 5] = [
|
|
||||||
Fruit::Apple,
|
|
||||||
Fruit::Banana,
|
|
||||||
Fruit::Mango,
|
|
||||||
Fruit::Lychee,
|
|
||||||
Fruit::Pineapple,
|
|
||||||
];
|
|
||||||
|
|
||||||
fn fruit_basket(basket: &mut HashMap<Fruit, u32>) {
|
fn fruit_basket(basket: &mut HashMap<Fruit, u32>) {
|
||||||
let fruit_kinds = vec![
|
let fruit_kinds = vec![
|
||||||
Fruit::Apple,
|
Fruit::Apple,
|
||||||
|
@ -92,9 +84,17 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn all_fruit_types_in_basket() {
|
fn all_fruit_types_in_basket() {
|
||||||
|
let fruit_kinds = vec![
|
||||||
|
Fruit::Apple,
|
||||||
|
Fruit::Banana,
|
||||||
|
Fruit::Mango,
|
||||||
|
Fruit::Lychee,
|
||||||
|
Fruit::Pineapple,
|
||||||
|
];
|
||||||
|
|
||||||
let mut basket = get_fruit_basket();
|
let mut basket = get_fruit_basket();
|
||||||
fruit_basket(&mut basket);
|
fruit_basket(&mut basket);
|
||||||
for fruit_kind in FRUIT_KINDS {
|
for fruit_kind in fruit_kinds {
|
||||||
let amount = basket
|
let amount = basket
|
||||||
.get(&fruit_kind)
|
.get(&fruit_kind)
|
||||||
.expect(format!("Fruit kind {:?} was not found in basket", fruit_kind).as_str());
|
.expect(format!("Fruit kind {:?} was not found in basket", fruit_kind).as_str());
|
||||||
|
|
Loading…
Reference in a new issue