mirror of
https://github.com/kmc7468/cs220.git
synced 2026-11-04 08:10:33 +09:00
improve test assignments::assignment10::small_exercises_grade::test_pythagorean
This commit is contained in:
1 parent
d68bd1a13a
commit
c685548bcc
1 file changed
+10
-5
@@ -340,12 +340,17 @@ mod test {
|
||||
(68, 285, 293),
|
||||
];
|
||||
|
||||
for (i, t) in pythagorean().enumerate().take(1000) {
|
||||
if i < pythagoreans.len() {
|
||||
assert_eq!(pythagoreans[i], t)
|
||||
}
|
||||
let (a, b, c) = t;
|
||||
let mut pythagorean_iter = pythagorean();
|
||||
for i in 0..1000 {
|
||||
let t = pythagorean_iter.next();
|
||||
assert!(t.is_some());
|
||||
|
||||
let (a, b, c) = t.unwrap();
|
||||
assert_eq!(a * a + b * b, c * c);
|
||||
|
||||
if i < pythagoreans.len() {
|
||||
assert_eq!(pythagoreans[i], (a, b, c))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user