An implementation of the Universal Chess Interface in Rust.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
extern crate uci;
|
|
|
|
|
|
|
|
use uci::Engine;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn instantiate_new_engine() {
|
|
|
|
let input = b"UNUSED";
|
|
|
|
let mut output = Vec::new();
|
|
|
|
|
|
|
|
let e = Engine::new("test_name", "test", &input[..], &mut output);
|
|
|
|
assert_eq!(e.name, "test_name");
|
|
|
|
assert_eq!(e.author, "test");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn send_indentification_data() {
|
|
|
|
let input = b"UNUSED";
|
|
|
|
let mut output = Vec::new();
|
|
|
|
|
|
|
|
// We need to scope this so that the mutable borrow ends and we can test it safely
|
|
|
|
{
|
|
|
|
let mut e = Engine::new("test_name", "test", &input[..], &mut output);
|
|
|
|
e.identify();
|
|
|
|
}
|
|
|
|
|
|
|
|
println!("HERE!!!!!!!");
|
|
|
|
println!("{:?}")
|
|
|
|
|
|
|
|
|
|
|
|
// To get this to play nicely the vector needs to be converted to utf-8 string(s) for comparison
|
|
|
|
|
|
|
|
//assert_eq!(output, [b"id name test_name\n", b"id author test\n"]);
|
|
|
|
}
|