]>
git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/c_glib/test/test-int32-array.rb
1 # Licensed to the Apache Software Foundation (ASF) under one
2 # or more contributor license agreements. See the NOTICE file
3 # distributed with this work for additional information
4 # regarding copyright ownership. The ASF licenses this file
5 # to you under the Apache License, Version 2.0 (the
6 # "License"); you may not use this file except in compliance
7 # with the License. You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing,
12 # software distributed under the License is distributed on an
13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 # KIND, either express or implied. See the License for the
15 # specific language governing permissions and limitations
18 class TestInt32Array
< Test
::Unit::TestCase
19 include Helper
::Buildable
22 assert_equal(build_int32_array([-1, 2, nil]),
23 Arrow
::Int32Array.new(3,
24 Arrow
::Buffer.new([-1, 2].pack("l*")),
25 Arrow
::Buffer.new([0b011].pack("C*")),
30 builder
= Arrow
::Int32ArrayBuilder.new
31 builder
.append_value(-1)
32 builder
.append_value(2)
33 builder
.append_value(-4)
34 array
= builder
.finish
35 assert_equal([-1, 2, -4].pack("l*"), array
.buffer
.data.to_s
)
39 builder
= Arrow
::Int32ArrayBuilder.new
40 builder
.append_value(-1)
41 array
= builder
.finish
42 assert_equal(-1, array
.get_value(0))
46 builder
= Arrow
::Int32ArrayBuilder.new
47 builder
.append_value(-1)
48 builder
.append_value(2)
49 builder
.append_value(-4)
50 array
= builder
.finish
51 assert_equal([-1, 2, -4], array
.values
)
55 array
= build_int32_array([2, -4, nil])
56 assert_equal(-2, array
.sum
)