aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/web.rs49
1 files changed, 30 insertions, 19 deletions
diff --git a/tests/web.rs b/tests/web.rs
index eedd1b4..b5af034 100644
--- a/tests/web.rs
+++ b/tests/web.rs
@@ -14,50 +14,61 @@ const ATTEMPTS: usize = 5;
#[wasm_bindgen_test]
fn generate_length() {
for x in (0..=100).step_by(5) {
- let password = generate(x, true, true, true, true);
+ let password = generate(x, true, true, true, true, false);
assert_eq!(x, password.len())
}
}
#[wasm_bindgen_test]
-fn generate_not_upper_letters() {
- let lower_charset = "abcdefghijklmnopqrstuvwxyz";
+fn generate_no_upper_letters() {
+ let charset = "abcdefghijklmnopqrstuvwxyz";
for _ in 0..ATTEMPTS {
- let password = generate(100, false, true, true, true);
- for char in String::from(lower_charset).chars().into_iter() {
+ let password = generate(100, false, true, true, true, true);
+ for char in String::from(charset).chars().into_iter() {
assert!(!password.contains(char))
}
}
}
#[wasm_bindgen_test]
-fn generate_not_lower_letters() {
- let upper_charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+fn generate_no_lower_letters() {
+ let charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for x in 0..ATTEMPTS {
- let password = generate(x, true, false, true, true);
- for char in String::from(upper_charset).chars().into_iter() {
+ let password = generate(x, true, false, true, true, true);
+ for char in String::from(charset).chars().into_iter() {
assert!(!password.contains(char))
}
}
}
#[wasm_bindgen_test]
-fn generate_not_number_letters() {
- let upper_charset = "1234567890";
+fn generate_no_number_letters() {
+ let charset = "1234567890";
for x in 0..ATTEMPTS {
- let password = generate(x, true, true, false, true);
- for char in String::from(upper_charset).chars().into_iter() {
+ let password = generate(x, true, true, false, true, true);
+ for char in String::from(charset).chars().into_iter() {
assert!(!password.contains(char))
}
}
}
#[wasm_bindgen_test]
-fn generate_not_special_letters() {
- let upper_charset = "!@#$%^&*()+{}[]><:|+=;-.,'?_~\\/`\"";
+fn generate_no_special_letters() {
+ let charset = "!@#$%^&*()+{}[]><:|+=;-.,'?_~\\/`\"";
for x in 0..ATTEMPTS {
- let password = generate(x, true, true, true, false);
- for char in String::from(upper_charset).chars().into_iter() {
+ let password = generate(x, true, true, true, false, true);
+ for char in String::from(charset).chars().into_iter() {
+ assert!(!password.contains(char))
+ }
+ }
+}
+
+#[wasm_bindgen_test]
+fn generate_no_extended_letters() {
+ let charset = "®û´¢æ«æëàñîêáö½¬èñý¹áúóâªò×ä¸ÿ¦ù°º±¨åûïøí»§÷î¤ã¡òþ¿³óùçâüëíõôéðìö¶þ¾úý·êéãߣüèðµå¥õïà¼øäô©²¯çì";
+ for x in 0..ATTEMPTS {
+ let password = generate(x, true, true, true, true, false);
+ for char in String::from(charset).chars().into_iter() {
assert!(!password.contains(char))
}
}
@@ -65,12 +76,12 @@ fn generate_not_special_letters() {
#[wasm_bindgen_test]
fn generate_0_len() {
- let password = generate(0, true, true, true, true);
+ let password = generate(0, true, true, true, true, true);
assert_eq!(0, password.len())
}
#[wasm_bindgen_test]
fn generate_no_letters() {
- let password = generate(100, false, false, false, false);
+ let password = generate(100, false, false, false, false, true);
assert_eq!(0, password.len())
}