1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-21 07:27:01 +02:00

Merge pull request #85 from der3318/update-test-cases-for-polygons

Better Test Case for Day 2 Polygon Exercise
This commit is contained in:
Martin Geisler 2022-12-28 15:46:15 +01:00 committed by GitHub
commit 4a0455f5bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -207,6 +207,7 @@ mod tests {
fn test_shape_circumferences() {
let mut poly = Polygon::new();
poly.add_point(Point::new(12, 13));
poly.add_point(Point::new(17, 11));
poly.add_point(Point::new(16, 16));
let shapes = vec![
Shape::from(poly),
@ -217,7 +218,7 @@ mod tests {
.map(Shape::circumference)
.map(round_two_digits)
.collect::<Vec<_>>();
assert_eq!(circumferences, vec![10.0, 31.42]);
assert_eq!(circumferences, vec![15.48, 31.42]);
}
}
// ANCHOR_END: unit-tests