# -*- coding: utf-8 -*- require 'helper' require 'write_xlsx' require 'stringio' class TestConvertDateTime02 < Minitest::Test def test_convert_date_time data_for_test.split(/\n/).each do |line| workbook = WriteXLSX.new(StringIO.new) workbook.set_1904(false) if line =~ /Excel 1900/ workbook.set_1904(true) if line =~ /Excel 1904/ worksheet = workbook.add_worksheet('') next unless line =~ /\S/ next if line =~ /^#/ dummy, dummy, 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 <