| 16 | # under the License. |
| 17 | |
| 18 | class TimestampArrayTest < Test::Unit::TestCase |
| 19 | test("#[]") do |
| 20 | sec = 1513267750 |
| 21 | usec = 914509 |
| 22 | array = Arrow::TimestampArray.new(:micro, [sec * (10 ** 6) + usec]) |
| 23 | time = Time.at(sec, usec) |
| 24 | assert_equal(time, array[0]) |
| 25 | end |
| 26 | |
| 27 | sub_test_case("#is_in") do |
| 28 | def setup |
| 29 | values = [ |
| 30 | Time.parse("2019-11-18T00:09:11"), |
| 31 | Time.parse("2019-11-18T00:09:12"), |
| 32 | Time.parse("2019-11-18T00:09:13"), |
| 33 | ] |
| 34 | @array = Arrow::TimestampArray.new(:micro, values) |
| 35 | end |
| 36 | |
| 37 | test("Arrow: Array") do |
| 38 | right = [ |
| 39 | Time.parse("2019-11-18T00:09:12"), |
| 40 | ] |
| 41 | assert_equal(Arrow::BooleanArray.new([false, true, false]), |
| 42 | @array.is_in(right)) |
| 43 | end |
| 44 | end |
| 45 | end |