test/test_nefparser.rb in imagut-0.0.3 vs test/test_nefparser.rb in imagut-0.0.4

- old
+ new

@@ -1,31 +1,38 @@ #! /usr/bin/env ruby # coding: utf-8 require 'helper' require "test/unit" -require "imageutils/nefparser.rb" +#require "imagut/nefparser.rb" +require "imagut.rb" class TC_NefParser < Test::Unit::TestCase - def setup - @np00 = NefParser.new - end + def setup + @np00 = Imagut::NefParser.new + end - def test_taken_date + def test_self_read_taken_date + file = "test/001.nef" + assert_equal(Time.mktime(2011, 8, 12, 5, 50, 33), + Imagut::NefParser.read_taken_date(file)) + end - data = File.open("test/001.nef", "r").read - assert_equal(Time.mktime(2011, 8, 12, 5, 50, 33), @np00.taken_date(data)) + def test_taken_date - data = File.open("test/001.nef", "r").read(372+19) - assert_equal(Time.mktime(2011, 8, 12, 5, 50, 33), @np00.taken_date(data)) + data = File.open("test/001.nef", "r").read + assert_equal(Time.mktime(2011, 8, 12, 5, 50, 33), @np00.taken_date(data)) - # String でないときに例外。 - data = File.open("test/001.nef", "r").readlines - assert_raise(NefParserTypeError){@np00.taken_date(data)} + data = File.open("test/001.nef", "r").read(372+19) + assert_equal(Time.mktime(2011, 8, 12, 5, 50, 33), @np00.taken_date(data)) - # NEF と異なるときに例外のテスト - assert_raise(NefParserNotNefError){@np00.taken_date("Not NEF data")} + # String でないときに例外。 + data = File.open("test/001.nef", "r").readlines + assert_raise(Imagut::NefParser::TypeError){@np00.taken_date(data)} - end + # NEF と異なるときに例外のテスト + assert_raise(Imagut::NefParser::NotNefError){@np00.taken_date("Not NEF data")} + + end end