1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-11-24 09:02:14 +02:00

Test that correct value is returned for height change (#2164)

This commit is contained in:
Andrew Walbran 2024-07-29 15:16:51 +01:00 committed by GitHub
parent b3bbf6ceda
commit 32230f19f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,11 +67,13 @@ fn test_visit() {
assert_eq!(report.patient_name, "Bob"); assert_eq!(report.patient_name, "Bob");
assert_eq!(report.visit_count, 1); assert_eq!(report.visit_count, 1);
assert_eq!(report.blood_pressure_change, None); assert_eq!(report.blood_pressure_change, None);
assert!((report.height_change - 0.9).abs() < 0.00001);
let report = let report =
bob.visit_doctor(Measurements { height: 156.1, blood_pressure: (115, 76) }); bob.visit_doctor(Measurements { height: 156.1, blood_pressure: (115, 76) });
assert_eq!(report.visit_count, 2); assert_eq!(report.visit_count, 2);
assert_eq!(report.blood_pressure_change, Some((-5, -4))); assert_eq!(report.blood_pressure_change, Some((-5, -4)));
assert_eq!(report.height_change, 0.0);
} }
// ANCHOR_END: tests // ANCHOR_END: tests