73 lines
2.2 KiB
Rust
73 lines
2.2 KiB
Rust
//! TDD tests for rtx-science imports
|
|
//! These tests define expected behavior for importing science types and dependencies
|
|
|
|
use rtx_tensor::{Device, Result, Tensor};
|
|
|
|
#[test]
|
|
fn test_device_import_works() {
|
|
// Test that Device can be imported and used
|
|
let device = Device::default();
|
|
|
|
// Device should have basic functionality
|
|
match device {
|
|
Device::Cpu => assert!(true),
|
|
_ => assert!(true), // Other devices also valid
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn test_tensor_operations_available() {
|
|
// Test that basic tensor operations work
|
|
let device = Device::default();
|
|
let tensor_result = Tensor::zeros(&[2, 2], &device);
|
|
|
|
assert!(tensor_result.is_ok());
|
|
let tensor = tensor_result.unwrap();
|
|
|
|
// Should be able to perform basic operations
|
|
let clone_result = tensor.clone();
|
|
assert_eq!(tensor.shape(), clone_result.shape());
|
|
}
|
|
|
|
#[test]
|
|
fn test_optimization_level_available() {
|
|
// Test that OptimizationLevel type is available for cusolver
|
|
// This should be importable from rtx-tensor or science modules
|
|
|
|
// For now, just test that we can define what we expect
|
|
#[derive(Debug, Clone)]
|
|
enum ExpectedOptimizationLevel {
|
|
Fast,
|
|
Balanced,
|
|
Accurate,
|
|
}
|
|
|
|
let level = ExpectedOptimizationLevel::Balanced;
|
|
assert!(matches!(level, ExpectedOptimizationLevel::Balanced));
|
|
}
|
|
|
|
#[test]
|
|
fn test_physics_training_compiles() {
|
|
// Test that physics training modules can access required types
|
|
// This is a integration test to ensure dependencies are correct
|
|
|
|
// Device should be accessible for physics training
|
|
let device = Device::default();
|
|
let _tensor = Tensor::zeros(&[10, 10], &device).expect("Should create tensor for physics");
|
|
|
|
// This test passes if the required dependencies are properly imported
|
|
assert!(true);
|
|
}
|
|
|
|
#[test]
|
|
fn test_cusolver_enhanced_compiles() {
|
|
// Test that cusolver enhanced modules can access required types
|
|
// This validates that mathematical optimization types are available
|
|
|
|
let device = Device::default();
|
|
let _matrix = Tensor::zeros(&[5, 5], &device).expect("Should create matrix for cusolver");
|
|
|
|
// This test passes if cusolver dependencies are properly set up
|
|
assert!(true);
|
|
}
|