()
| 332 | |
| 333 | #[test] |
| 334 | fn test_cot_scalar_pi() { |
| 335 | let arg_fields = vec![Field::new("a", DataType::Float64, false).into()]; |
| 336 | let args = ScalarFunctionArgs { |
| 337 | args: vec![ColumnarValue::Scalar(ScalarValue::Float64(Some( |
| 338 | std::f64::consts::PI, |
| 339 | )))], |
| 340 | arg_fields, |
| 341 | number_rows: 1, |
| 342 | return_field: Field::new("f", DataType::Float64, false).into(), |
| 343 | config_options: Arc::new(ConfigOptions::default()), |
| 344 | }; |
| 345 | let result = CotFunc::new() |
| 346 | .invoke_with_args(args) |
| 347 | .expect("cot pi should succeed"); |
| 348 | |
| 349 | match result { |
| 350 | ColumnarValue::Scalar(ScalarValue::Float64(Some(v))) => { |
| 351 | // cot(PI) = 1/tan(PI) - very large negative number due to floating point |
| 352 | let expected = 1.0_f64 / std::f64::consts::PI.tan(); |
| 353 | assert!((v - expected).abs() < 1e-6); |
| 354 | } |
| 355 | _ => panic!("Expected Float64 scalar"), |
| 356 | } |
| 357 | } |
| 358 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…