Update gildedrose.rs

Add ability to assert equality on items and modify first starter test to do so.
This commit is contained in:
Maxwell A McKinnon 2023-12-05 11:01:50 -08:00 committed by GitHub
parent 2e30c563d8
commit de03cc8f52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,6 @@
use std::fmt::{self, Display}; use std::fmt::{self, Display};
#[derive(Debug, PartialEq)]
pub struct Item { pub struct Item {
pub name: String, pub name: String,
pub sell_in: i32, pub sell_in: i32,
@ -94,6 +96,6 @@ mod tests {
let mut rose = GildedRose::new(items); let mut rose = GildedRose::new(items);
rose.update_quality(); rose.update_quality();
assert_eq!("fixme", rose.items[0].name); assert_eq!(rose.items[0], Item::new("fixme", -1, 0));
} }
} }