#!/usr/local/bin/perl -w

=head1 NAME

80rcs_parser.t - test VCP::Source::cvs's RCS file parser

=cut

use strict ;

use Carp ;
use Test ;
use VCP::Source::cvs;

sub check {
   goto &die if $ENV{FATALTEST} && ! $_[0];
}


use VCP::Debug qw( :debug );

enable_debug( split /,/, $ENV{VCPDEBUG} ) if defined $ENV{VCPDEBUG};


$ENV{VCPDEBUG} = "VCP::Source::cvs";
my $s;

my @tests = (
(
   map {
      my $size = $_;
      (
         sub {
            $s = VCP::Source::cvs->new( "cvs:t:...", [] );
            $s->{CVS_READ_SIZE} = $size;
            check ok
               eval { $s->parse_rcs_file( "rcs_file" ); 1 } || $@,
               1,
               "READ_SIZE = $size";
         },
         sub {
            check ok keys %{(values %{$s->{CVS_FILE_DATA}})[0]->{revs}}, 4;
         },
      );
   } ( 1_000_000, 1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 )
),

) ;

plan tests => scalar( @tests ) ;

$_->() for @tests ;
