gitedmond commented on code in PR #52286:
URL: https://github.com/apache/arrow/pull/52286#discussion_r4218849307
##########
ruby/red-arrow/test/test-memory-view.rb:
##########
@@ -29,6 +29,48 @@ def little_endian?
[1].pack("s") == [1].pack("s<")
end
+ [
+ [Arrow::Int8Array, "c"],
+ [Arrow::UInt8Array, "C"],
+ [Arrow::Int16Array, "s"],
+ [Arrow::UInt16Array, "S"],
+ [Arrow::Int32Array, "l"],
+ [Arrow::UInt32Array, "L"],
+ [Arrow::Int64Array, "q"],
+ [Arrow::UInt64Array, "Q"],
+ [Arrow::FloatArray, "f"],
+ [Arrow::DoubleArray, "d"],
+ ].each do |array_class, format|
+ test("#{array_class.name}: sliced") do
+ values = (0...8).to_a
+ array = array_class.new(values)
+ item_size = [0].pack(format).bytesize
+ slices = [
+ [array.slice(1, 3), values.slice(1, 3)],
+ [array.slice(4, 3), values.slice(4, 3)],
+ [array.slice(1, 6).slice(2, 3), values.slice(3, 3)],
+ [array.slice(4, 0), []],
+ [array.slice(8, 0), []],
Review Comment:
Trimmed the repeated offsets, nested slices, empty slices, and duplicate
numeric-type coverage. Kept one sliced case per numeric byte width, one
fixed-size binary case, and the Boolean alignment cases.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]