aboutsummaryrefslogtreecommitdiff
path: root/tests/password_generation.rs
diff options
context:
space:
mode:
authorAndreas Grois <soulsource@users.noreply.github.com>2022-11-04 21:59:01 +0100
committerGitHub <noreply@github.com>2022-11-04 21:59:01 +0100
commit3254d705f91b9440457c1b9322c3a3edfd4b217e (patch)
tree73d80a5875523dee4a0bd98ebcb3b6f9bb0603bf /tests/password_generation.rs
parentdaa045ab422062692705ff63c1a5618c9bef9801 (diff)
parentc385c90148178ad38b17491d45f5dcc2cbe06c9c (diff)
Merge pull request #1 from soulsource/feature/heap-allocation-free-base-conversion
Feature/heap allocation free base conversion While skipping the heap allocation is nice, the real gain is the option to early-out of password generation once the desired length has been reached.
Diffstat (limited to 'tests/password_generation.rs')
-rw-r--r--tests/password_generation.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/password_generation.rs b/tests/password_generation.rs
index e559ea5..41874fa 100644
--- a/tests/password_generation.rs
+++ b/tests/password_generation.rs
@@ -421,4 +421,23 @@ fn test_suffix_with_insufficient_length_with_post_leet(){
".0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789öä@€Whatever".to_owned(),
"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789".to_owned()).unwrap();
assert_eq!(result, "suffi");
+}
+
+/// This test exists primarily to test base conversion manual max power search. If certain features are enabled, some values are hard-coded for shorter charsets.
+#[test]
+fn test_very_large_character_set(){
+ let pwm = Pwm::new(
+ HashAlgorithm::Md5,
+ passwordmaker_rs::UseLeetWhenGenerating::NotAtAll,
+ r#"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!§$%&/()=?`+*~#'öäüÖÄÜ-_.:,;|<>@€[]}{¬½¼³²¹¡⅛£¤⅜⅝⅞™±°¿˛¯˘—÷×″^°ſ¶®ŧŦ←¥↓↑→ıøØþÞæÆſẞðÐđªŋŊħĦĸłŁ¢©„‚“‘”’µº"#,
+ "max_mustermann",
+ "modification",
+ 64,
+ "pre",
+ "suf"
+ ).unwrap();
+ let result = pwm.generate(
+ ".0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789öä@€Whatever".to_owned(),
+ "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789".to_owned()).unwrap();
+ assert_eq!(result, r#"preF.º„ĸsj®³5⅜±←|ö←U1Fh~`€ſµ½ẞ5öi6:¯—#öŁ#Oö—ſkª“/[§Ŋ↓½`'Bu:″¯suf"#);
} \ No newline at end of file