| 1 | use debugid::CodeId; |
| 2 | |
| 3 | #[test] |
| 4 | fn test_new() { |
| 5 | let id = CodeId::new("dfb8e43af2423d73a453aeb6a777ef75".into()); |
| 6 | assert_eq!(id.as_str(), "dfb8e43af2423d73a453aeb6a777ef75"); |
| 7 | } |
| 8 | |
| 9 | #[test] |
| 10 | fn test_pe() { |
| 11 | // Code identifiers of PE files might have an odd length and contain upper case characters. |
| 12 | let id = CodeId::new("5CCC38584b08000".into()); |
| 13 | assert_eq!(id.as_str(), "5ccc38584b08000"); |
| 14 | } |
| 15 | |
| 16 | #[test] |
| 17 | fn test_from_binary() { |
| 18 | let binary = b"\xdf\xb8\xe4\x3a\xf2\x42\x3d\x73\xa4\x53\xae\xb6\xa7\x77\xef\x75"; |
| 19 | let id = CodeId::from_binary(&binary[..]); |
| 20 | assert_eq!(id.as_str(), "dfb8e43af2423d73a453aeb6a777ef75"); |
| 21 | } |
| 22 | |
| 23 | #[test] |
| 24 | fn test_is_nil() { |
| 25 | let id = CodeId::nil(); |
| 26 | assert!(id.is_nil()); |
| 27 | } |