- use super::*;
-
- const TEST_DATA: &[(&str, &[u8])] = &[
- ("", &[]),
- ("yy", &[0x00]),
- ("oy", &[0x80]),
- ("tqrey", &[0x8b, 0x88, 0x80]),
- ("6n9hq", &[0xf0, 0xbf, 0xc7]),
- ("4t7ye", &[0xd4, 0x7a, 0x04]),
- ("6im5sdy", &[0xf5, 0x57, 0xbb, 0x0c]),
- ("ybndrfg8ejkmcpqxot1uwisza345h769", &[0x00, 0x44, 0x32, 0x14, 0xc7, 0x42, 0x54, 0xb6,
- 0x35, 0xcf, 0x84, 0x65, 0x3a, 0x56, 0xd7, 0xc6,
- 0x75, 0xbe, 0x77, 0xdf])
- ];
-
-
- #[test]
- fn test_encode() {
- for &(zbase32, data) in TEST_DATA {
- assert_eq!(encode(data), zbase32);
- }
- }
-
- #[test]
- fn test_decode() {
- for &(zbase32, data) in TEST_DATA {
- assert_eq!(decode(zbase32).unwrap(), data);
- }
- }
-
- #[test]
- fn test_decode_wrong() {
- const WRONG_DATA: &[&str] = &["00", "l1", "?", "="];
-
- for &data in WRONG_DATA {
- match decode(data) {
- Ok(_) => assert!(false, "Data shouldn't be decodable"),
- Err(_) => assert!(true),
- }
- }
- }
+ use super::*;
+
+ const TEST_DATA: &[(&str, &[u8])] = &[
+ ("", &[]),
+ ("yy", &[0x00]),
+ ("oy", &[0x80]),
+ ("tqrey", &[0x8b, 0x88, 0x80]),
+ ("6n9hq", &[0xf0, 0xbf, 0xc7]),
+ ("4t7ye", &[0xd4, 0x7a, 0x04]),
+ ("6im5sdy", &[0xf5, 0x57, 0xbb, 0x0c]),
+ ("ybndrfg8ejkmcpqxot1uwisza345h769", &[0x00, 0x44, 0x32, 0x14, 0xc7, 0x42, 0x54, 0xb6,
+ 0x35, 0xcf, 0x84, 0x65, 0x3a, 0x56, 0xd7, 0xc6,
+ 0x75, 0xbe, 0x77, 0xdf])
+ ];
+
+ #[test]
+ fn test_encode() {
+ for &(zbase32, data) in TEST_DATA {
+ assert_eq!(encode(data), zbase32);
+ }
+ }
+
+ #[test]
+ fn test_decode() {
+ for &(zbase32, data) in TEST_DATA {
+ assert_eq!(decode(zbase32).unwrap(), data);
+ }
+ }
+
+ #[test]
+ fn test_decode_wrong() {
+ const WRONG_DATA: &[&str] = &["00", "l1", "?", "="];
+
+ for &data in WRONG_DATA {
+ match decode(data) {
+ Ok(_) => assert!(false, "Data shouldn't be decodable"),
+ Err(_) => assert!(true),
+ }
+ }
+ }