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

Function test_round_f32

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

Source from the content-addressed store, hash-verified

757
758 #[test]
759 fn test_round_f32() {
760 let args: Vec<ArrayRef> = vec![
761 Arc::new(Float32Array::from(vec![125.2345; 10])), // input
762 Arc::new(Int64Array::from(vec![0, 1, 2, 3, 4, 5, -1, -2, -3, -4])), // decimal_places
763 ];
764
765 let result = round_arrays(Arc::clone(&args[0]), Some(Arc::clone(&args[1])))
766 .expect("failed to initialize function round");
767 let floats =
768 as_float32_array(&result).expect("failed to initialize function round");
769
770 let expected = Float32Array::from(vec![
771 125.0, 125.2, 125.23, 125.235, 125.2345, 125.2345, 130.0, 100.0, 0.0, 0.0,
772 ]);
773
774 assert_eq!(floats, &expected);
775 }
776
777 #[test]
778 fn test_round_f64() {

Callers

nothing calls this directly

Calls 2

round_arraysFunction · 0.85
as_float32_arrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…