# -*- coding: utf-8 -*- require 'helper' require 'write_xlsx' require 'stringio' class TestConvertDateTime01 < Test::Unit::TestCase def setup @workbook = WriteXLSX.new(StringIO.new) @worksheet = @workbook.add_worksheet('') end def test_convert_date_time data_for_test.split(/\n/).each do |line| @workbook.date_1904 = false if line =~ /Excel 1900/ @workbook.date_1904 = true if line =~ /Excel 1904/ next unless line =~ /\S/ next if line =~ /^#/ count, date, expected = line.split expected = expected.to_i result = @worksheet.convert_date_time(date) result = -1 if result.nil? assert_equal(expected, result, line) end end def data_for_test <