# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### We start with some black magic to print on failure. # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) BEGIN { $| = 1; print "1..5\n"; } END {print "not ok 1\n" unless $loaded;} use P4::Journal; $loaded = 1; print "ok 1\n"; ######################### End of black magic. # Insert your test code below (better if it prints "ok 13" # (correspondingly "not ok 13") depending on the success of chunk 13 # of the test code): ################################################################################ package MyJournal; use strict; use vars qw( @ISA ); @ISA = qw( P4::Journal ); sub new { my $class = shift; my $self = new P4::Journal( @_ ); bless( $self, $class ); $self->{'Records'} = 0; return $self; } sub Count() { my $self = shift; $self->{'Records'}; } sub Reset() { my $self = shift; $self->{'Records'} = 0; } sub ParseRecord { my $self = shift; my $rec = shift; my $table = $rec->Table(); $self->{'Records'}++; } package main; # Some basic sanity tests # Can we instantiate objects? my $journal = new MyJournal("test.jnl"); print( defined($journal) ? "ok 2\n" : "not ok 2\n"); # Can we parse files? $journal->Parse(); print( $journal->Count() == 462 ? "ok 3\n" : "not ok 3\n");
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 544 | Tony Smith |
Deleted Journal parsing scripts as they will be sent out only on request. |
||
#1 | 543 | Tony Smith |
Added my Checkpoint/Journal parsing perl module to the depot. Now supports an OO interface to journal records and to the parsing in general. |