Sha256: 932c9892b4fa8552526a5e7e106d757133691393cadbcb5566390ce66b9e5fd9

Contents?: true

Size: 1.05 KB

Versions: 62

Compression:

Stored size: 1.05 KB

Contents

#!/usr/bin/env ruby
# Excel::TestRow -- Spreadsheet -- 12.10.2008 -- hwyss@ywesee.com

$: << File.expand_path('../../lib', File.dirname(__FILE__))

require 'test/unit'
require 'spreadsheet'

module Spreadsheet
  module Excel
class TestRow < Test::Unit::TestCase
  def setup
    @workbook = Excel::Workbook.new
    @worksheet = Excel::Worksheet.new
    @workbook.add_worksheet @worksheet
  end
  def test_date
    row = Row.new @worksheet, 0, [nil, 27627.6789]
    assert_equal Date.new(1975,8,21), row.date(1)
  end
  def test_to_a
    row = Row.new @worksheet, 0, [nil, 1, 27627.6789]
    row.set_format(2, Format.new(:number_format => 'DD.MM.YYYY'))
    assert_equal [nil, 1, Date.new(1975, 8, 21)], row.to_a
  end
  def test_datetime
    row = Row.new @worksheet, 0, [nil, 27627.765]
    d1 = DateTime.new(1975,8,21) + 0.765
    d2 = row.datetime 1
    assert_equal d1, d2
  end
  def test_datetime_overflow
    row = Row.new @worksheet, 0, [nil, 40010.6666666666]
    d1 = DateTime.new(2009,07,16,16)
    d2 = row.datetime 1
    assert_equal d1, d2
  end
end
  end
end

Version data entries

62 entries across 62 versions & 3 rubygems

Version Path
spreadsheet-1.3.3 test/excel/row.rb
spreadsheet-1.3.2 test/excel/row.rb
spreadsheet-1.3.1 test/excel/row.rb
spreadsheet-1.3.0 test/excel/row.rb
spreadsheet-1.2.9 test/excel/row.rb
spreadsheet-1.2.8 test/excel/row.rb
spreadsheet-1.2.7 test/excel/row.rb
spreadsheet-1.2.6 test/excel/row.rb
spreadsheet-1.2.5 test/excel/row.rb
spreadsheet-1.2.4 test/excel/row.rb
spreadsheet-1.2.3 test/excel/row.rb
spreadsheet-1.2.2 test/excel/row.rb
spreadsheet-1.2.1 test/excel/row.rb
spreadsheet-1.2.0 test/excel/row.rb
spreadsheet-1.1.9 test/excel/row.rb
spreadsheet-1.1.8 test/excel/row.rb
spreadsheet-1.1.7 test/excel/row.rb
spreadsheet-1.1.6 test/excel/row.rb
spreadsheet-1.1.5 test/excel/row.rb
spreadsheet-1.1.4 test/excel/row.rb