41 lines
1.1 KiB
Rust
41 lines
1.1 KiB
Rust
use rustytorch_ml::error;
|
|
use rustytorch_ml::utils;
|
|
|
|
#[test]
|
|
fn test_crate_structure() {
|
|
// Test that the main modules compile and export properly
|
|
// This is a basic smoke test to ensure our structure is correct
|
|
|
|
// These should compile without error if our exports are correct
|
|
let _ = error::SklearnError::NotFitted;
|
|
|
|
// Test that utility functions are accessible
|
|
assert!(true); // Placeholder assertion
|
|
}
|
|
|
|
#[test]
|
|
fn test_device_config() {
|
|
let cpu_config = utils::DeviceConfig::new("cpu").unwrap();
|
|
assert!(!cpu_config.is_gpu());
|
|
assert_eq!(cpu_config.to_string(), "cpu");
|
|
|
|
let gpu_config = utils::DeviceConfig::new("cuda:0").unwrap();
|
|
assert!(gpu_config.is_gpu());
|
|
assert_eq!(gpu_config.to_string(), "cuda:0");
|
|
}
|
|
|
|
#[test]
|
|
fn test_error_types() {
|
|
let error = error::SklearnError::NotFitted;
|
|
assert!(matches!(error, error::SklearnError::NotFitted));
|
|
|
|
// Test InvalidParameter error variant
|
|
let param_error = error::SklearnError::InvalidParameter {
|
|
message: "test error".to_string(),
|
|
};
|
|
assert!(matches!(
|
|
param_error,
|
|
error::SklearnError::InvalidParameter { .. }
|
|
));
|
|
}
|