Sha256: a97d540b456bbb2bd9f9f38a23f15c2351e3f78e1cf32faf7478d1a59bcc5153

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

#! /usr/bin/env ruby
# coding: utf-8

require 'helper'
require "test/unit"
#require "imagut/nefparser.rb"
require "imagut.rb"

class TC_NefParser < Test::Unit::TestCase
    def setup
        @np00 = Imagut::NefParser.new
    end

    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

    def test_taken_date

        data = File.open("test/001.nef", "r").read
        assert_equal(Time.mktime(2011, 8, 12, 5, 50, 33), @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))

        # String でないときに例外。
        data = File.open("test/001.nef", "r").readlines
        assert_raise(Imagut::NefParser::TypeError){@np00.taken_date(data)}

        # NEF と異なるときに例外のテスト
        assert_raise(Imagut::NefParser::NotNefError){@np00.taken_date("Not NEF data")}

    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
imagut-0.0.4 test/test_nefparser.rb