File: test_coordinate.rb

package info (click to toggle)
ruby-roo 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,216 kB
  • sloc: ruby: 6,529; xml: 88; makefile: 6
file content (51 lines) | stat: -rw-r--r-- 766 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# frozen_string_literal: true

require "test_helper"

class TestRooExcelxCoordinate < Minitest::Test
  def row
    10
  end

  def column
    20
  end

  def coordinate
    Roo::Excelx::Coordinate.new(row, column)
  end

  def array
    [row, column]
  end

  def test_row
    assert_same  row, coordinate.row
  end

  def test_column
    assert_same  column, coordinate.column
  end

  def test_frozen?
    assert coordinate.frozen?
  end

  def test_equality
    hash = {}
    hash[coordinate] = true
    assert hash.key?(coordinate)
    assert hash.key?(array)
  end

  def test_expand
    r, c = coordinate
    assert_same row, r
    assert_same column, c
  end

  def test_aref
    assert_same row, coordinate[0]
    assert_same column, coordinate[1]
  end
end