#!/usr/bin/perl

use TestStore;
use TestMeta;
use TestUtil;

sub BEGIN {$ENV{PTKDB_STOP_TAG_COLOR} = "yellow" } 

&main();

sub main
{
    my $cleanup = 1;
    
    while( $#ARGV != -1 ) {
       my $arg = shift @ARGV;
       if( $arg eq "-trace" ) {
          $TestUtil::doTrace = 1;
       } elsif ( $arg eq "-nocleanup" ) {
          $cleanup = 0;
       } else {
          print "Usage unittest [-trace|-nocleanup]\n";
          exit(1);
       }
    }
    
    $TestUtil::totalCount = 0;
    $TestUtil::okayCount  = 0;
    
    TestMeta::setup();
    TestMeta::test();
    if( $cleanup ) {
       TestMeta::cleanup();
    }

    
    TestUtil::trace( "Only testing for TWiki::useRcsDir=$TWiki::useRcsDir" );
    TestStore::setup();
    TestStore::test();
    if( $cleanup ) {
       TestStore::cleanup();
    }
    
    print TestUtil::testSummary();
}

1;
