use warnings;
use strict;

BEGIN {
	eval { require IO::File; IO::File->VERSION(1.03); };
	if($@ ne "") {
		require Test::More;
		Test::More::plan(skip_all => "no IO::File");
	}
}

use Test::More tests => 2;

BEGIN { use_ok "Time::OlsonTZ::Data", qw(olson_canonical_names olson_tzfile); }

my $failures = 0;
foreach(sort keys %{olson_canonical_names()}) {
	my $f = olson_tzfile($_);
	my $h = IO::File->new($f, "r");
	unless($h) {
		diag "$_: failed to open $f";
		$failures++;
		next;
	}
	local $/ = \5;
	unless($h->getline eq "TZif2") {
		diag "$_: $f is not of version 2";
		$failures++;
	}
}
is $failures, 0;

1;
