use ares::cli::read_and_parse_file;
use ares::config::Config;
use ares::perform_cracking;
// TODO Below fails because Library API is broken.
// https://github.com/bee-san/Ares/issues/48
#[test]
fn test_it_works() {
// It will panic if it doesn't work!
// Plaintext is `Mutley, you snickering, floppy eared hound. When courage is needed, you’re never around. Those m... `
let config = Config::default();
perform_cracking("TXV0bGV5LCB5b3Ugc25pY2tlcmluZywgZmxvcHB5IGVhcmVkIGhvdW5kLiBXaGVuIGNvdXJhZ2UgaXMgbmVlZGVkLCB5b3XigJlyZSBuZXZlciBhcm91bmQuIFRob3NlIG1lZGFscyB5b3Ugd2VhciBvbiB5b3VyIG1vdGgtZWF0ZW4gY2hlc3Qgc2hvdWxkIGJlIHRoZXJlIGZvciBidW5nbGluZyBhdCB3aGljaCB5b3UgYXJlIGJlc3QuIFNvLCBzdG9wIHRoYXQgcGlnZW9uLCBzdG9wIHRoYXQgcGlnZW9uLCBzdG9wIHRoYXQgcGlnZW9uLCBzdG9wIHRoYXQgcGlnZW9uLCBzdG9wIHRoYXQgcGlnZW9uLCBzdG9wIHRoYXQgcGlnZW9uLCBzdG9wIHRoYXQgcGlnZW9uLiBIb3d3d3chIE5hYiBoaW0sIGphYiBoaW0sIHRhYiBoaW0sIGdyYWIgaGltLCBzdG9wIHRoYXQgcGlnZW9uIG5vdy4g", config);
assert_eq!(true, true);
}
#[test]
fn test_no_panic_if_empty_string() {
// It will panic if it doesn't work!
let config = Config::default();
perform_cracking("", config);
assert_eq!(true, true);
}
/*
#[test]
fn test_program_parses_files_and_cracks() {
// It should be able to open and crack this file
let file_path = "tests/test_fixtures/base64_3_times_with_no_new_line";
let config = Config::default();
let to_crack = read_and_parse_file(file_path.to_string());
let result = perform_cracking(&to_crack, config);
assert_eq!(true, true);
// The base64 string decodes to "VFoW2RHbHdiR1VndXMUdlbHBVV1RCSlIxWjFXVEk1YTJGWE5XNWpkejA5"
let result = result.unwrap();
assert!(
!result.text.is_empty(),
"Decoding should produce some result"
);
}
*/
/*
#[test]
#[ignore]
fn test_program_parses_files_with_new_line_and_cracks() {
// It should be able to open and crack this file
let file_path = "tests/test_fixtures/rot13_base64_hex_with_newline";
let config = Config::default();
let to_crack = read_and_parse_file(file_path.to_string());
let result = perform_cracking(&to_crack, config);
assert_eq!(true, true);
assert!(result.unwrap().text[0] == "This is a test!");
}
*/