chromium_base64_rs/
lib.rs1pub mod encode;
10pub mod decode;
11
12
13
14
15
16
17
18#[cfg(test)]
19mod tests {
20 use crate::{encode::base64_encode_to_string, decode::base64_decode_to_string};
21
22 #[test]
23 fn encoding_test() {
24 let result = base64_encode_to_string(b"Hello World!");
25 assert_eq!(result, "SGVsbG8gV29ybGQh");
26
27 let result = base64_encode_to_string("1234567890987654321{}/[;\',.".as_bytes());
28 assert_eq!(result, "MTIzNDU2Nzg5MDk4NzY1NDMyMXt9L1s7Jywu");
29 }
30
31 #[test]
32 fn decoding_test() {
33 let result = base64_decode_to_string(b"SGVsbG8gV29ybGQh");
34 assert_eq!(result, "Hello World!");
35
36 let result = base64_decode_to_string(b"MTIzNDU2Nzg5MDk4NzY1NDMyMXt9L1s7Jywu");
37 assert_eq!(result, "1234567890987654321{}/[;\',.")
38 }
39}