From c28ad445a2fa4116157d2c8da759984eaa59ad51 Mon Sep 17 00:00:00 2001 From: Abinand P Date: Sun, 20 Oct 2024 10:01:19 +0530 Subject: [PATCH] fix: trying to remove the scripts from git diff Signed-off-by: Abinand P --- crates/proof-of-sql/src/base/math/decimal.rs | 112 ++++++++----------- scripts/run_ci_checks.sh | 2 +- 2 files changed, 49 insertions(+), 65 deletions(-) diff --git a/crates/proof-of-sql/src/base/math/decimal.rs b/crates/proof-of-sql/src/base/math/decimal.rs index ca2280db3..c1dff7545 100644 --- a/crates/proof-of-sql/src/base/math/decimal.rs +++ b/crates/proof-of-sql/src/base/math/decimal.rs @@ -181,14 +181,12 @@ mod scale_adjust_test { let target_scale = 5; - assert!( - try_convert_intermediate_decimal_to_scalar::( - &decimal, - Precision::new(u8::try_from(decimal.precision()).unwrap_or(u8::MAX)).unwrap(), - target_scale - ) - .is_err() - ); + assert!(try_convert_intermediate_decimal_to_scalar::( + &decimal, + Precision::new(u8::try_from(decimal.precision()).unwrap_or(u8::MAX)).unwrap(), + target_scale + ) + .is_err()); } #[test] @@ -254,14 +252,12 @@ mod scale_adjust_test { .parse() .unwrap(); let target_scale = 6; // now precision exceeds maximum - assert!( - try_convert_intermediate_decimal_to_scalar::( - &decimal, - Precision::new(u8::try_from(decimal.precision()).unwrap_or(u8::MAX),).unwrap(), - target_scale - ) - .is_err() - ); + assert!(try_convert_intermediate_decimal_to_scalar::( + &decimal, + Precision::new(u8::try_from(decimal.precision()).unwrap_or(u8::MAX),).unwrap(), + target_scale + ) + .is_err()); // maximum decimal value we can support let decimal = @@ -269,14 +265,12 @@ mod scale_adjust_test { .parse() .unwrap(); let target_scale = 1; - assert!( - try_convert_intermediate_decimal_to_scalar::( - &decimal, - Precision::new(MAX_SUPPORTED_PRECISION).unwrap(), - target_scale - ) - .is_ok() - ); + assert!(try_convert_intermediate_decimal_to_scalar::( + &decimal, + Precision::new(MAX_SUPPORTED_PRECISION).unwrap(), + target_scale + ) + .is_ok()); // scaling larger than max will fail let decimal = @@ -284,14 +278,12 @@ mod scale_adjust_test { .parse() .unwrap(); let target_scale = 1; - assert!( - try_convert_intermediate_decimal_to_scalar::( - &decimal, - Precision::new(MAX_SUPPORTED_PRECISION).unwrap(), - target_scale - ) - .is_err() - ); + assert!(try_convert_intermediate_decimal_to_scalar::( + &decimal, + Precision::new(MAX_SUPPORTED_PRECISION).unwrap(), + target_scale + ) + .is_err()); // smallest possible decimal value we can support (either signed/unsigned) let decimal = @@ -299,49 +291,41 @@ mod scale_adjust_test { .parse() .unwrap(); let target_scale = MAX_SUPPORTED_PRECISION as i8; - assert!( - try_convert_intermediate_decimal_to_scalar::( - &decimal, - Precision::new(u8::try_from(decimal.precision()).unwrap_or(u8::MAX),).unwrap(), - target_scale - ) - .is_ok() - ); + assert!(try_convert_intermediate_decimal_to_scalar::( + &decimal, + Precision::new(u8::try_from(decimal.precision()).unwrap_or(u8::MAX),).unwrap(), + target_scale + ) + .is_ok()); // this is ok because it can be scaled to 75 precision let decimal = "0.1".parse().unwrap(); let target_scale = MAX_SUPPORTED_PRECISION as i8; - assert!( - try_convert_intermediate_decimal_to_scalar::( - &decimal, - Precision::new(MAX_SUPPORTED_PRECISION).unwrap(), - target_scale - ) - .is_ok() - ); + assert!(try_convert_intermediate_decimal_to_scalar::( + &decimal, + Precision::new(MAX_SUPPORTED_PRECISION).unwrap(), + target_scale + ) + .is_ok()); // this exceeds max precision let decimal = "1.0".parse().unwrap(); let target_scale = 75; - assert!( - try_convert_intermediate_decimal_to_scalar::( - &decimal, - Precision::new(u8::try_from(decimal.precision()).unwrap_or(u8::MAX),).unwrap(), - target_scale - ) - .is_err() - ); + assert!(try_convert_intermediate_decimal_to_scalar::( + &decimal, + Precision::new(u8::try_from(decimal.precision()).unwrap_or(u8::MAX),).unwrap(), + target_scale + ) + .is_err()); // but this is ok let decimal = "1.0".parse().unwrap(); let target_scale = 74; - assert!( - try_convert_intermediate_decimal_to_scalar::( - &decimal, - Precision::new(MAX_SUPPORTED_PRECISION).unwrap(), - target_scale - ) - .is_ok() - ); + assert!(try_convert_intermediate_decimal_to_scalar::( + &decimal, + Precision::new(MAX_SUPPORTED_PRECISION).unwrap(), + target_scale + ) + .is_ok()); } } diff --git a/scripts/run_ci_checks.sh b/scripts/run_ci_checks.sh index 6d1db5c35..434508366 100755 --- a/scripts/run_ci_checks.sh +++ b/scripts/run_ci_checks.sh @@ -60,4 +60,4 @@ if [ "$failed_tests" -gt 0 ]; then echo "Error: $failed_tests CI checks (excluding tests and udeps) have FAILED." else echo "All CI checks (excluding tests and udeps) have completed successfully." -fi \ No newline at end of file +fi