]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
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 | |
8 | # | |
9 | # http://www.apache.org/licenses/LICENSE-2.0 | |
10 | # | |
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 | |
16 | # under the License. | |
17 | ||
18 | class TestDictionaryDataType < Test::Unit::TestCase | |
19 | include Helper::Buildable | |
20 | ||
21 | def setup | |
22 | @index_data_type = Arrow::Int32DataType.new | |
23 | @value_data_type = Arrow::StringDataType.new | |
24 | @ordered = true | |
25 | @data_type = Arrow::DictionaryDataType.new(@index_data_type, | |
26 | @value_data_type, | |
27 | @ordered) | |
28 | end | |
29 | ||
30 | def test_type | |
31 | assert_equal(Arrow::Type::DICTIONARY, @data_type.id) | |
32 | end | |
33 | ||
34 | def test_name | |
35 | assert_equal("dictionary", @data_type.name) | |
36 | end | |
37 | ||
38 | def test_to_s | |
39 | assert_equal("dictionary<values=string, indices=int32, ordered=1>", | |
40 | @data_type.to_s) | |
41 | end | |
42 | ||
43 | def test_bit_width | |
44 | assert_equal(32, @data_type.bit_width) | |
45 | end | |
46 | ||
47 | def test_index_data_type | |
48 | assert_equal(@index_data_type, @data_type.index_data_type) | |
49 | end | |
50 | ||
51 | def test_value_data_type | |
52 | assert_equal(@value_data_type, @data_type.value_data_type) | |
53 | end | |
54 | ||
55 | def test_ordered? | |
56 | assert do | |
57 | @data_type.ordered? | |
58 | end | |
59 | end | |
60 | end |