#!/usr/bin/env perl

# Script to run T3 to generates test-suites

# Need java 8
my $JAVA = "c:/apps/Java/jdk1.8.0/bin/java" ;
#my $JAVA = "c:/apps/Java/jdk1.7.0/bin/java" ;
# used separator in class-path
my $CPseparator = ";" ;

my $targetHome = "joda-time-2.3" ;
my $targetClassDir = "../" . $targetHome . "/classes" ;

my $T3 = " Sequenic.T3.T3 "  ;
my $T3jar = "../../../T3/v0/build/T3v0.jar"  ;

my $T3params = "--multicore " 
                . "--nonviolating "
                . "--prefixlength=7 --suffixlength=0 "
                . "--msamples=120 "
                . "--savedir=./suites "
                . "--scandir=" . $targetClassDir ;
                
my $classpath = "\'" 
            . $T3jar . $CPseparator 
            . $targetClassDir
            . "\'" ;

# to run T3:
sub runT3 {
    my $CUT = $_[0] ;
    system(
     $JAVA . " -ea -cp " . $classpath
     . $T3 . " " . $T3params . " -lf t3gen_" . $CUT 
     . " " . $CUT
    ) ;
}

# now the runs:
runT3("org.joda.time.Chronology") ; # abstract class
#runT3("org.joda.time.DateTimeComparator") ; # singleton
#runT3("org.joda.time.DateTimeFieldType") ; # abstract
#runT3("org.joda.time.DateTimeUtils") ; # static bunch
#runT3("org.joda.time.DateTimeZone") ;  # abstract class, with some concrete methods
#runT3("org.joda.time.Days") ;  # static bunch
#runT3("org.joda.time.DurationField") ;  # abstract class, with some concrete methods
#runT3("org.joda.time.DurationFieldType") ; # abstract class, with some concrete methods, and an inner class
#runT3("org.joda.time.Hours") ;
#runT3("org.joda.time.IllegalFieldValueException") ; # throws exceptions.. not clear what the problem is....
#runT3("org.joda.time.Minutes") ;
#runT3("org.joda.time.Months") ;
#runT3("org.joda.time.MutableDateTime") ;
#runT3("org.joda.time.PeriodType") ;
#runT3("org.joda.time.Seconds") ;
#runT3("org.joda.time.Years") ;
#runT3("org.joda.time.chrono.BuddhistChronology") ;
#runT3("org.joda.time.chrono.GJChronology") ;  # has several inner classes
#runT3("org.joda.time.chrono.GregorianChronology") ;
#runT3("org.joda.time.chrono.ISOChronology") ;
#runT3("org.joda.time.chrono.LenientChronology") ; # low cov; probly too little chance to generate null
#These whole convert package is problematical for T3, mostly because methods have param of type Object, but turn out that this Object has to be of a certain clas X --> hard for random
#runT3("org.joda.time.convert.CalendarConverter") ;  # got low coverage :( because we have to pass params of type Object, which actually have to be of certain classes. This is just not for a random approach.
#runT3("org.joda.time.convert.ConverterManager") ;  # low coverage :(
#runT3("org.joda.time.convert.ConverterSet") ;      # low cobverage, difficult to handle by a random approach
#runT3("org.joda.time.convert.DateConverter") ;     # lower cov, due to Object param should be class X
#runT3("org.joda.time.convert.LongConverter") ;  # lower cov, due to Object param should be class X
#runT3("org.joda.time.convert.NullConverter") ;
#runT3("org.joda.time.convert.ReadableDurationConverter") ;  # low cov, difficult for random
#runT3("org.joda.time.convert.ReadableInstantConverter") ;
#runT3("org.joda.time.convert.ReadableIntervalConverter") ;
#runT3("org.joda.time.convert.ReadablePartialConverter") ;
#runT3("org.joda.time.convert.ReadablePeriodConverter") ;
#runT3("org.joda.time.convert.StringConverter") ;
#runT3("org.joda.time.field.BaseDateTimeField") ; # abstract class with concrete constructors and methods
#runT3("org.joda.time.field.FieldUtils") ;
#runT3("org.joda.time.field.MillisDurationField") ; # singleton, but without a method to get the instance; instead, by reading from a static field directly
#runT3("org.joda.time.field.OffsetDateTimeField") ;
#runT3("org.joda.time.field.PreciseDateTimeField") ;
#runT3("org.joda.time.field.PreciseDurationDateTimeField") ;
#runT3("org.joda.time.field.PreciseDurationField") ;
#runT3("org.joda.time.field.ScaledDurationField") ;
#runT3("org.joda.time.field.UnsupportedDateTimeField") ;
#runT3("org.joda.time.format.DateTimeFormat") ;
#runT3("org.joda.time.format.DateTimeFormatter") ;
#runT3("org.joda.time.format.DateTimeFormatterBuilder") ;
#runT3("org.joda.time.format.ISODateTimeFormat") ;
#runT3("org.joda.time.format.ISOPeriodFormat") ;
#runT3("org.joda.time.format.PeriodFormat") ;
#runT3("org.joda.time.format.PeriodFormatter") ;
#runT3("org.joda.time.format.PeriodFormatterBuilder") ;


           