Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Score enum #81

Merged
merged 7 commits into from
May 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve doc comment.
tmpfs committed May 24, 2024

Verified

This commit was signed with the committer’s verified signature.
tmpfs muji
commit a05e4094160867c886e63f7b154ddd32e0996722
2 changes: 1 addition & 1 deletion src/scoring.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
use std::collections::HashMap;
use std::{cmp, fmt::Display};

/// Score of a password check.
/// Score generated when measuring the entropy of a password.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[non_exhaustive]
#[cfg_attr(feature = "ser", derive(serde::Serialize, serde::Deserialize))]
tmpfs marked this conversation as resolved.
Show resolved Hide resolved
@@ -543,7 +543,7 @@

quickcheck! {
fn test_n_ck_mul_overflow(n: usize, k: usize) -> TestResult {
if n >= 63 && n <= 100 {

Check warning on line 546 in src/scoring.rs

GitHub Actions / clippy-rustfmt

manual `RangeInclusive::contains` implementation
scoring::n_ck(n, k); // Must not panic
TestResult::from_bool(true)
} else {
@@ -836,7 +836,7 @@
};
assert_eq!(
p.estimate(token),
(*scoring::REFERENCE_YEAR - 1972).abs() as u64

Check warning on line 839 in src/scoring.rs

GitHub Actions / clippy-rustfmt

casting the result of `i32::abs()` to u64
);
}

@@ -871,7 +871,7 @@
let token = "1123";
assert_eq!(
p.estimate(token),
365 * (*scoring::REFERENCE_YEAR - p.year).abs() as u64

Check warning on line 874 in src/scoring.rs

GitHub Actions / clippy-rustfmt

casting the result of `i32::abs()` to u64
);
}

@@ -899,7 +899,7 @@
let base_guesses = *scoring::KEYBOARD_STARTING_POSITIONS
* *scoring::KEYBOARD_AVERAGE_DEGREE
* (token.len() - 1) as u64;
assert_eq!(p.estimate(token), base_guesses as u64);

Check warning on line 902 in src/scoring.rs

GitHub Actions / clippy-rustfmt

casting to the same type is unnecessary (`u64` -> `u64`)
}

#[test]

Unchanged files with check annotations Beta

} else {
panic!("Wrong match pattern")
};
assert_eq!(p.reversed, true);

Check warning on line 993 in src/matching/mod.rs

GitHub Actions / clippy-rustfmt

used `assert_eq!` with a literal bool
}
}
} else {
panic!("Wrong match pattern")
};
assert_eq!(p.l33t, true);

Check warning on line 1066 in src/matching/mod.rs

GitHub Actions / clippy-rustfmt

used `assert_eq!` with a literal bool
}
}
} else {
panic!("Wrong match pattern")
};
assert_eq!(p.l33t, true);

Check warning on line 1085 in src/matching/mod.rs

GitHub Actions / clippy-rustfmt

used `assert_eq!` with a literal bool
}
}
panic!("Wrong match pattern")
};
assert_eq!(p.sequence_name, "lower");
assert_eq!(p.ascending, false);

Check warning on line 1211 in src/matching/mod.rs

GitHub Actions / clippy-rustfmt

used `assert_eq!` with a literal bool
}
#[test]