use automl::utils::display::{
debug_option, print_knn_search_algorithm, print_knn_weight_function, print_option,
};
use smartcore::algorithm::neighbour::KNNAlgorithmName;
use smartcore::neighbors::KNNWeightFunction;
#[test]
fn print_option_returns_value_for_some() {
let value = Some(10);
let output = print_option(value);
assert_eq!(output, "10");
}
#[test]
fn print_option_returns_none_for_none() {
let value: Option<i32> = None;
let output = print_option(value);
assert_eq!(output, "None");
}
#[test]
fn debug_option_formats_value() {
let value = Some(42);
let output = debug_option(value);
assert_eq!(output, "42");
}
#[test]
fn debug_option_formats_complex_value() {
let value = Some(vec![1, 2]);
let output = debug_option(value);
assert_eq!(output, "[\n 1,\n 2,\n]");
}
#[test]
fn debug_option_formats_none() {
let value: Option<i32> = None;
let output = debug_option(value);
assert_eq!(output, "None");
}
#[test]
fn print_knn_weight_function_uniform() {
let weight = KNNWeightFunction::Uniform;
let output = print_knn_weight_function(&weight);
assert_eq!(output, "Uniform");
}
#[test]
fn print_knn_weight_function_distance() {
let weight = KNNWeightFunction::Distance;
let output = print_knn_weight_function(&weight);
assert_eq!(output, "Distance");
}
#[test]
fn print_knn_search_algorithm_linear_search() {
let algorithm = KNNAlgorithmName::LinearSearch;
let output = print_knn_search_algorithm(&algorithm);
assert_eq!(output, "Linear Search");
}
#[test]
fn print_knn_search_algorithm_cover_tree() {
let algorithm = KNNAlgorithmName::CoverTree;
let output = print_knn_search_algorithm(&algorithm);
assert_eq!(output, "Cover Tree");
}