use rtx_preprocessing::error::PreprocessingError; #[test] fn test_invalid_shape_error() { let err = PreprocessingError::InvalidShape { message: "Shape [2, 3] is invalid for this operation".to_string(), }; let err_msg = err.to_string(); assert!(err_msg.contains("Invalid shape")); assert!(err_msg.contains("[2, 3]")); } #[test] fn test_shape_mismatch_error() { let err = PreprocessingError::ShapeMismatch { expected: vec![10, 20], actual: vec![10, 30], }; let err_msg = err.to_string(); assert!(err_msg.contains("Shape mismatch")); assert!(err_msg.contains("[10, 20]")); assert!(err_msg.contains("[10, 30]")); } #[test] fn test_dimension_mismatch_error() { let err = PreprocessingError::DimensionMismatch { expected: 3, actual: 2, }; let err_msg = err.to_string(); assert!(err_msg.contains("Dimension mismatch")); assert!(err_msg.contains("3")); assert!(err_msg.contains("2")); } #[test] fn test_error_conversion_from_tensor() { // Test that TensorError can be converted to PreprocessingError let tensor_err = rtx_tensor::TensorError::shape("Shape mismatch: expected [1, 2], got [2, 1]"); let preprocessing_err: PreprocessingError = tensor_err.into(); assert!(matches!(preprocessing_err, PreprocessingError::Tensor(_))); }