#[cfg(feature = "encode_eff")]
mod eff;
#[cfg(feature = "encode_pgp")]
mod pgp;
#[cfg(feature = "encode_eff")]
pub use eff::*;
#[cfg(feature = "encode_pgp")]
pub use pgp::*;
#[cfg(feature = "wl_eff_encode")]
include!(concat!(env!("OUT_DIR"), "/wl_eff_encode.rs"));
#[cfg(feature = "wl_pgp_encode")]
include!(concat!(env!("OUT_DIR"), "/wl_pgp_encode.rs"));
#[cfg(feature = "encode")]
pub trait Encode<I: Iterator, E> {
fn encode(self) -> E;
}
#[cfg(any(feature = "wl_eff_encode", feature = "wl_pgp_encode"))]
#[cfg(test)]
mod tests_word_lists_sorted_extent {
use super::*;
#[cfg(feature = "wl_eff_encode")]
#[test]
fn test_wl_eff_encode_is_sorted() {
assert!(WL_EFF_ENCODE.windows(2).all(|w| w[0] <= w[1]));
}
#[cfg(feature = "wl_pgp_encode")]
#[test]
fn test_wl_pgp_encode_three_syllable_lowercase_is_mostly_sorted() {
assert!(WL_PGP_ENCODE_THREE_SYLLABLE.windows(2).all(|w| {
if w[0] == "applicant" && w[1] == "Apollo" {
true
} else {
w[0].to_lowercase() <= w[1].to_lowercase()
}
}));
}
#[cfg(feature = "wl_pgp_encode")]
#[test]
fn test_wl_pgp_encode_two_syllable_is_sorted() {
assert!(WL_PGP_ENCODE_TWO_SYLLABLE
.windows(2)
.all(|w| w[0].to_lowercase() <= w[1].to_lowercase()));
}
}
#[cfg(feature = "wl_eff_encode")]
#[cfg(test)]
#[test]
fn test_wl_eff_encode_contains_256_words() {
assert_eq!(WL_EFF_ENCODE.len(), 256);
}
#[cfg(feature = "wl_pgp_encode")]
#[cfg(test)]
mod test_cases_wl_pgp_encode_contains_256_words {
use super::*;
use test_case::test_case;
#[test_case(WL_PGP_ENCODE_THREE_SYLLABLE ; "three-syllable encode word list contains 256 words")]
#[test_case(WL_PGP_ENCODE_TWO_SYLLABLE ; "two-syllable encode word list contains 256 words")]
fn test(wl: &[&str]) {
assert_eq!(wl.len(), 256);
}
}