Complete set 1 challenge 1.

This commit is contained in:
2022-03-24 23:16:17 -04:00
parent 6c0d77ec36
commit fcf882991c
2 changed files with 79 additions and 5 deletions

View File

@@ -1,8 +1,20 @@
mod set1;
use crate::set1::convert_hex_to_base64;
use crate::set1::{base64_to_string, bytes_to_base64, to_bytes};
fn test_set1() {
let input = to_bytes("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d");
let expected = String::from("SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t");
match input {
Ok(bytes) => {
let output = base64_to_string(bytes_to_base64(bytes));
assert_eq!(output, expected);
println!("{:?}", output);
}
Err(e) => println!("Error: {:?}", e),
};
}
fn main() {
println!("Hello, world! Does it work?");
convert_hex_to_base64();
test_set1();
}