We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 638a33b commit cb46a5fCopy full SHA for cb46a5f
tests/test_std.rs
@@ -912,8 +912,12 @@ fn combinations_zero() {
912
#[test]
913
fn combinations_range_count() {
914
for n in 0..=10 {
915
- for k in 0..=n {
916
- let len = (n - k + 1..=n).product::<usize>() / (1..=k).product::<usize>();
+ for k in 0..=10 {
+ let len = if k<=n {
917
+ (n - k + 1..=n).product::<usize>() / (1..=k).product::<usize>()
918
+ } else {
919
+ 0
920
+ };
921
let mut it = (0..n).combinations(k);
922
assert_eq!(len, it.clone().count());
923
assert_eq!(len, it.size_hint().0);
0 commit comments