test/test_roo.rb in roo-0.1.1 vs test/test_roo.rb in roo-0.1.2
- old
+ new
@@ -1,9 +1,17 @@
require File.dirname(__FILE__) + '/test_helper.rb'
class TestRoo < Test::Unit::TestCase
+ def test_letters
+ assert_equal 1, Openoffice.letter_to_number('A')
+ assert_equal 1, Openoffice.letter_to_number('a')
+ assert_equal 2, Openoffice.letter_to_number('B')
+ assert_equal 26, Openoffice.letter_to_number('Z')
+ assert_equal 27, Openoffice.letter_to_number('AA')
+ end
+
def test_sheets
oo = Openoffice.new("test/numbers1.ods")
assert_equal ["Tabelle1","Name of Sheet 2","Sheet3"], oo.sheets
end
@@ -119,13 +127,25 @@
end
def test_boundaries
oo = Openoffice.new("test/numbers1.ods")
oo.default_sheet = "Name of Sheet 2"
- assert true
assert_equal 2, oo.first_column
assert_equal 'B', oo.first_column_as_letter
assert_equal 5, oo.first_row
assert_equal 'E', oo.last_column_as_letter
assert_equal 14, oo.last_row
+ assert_equal 'E', oo.first_row_as_letter
+ assert_equal 'N', oo.last_row_as_letter
+ assert_equal 'N', oo.last_row.as_letter
+ end
+
+ def test_multiple_letters
+ oo = Openoffice.new("test/numbers1.ods")
+ oo.default_sheet = "Sheet3"
+ assert_equal "i am AA", oo.cell('AA',1)
+ assert_equal "i am AB", oo.cell('AB',1)
+ assert_equal "i am BA", oo.cell('BA',1)
+ assert_equal "i am BA", oo.cell(1,'BA')
+
end
end