blob: c9f6c00dd5300183b9590bf4d81b69f7e2133c52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
extern crate fatcat;
extern crate uuid;
use fatcat::api_helpers::{fcid2uuid, uuid2fcid};
use uuid::Uuid;
#[test]
fn test_fcid_conversions() {
let test_uuid = Uuid::parse_str("86daea5b-1b6b-432a-bb67-ea97795f80fe").unwrap();
let test_fcid = "q3nouwy3nnbsvo3h5klxsx4a7y";
assert_eq!(test_fcid, uuid2fcid(&test_uuid));
assert_eq!(test_uuid, fcid2uuid(test_fcid).unwrap());
assert_eq!(test_uuid, fcid2uuid(&test_fcid.to_uppercase()).unwrap());
assert_eq!(test_uuid, fcid2uuid(&uuid2fcid(&test_uuid)).unwrap());
assert_eq!(false, fcid2uuid("asdf").is_ok());
assert_eq!(false, fcid2uuid("q3nouwy3nnbsvo3h5klx").is_ok());
assert_eq!(false, fcid2uuid("10Oouwy3nnbsvo3h5klxsx4a7y").is_ok());
}
|