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

Function test_primitive_slice

arrow/tests/array_equal.rs:148–202  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146
147#[test]
148fn test_primitive_slice() {
149 let cases = vec![
150 (
151 vec![Some(1), Some(2), Some(3)],
152 (0, 1),
153 vec![Some(1), Some(2), Some(3)],
154 (0, 1),
155 true,
156 ),
157 (
158 vec![Some(1), Some(2), Some(3)],
159 (1, 1),
160 vec![Some(1), Some(2), Some(3)],
161 (2, 1),
162 false,
163 ),
164 (
165 vec![Some(1), Some(2), None],
166 (1, 1),
167 vec![Some(1), None, Some(2)],
168 (2, 1),
169 true,
170 ),
171 (
172 vec![None, Some(2), None],
173 (1, 1),
174 vec![None, None, Some(2)],
175 (2, 1),
176 true,
177 ),
178 (
179 vec![Some(1), None, Some(2), None, Some(3)],
180 (2, 2),
181 vec![None, Some(2), None, Some(3)],
182 (1, 2),
183 true,
184 ),
185 (
186 vec![Some(1), Some(2), None, Some(0)],
187 (2, 2),
188 vec![Some(4), Some(5), Some(0), None],
189 (2, 2),
190 false,
191 ),
192 ];
193
194 for (lhs, slice_lhs, rhs, slice_rhs, expected) in cases {
195 let lhs = Int32Array::from(lhs);
196 let lhs = lhs.slice(slice_lhs.0, slice_lhs.1);
197 let rhs = Int32Array::from(rhs);
198 let rhs = rhs.slice(slice_rhs.0, slice_rhs.1);
199
200 test_equal(&lhs, &rhs, expected);
201 }
202}
203
204#[allow(clippy::eq_op)]
205fn test_equal(lhs: &dyn Array, rhs: &dyn Array, expected: bool) {

Callers

nothing calls this directly

Calls 2

test_equalFunction · 0.85
sliceMethod · 0.45

Tested by

no test coverage detected