MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_unary_mut

Function test_unary_mut

arrow-array/src/array/primitive_array.rs:2814–2825  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2812
2813 #[test]
2814 fn test_unary_mut() {
2815 let array: Int32Array = vec![1, 2, 3].into_iter().map(Some).collect();
2816
2817 let c = array.unary_mut(|x| x * 2 + 1).unwrap();
2818 let expected: Int32Array = vec![3, 5, 7].into_iter().map(Some).collect();
2819
2820 assert_eq!(expected, c);
2821
2822 let array: Int32Array = Int32Array::from(vec![Some(5), Some(7), None]);
2823 let c = array.unary_mut(|x| x * 2 + 1).unwrap();
2824 assert_eq!(c, Int32Array::from(vec![Some(11), Some(15), None]));
2825 }
2826
2827 #[test]
2828 #[should_panic(

Callers

nothing calls this directly

Calls 3

collectMethod · 0.80
into_iterMethod · 0.45
unary_mutMethod · 0.45

Tested by

no test coverage detected