MCPcopy Create free account
hub / github.com/apache/datafusion / test_round_f64

Function test_round_f64

datafusion/functions/src/math/round.rs:778–794  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

776
777 #[test]
778 fn test_round_f64() {
779 let args: Vec<ArrayRef> = vec![
780 Arc::new(Float64Array::from(vec![125.2345; 10])), // input
781 Arc::new(Int64Array::from(vec![0, 1, 2, 3, 4, 5, -1, -2, -3, -4])), // decimal_places
782 ];
783
784 let result = round_arrays(Arc::clone(&args[0]), Some(Arc::clone(&args[1])))
785 .expect("failed to initialize function round");
786 let floats =
787 as_float64_array(&result).expect("failed to initialize function round");
788
789 let expected = Float64Array::from(vec![
790 125.0, 125.2, 125.23, 125.235, 125.2345, 125.2345, 130.0, 100.0, 0.0, 0.0,
791 ]);
792
793 assert_eq!(floats, &expected);
794 }
795
796 #[test]
797 fn test_round_f32_one_input() {

Callers

nothing calls this directly

Calls 2

round_arraysFunction · 0.85
as_float64_arrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…