From 82e3c779a04a3a6cfd8472bc29fc26b558ad75d6 Mon Sep 17 00:00:00 2001 From: AlessandroBregoli Date: Tue, 29 Mar 2022 16:03:27 +0200 Subject: [PATCH] Added test: test_validate_params_valid_cim_with_huge_values --- tests/params.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/params.rs b/tests/params.rs index 9bc9b49..cbc7636 100644 --- a/tests/params.rs +++ b/tests/params.rs @@ -69,6 +69,14 @@ fn test_validate_params_valid_cim() { assert_eq!(Ok(()), param.validate_params()); } +#[test] +fn test_validate_params_valid_cim_with_huge_values() { + let mut param = utils::generate_discrete_time_continous_param(3); + let cim = array![[[-2e10, 1e10, 1e10], [1.5e10, -3e10, 1.5e10], [1e10, 1e10, -2e10]]]; + let result = param.set_cim(cim); + assert_eq!(Ok(()), result); +} + #[test] fn test_validate_params_cim_not_initialized() { let param = utils::generate_discrete_time_continous_param(3); @@ -80,7 +88,6 @@ fn test_validate_params_cim_not_initialized() { ); } - #[test] fn test_validate_params_wrong_shape() { let mut param = utils::generate_discrete_time_continous_param(4); @@ -88,13 +95,12 @@ fn test_validate_params_wrong_shape() { let result = param.set_cim(cim); assert_eq!( Err(ParamsError::InvalidCIM(String::from( - "Incompatible shape [1, 3, 3] with domain 4" - ))), + "Incompatible shape [1, 3, 3] with domain 4" + ))), result ); } - #[test] fn test_validate_params_positive_diag() { let mut param = utils::generate_discrete_time_continous_param(3); @@ -102,13 +108,12 @@ fn test_validate_params_positive_diag() { let result = param.set_cim(cim); assert_eq!( Err(ParamsError::InvalidCIM(String::from( - "The diagonal of each cim must be non-positive", - ))), + "The diagonal of each cim must be non-positive", + ))), result ); } - #[test] fn test_validate_params_row_not_sum_to_zero() { let mut param = utils::generate_discrete_time_continous_param(3); @@ -117,7 +122,7 @@ fn test_validate_params_row_not_sum_to_zero() { assert_eq!( Err(ParamsError::InvalidCIM(String::from( "The sum of each row must be 0" - ))), + ))), result ); }