Skip to content

Commit

Permalink
Merge pull request #88 from triarius/pretty-assertions
Browse files Browse the repository at this point in the history
Use pretty-assertions crate in tests
  • Loading branch information
triarius authored Sep 27, 2024
2 parents d6030f2 + 69141aa commit 6bdcda7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ rand = "0.8.5"
regex = "1.10.6"

[dev-dependencies]
pretty_assertions = "1.4.1"
rand_chacha = "0.3.1"
rayon = "1.10.0"
statrs = "0.17.1"
Expand Down
7 changes: 5 additions & 2 deletions src/passphrase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ pub fn new<T: Rng>(
.join(separator))
}

#[cfg(test)]
mod test {
#[test]
use crate::{passphrase, words};
use pretty_assertions::assert_eq;

// Uses [Pearson's chi-squared test](https://en.wikipedia.org/wiki/Chi-squared_test#Pearson's_chi-squared_test)
// to test that the passphrases are uniformly distributed.
#[test]
fn chi_squared() {
use crate::{passphrase, words};
use itertools::Itertools;
use rand_chacha::{rand_core::SeedableRng, ChaCha8Rng};
use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIterator};
Expand Down

0 comments on commit 6bdcda7

Please sign in to comment.