//! TDD tests for Variable type methods //! These tests define expected behavior for Variable operations use rtx_science::types::Variable; use rtx_tensor::{Device, Tensor}; #[test] fn test_variable_value_method() { // Variable should have a value() method to get the underlying tensor let device = Device::cpu(); let tensor = Tensor::zeros(&[2, 3], &device).unwrap(); let variable = Variable::from_tensor(tensor.clone()); // Should be able to get the value let value = variable.value(); assert_eq!(value.shape().dims(), &[2, 3]); } #[test] fn test_variable_multiply_scalar() { // Variable should support scalar multiplication let device = Device::cpu(); let tensor = Tensor::ones(&[2, 3], &device).unwrap(); let variable = Variable::from_tensor(tensor); // Should be able to multiply by scalar let result = variable.multiply_scalar(2.0).unwrap(); assert!(result.value().shape().dims() == &[2, 3]); } #[test] fn test_variable_mean_square() { // Variable should have mean_square method for MSE loss let device = Device::cpu(); let tensor = Tensor::ones(&[2, 3], &device).unwrap(); let variable = Variable::from_tensor(tensor); // Should compute mean of squared values let mse = variable.mean_square().unwrap(); assert!(true); // Placeholder check }