use crate::cli::*;
#[test]
fn test_format_size_zero() {
let result = format_size(0);
assert!(result.contains("0") || result.contains("B"));
}
#[test]
fn test_format_size_bytes() {
let result = format_size(500);
assert!(result.contains("500") || result.contains("B"));
}
#[test]
fn test_format_size_kilobytes() {
let result = format_size(1024);
assert!(result.contains("KB") || result.contains("1"));
}
#[test]
fn test_format_size_megabytes() {
let result = format_size(1024 * 1024);
assert!(result.contains("MB") || result.contains("1"));
}
#[test]
fn test_format_size_gigabytes() {
let result = format_size(1024 * 1024 * 1024);
assert!(result.contains("GB") || result.contains("1"));
}
#[test]
fn test_format_size_terabytes() {
let result = format_size(1024 * 1024 * 1024 * 1024);
assert!(result.contains("TB") || result.contains("1"));
}
#[test]
fn test_format_size_fractional_kb() {
let result = format_size(1536); assert!(!result.is_empty());
}
#[test]
fn test_format_size_fractional_mb() {
let result = format_size(1024 * 1024 + 512 * 1024); assert!(!result.is_empty());
}
#[test]
fn test_format_size_large() {
let result = format_size(u64::MAX / 2);
assert!(!result.is_empty());
}
#[test]
fn test_is_local_path_absolute() {
assert!(is_local_file_path("/path/to/model.gguf"));
}
#[test]
fn test_is_local_path_relative() {
assert!(is_local_file_path("./model.gguf"));
}
#[test]
fn test_is_local_path_relative_parent() {
assert!(is_local_file_path("../model.gguf"));
}
#[test]
fn test_is_local_path_home() {
assert!(is_local_file_path("~/models/model.gguf"));
}
#[test]
fn test_is_local_path_http_with_extension() {
assert!(is_local_file_path("http://example.com/model.gguf"));
}
#[test]
fn test_is_local_path_https_with_extension() {
assert!(is_local_file_path("https://example.com/model.gguf"));
}
#[test]
fn test_is_local_path_hf_registry() {
assert!(!is_local_file_path("hf://username/model"));
}
#[test]
fn test_is_local_path_ollama_registry() {
assert!(!is_local_file_path("ollama://model:tag"));
}
#[test]
fn test_is_local_path_registry_prefix() {
assert!(!is_local_file_path("registry://some/model"));
}
#[test]
fn test_is_local_path_bare_name() {
let result = is_local_file_path("model-name");
assert!(!result); }
#[test]
fn test_is_local_path_with_spaces() {
assert!(is_local_file_path("/path/to/my model.gguf"));
}
#[test]
fn test_is_local_path_empty() {
assert!(!is_local_file_path(""));
}
#[test]
fn test_is_local_path_safetensors_extension() {
assert!(is_local_file_path("model.safetensors"));
}
#[test]
fn test_is_local_path_apr_extension() {
assert!(is_local_file_path("model.apr"));
}
#[test]
fn test_is_local_path_just_slash() {
assert!(is_local_file_path("/"));
}
#[test]
fn test_is_local_path_just_dotslash() {
assert!(is_local_file_path("./"));
}
#[test]
fn test_validate_suite_tensor_ops() {
assert!(validate_suite_name("tensor_ops"));
}
#[test]
fn test_validate_suite_inference() {
assert!(validate_suite_name("inference"));
}
#[test]
fn test_validate_suite_cache() {
assert!(validate_suite_name("cache"));
}
#[test]
fn test_validate_suite_tokenizer() {
assert!(validate_suite_name("tokenizer"));
}
#[test]
fn test_validate_suite_quantize() {
assert!(validate_suite_name("quantize"));
}
#[test]
fn test_validate_suite_lambda() {
assert!(validate_suite_name("lambda"));
}
#[test]
fn test_validate_suite_comparative() {
assert!(validate_suite_name("comparative"));
}
#[test]
fn test_validate_suite_invalid_random() {
assert!(!validate_suite_name("random_suite"));
}
#[test]
fn test_validate_suite_invalid_space() {
assert!(!validate_suite_name("my test"));
}
#[test]
fn test_validate_suite_invalid_similar() {
assert!(!validate_suite_name("tensor"));
}
#[test]
fn test_validate_suite_empty() {
assert!(!validate_suite_name(""));
}
#[test]
fn test_validate_suite_case_sensitive() {
assert!(!validate_suite_name("TENSOR_OPS"));
}
#[test]
fn test_validate_suite_with_extra_chars() {
assert!(!validate_suite_name("tensor_ops!"));
}
#[test]
fn test_validate_suite_unicode() {
assert!(!validate_suite_name("тест"));
}
#[test]
fn test_display_model_info_empty_data() {
let result = display_model_info("test.gguf", &[]);
assert!(result.is_err());
}
#[test]
fn test_display_model_info_invalid_magic() {
let data = vec![0u8; 100];
let result = display_model_info("test.gguf", &data);
assert!(result.is_err());
}
#[test]
fn test_display_model_info_truncated() {
let data = vec![0x47, 0x47, 0x55, 0x46]; let result = display_model_info("test.gguf", &data);
assert!(result.is_err());
}
#[test]
fn test_display_model_info_unknown_extension() {
let data = vec![0u8; 100];
let result = display_model_info("test.unknown", &data);
assert!(result.is_err() || result.is_ok());
}
#[test]
fn test_load_gguf_empty() {
let result = load_gguf_model(&[]);
assert!(result.is_err());
}
#[test]
fn test_load_gguf_invalid_magic() {
let data = vec![0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
let result = load_gguf_model(&data);
assert!(result.is_err());
}
#[test]
fn test_load_gguf_truncated_header() {
let data = vec![0x47, 0x47, 0x55, 0x46, 0x03, 0x00, 0x00, 0x00];
let result = load_gguf_model(&data);
assert!(result.is_err());
}
#[test]
fn test_load_safetensors_empty() {
let result = load_safetensors_model(&[]);
assert!(result.is_err());
}
#[test]
fn test_load_safetensors_invalid_json() {
let mut data = vec![0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; data.extend(b"not valid json!!"); let result = load_safetensors_model(&data);
assert!(result.is_err());
}
#[test]
fn test_load_safetensors_truncated() {
let data = vec![0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
let result = load_safetensors_model(&data);
assert!(result.is_err());
}
#[test]
fn test_load_apr_empty() {
let result = load_apr_model(&[]);
assert!(result.is_err());
}
#[test]
fn test_load_apr_invalid_magic() {
let data = vec![0x00, 0x00, 0x00, 0x00];
let result = load_apr_model(&data);
assert!(result.is_err());
}
#[test]
fn test_load_apr_truncated() {
let data = b"APR\x00".to_vec();
let result = load_apr_model(&data);
assert!(result.is_err());
}
#[test]
fn test_bench_compare_nonexistent_file1() {
let result = run_bench_compare("/nonexistent/file1.json", "/nonexistent/file2.json", 0.1);
assert!(result.is_err());
}
#[test]
fn test_bench_compare_invalid_threshold_low() {
let result = run_bench_compare("/nonexistent/a.json", "/nonexistent/b.json", -1.0);
assert!(result.is_err());
}
#[test]
fn test_bench_compare_invalid_threshold_high() {
let result = run_bench_compare("/nonexistent/a.json", "/nonexistent/b.json", 1000.0);
assert!(result.is_err());
}
#[test]
fn test_bench_regression_nonexistent_baseline() {
let result = run_bench_regression(
"/nonexistent/baseline.json",
"/nonexistent/current.json",
false, );
assert!(result.is_err());
}
#[test]
fn test_bench_regression_strict_mode() {
let result = run_bench_regression(
"/nonexistent/baseline.json",
"/nonexistent/current.json",
true, );
assert!(result.is_err());
}
#[test]
fn test_home_dir_returns_some() {
let result = home_dir();
let _ = result;
}
#[test]
fn test_print_info_no_panic() {
print_info();
}
#[test]
fn test_cli_default_verbose() {
use clap::Parser;
let result = Cli::try_parse_from(["realizar", "--help"]);
assert!(result.is_err());
}
#[test]
fn test_format_size_exact_boundaries() {
let kb = format_size(1024);
assert!(!kb.is_empty());
let mb = format_size(1024 * 1024);
assert!(!mb.is_empty());
let gb = format_size(1024 * 1024 * 1024);
assert!(!gb.is_empty());
}
#[test]
fn test_is_local_path_windows_style() {
let result = is_local_file_path("C:\\path\\to\\model.gguf");
let _ = result;
}
#[test]
fn test_validate_suite_long_name() {
let long_name = "a".repeat(256);
let result = validate_suite_name(&long_name);
let _ = result;
}