diff --git a/src/options.rs b/src/options.rs index 56c63bc..e4df90a 100644 --- a/src/options.rs +++ b/src/options.rs @@ -94,6 +94,8 @@ impl EngineOption { // TODO: This should be tested in isolation 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. + // EVERYTHING SHOULD BE TRIVIALLY CASTABLE INTO A STRING + // NO MATCHING NEEDED....PROBABLY format!("PUT THE FULL COMMAND STRING HERE!") } } diff --git a/tests/lib.rs b/tests/lib.rs index 8e8104d..200ab29 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -49,7 +49,7 @@ fn send_readyok() { #[test] fn engine_option_equality() { let name = constants::HASH; - let option_type = EngineOptionType::Check; + let option_type = EngineOptionType::Spin; let option_data1 = [(EngineOptionDataType::DefaultVal, EngineOptionData::Int(1)), (EngineOptionDataType::Min, EngineOptionData::Int(1)), @@ -75,3 +75,23 @@ fn engine_option_equality() { 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); +}