Browse Source

Test in place for engine option string

ag-yep
Taylor Bockman 7 years ago
parent
commit
7c5c3338cd
  1. 2
      src/options.rs
  2. 22
      tests/lib.rs

2
src/options.rs

@ -94,6 +94,8 @@ impl EngineOption {
// TODO: This should be tested in isolation as well // TODO: This should be tested in isolation as well
// This should handle the case where optional min max var are specified as well. // This should handle the case where optional min max var are specified as well.
// pattern match the engine option type and convert it to the correct string. // pattern match the engine option type and convert it to the correct string.
// EVERYTHING SHOULD BE TRIVIALLY CASTABLE INTO A STRING
// NO MATCHING NEEDED....PROBABLY
format!("PUT THE FULL COMMAND STRING HERE!") format!("PUT THE FULL COMMAND STRING HERE!")
} }
} }

22
tests/lib.rs

@ -49,7 +49,7 @@ fn send_readyok() {
#[test] #[test]
fn engine_option_equality() { fn engine_option_equality() {
let name = constants::HASH; let name = constants::HASH;
let option_type = EngineOptionType::Check; let option_type = EngineOptionType::Spin;
let option_data1 = let option_data1 =
[(EngineOptionDataType::DefaultVal, EngineOptionData::Int(1)), [(EngineOptionDataType::DefaultVal, EngineOptionData::Int(1)),
(EngineOptionDataType::Min, EngineOptionData::Int(1)), (EngineOptionDataType::Min, EngineOptionData::Int(1)),
@ -75,3 +75,23 @@ fn engine_option_equality() {
assert_eq!(o1, o2); assert_eq!(o1, o2);
} }
#[test]
fn engine_option_string() {
let name = constants::HASH;
let option_type = EngineOptionType::Spin;
let option_data =
[(EngineOptionDataType::DefaultVal, EngineOptionData::Int(1)),
(EngineOptionDataType::Min, EngineOptionData::Int(1)),
(EngineOptionDataType::Max, EngineOptionData::Int(128))
].iter().cloned().collect();
let o = EngineOption {
name: name,
option_type: option_type,
option_data: option_data1,
};
let expected = "option name hash type spin default 1 min 1 max 128";
assert_eq!(o.option_string(), expected);
}

Loading…
Cancel
Save