From de03cc8f52436bd36dd8a43090c73a553a5f9d2d Mon Sep 17 00:00:00 2001 From: Maxwell A McKinnon Date: Tue, 5 Dec 2023 11:01:50 -0800 Subject: [PATCH] Update gildedrose.rs Add ability to assert equality on items and modify first starter test to do so. --- rust/src/gildedrose.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/src/gildedrose.rs b/rust/src/gildedrose.rs index e65fa085..71bdbdcf 100644 --- a/rust/src/gildedrose.rs +++ b/rust/src/gildedrose.rs @@ -1,4 +1,6 @@ use std::fmt::{self, Display}; + +#[derive(Debug, PartialEq)] pub struct Item { pub name: String, pub sell_in: i32, @@ -94,6 +96,6 @@ mod tests { let mut rose = GildedRose::new(items); rose.update_quality(); - assert_eq!("fixme", rose.items[0].name); + assert_eq!(rose.items[0], Item::new("fixme", -1, 0)); } }