Changeset 1970

Show
Ignore:
Timestamp:
12/03/07 14:30:26 (5 months ago)
Author:
joshr
Message:

retabbed files to view prettier from SVN web browser.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Swishetest/trunk/t/010-C010-trivial-txt.t

    r1959 r1970  
    1313 
    1414BEGIN {  
    15        require Carp; 
    16        $SIG{__WARN__} = sub { Carp::confess $_[0] }; 
    17        use File::Path qw(mkpath); 
    18        mkpath( ["blib/index"], 0, 0755); 
    19        my $base = "C010"; 
    20        my (%out) = BuildIndex::build_index_from_directory( "data/$base-trivial-txt", "blib/index/$base.index" ); 
    21        #print STDERR "out is " . Dumper( \%out ); 
     15    require Carp; 
     16    $SIG{__WARN__} = sub { Carp::confess $_[0] }; 
     17    use File::Path qw(mkpath); 
     18    mkpath( ["blib/index"], 0, 0755); 
     19    my $base = "C010"; 
     20    my (%out) = BuildIndex::build_index_from_directory( "data/$base-trivial-txt", "blib/index/$base.index" ); 
     21    #print STDERR "out is " . Dumper( \%out ); 
    2222 
    23        cmp_ok( scalar((keys(%out))),   '>',   2, "Indexing output: " . scalar(%out) );  
    24        cmp_ok( $out{unique},     '==',  2, 'unique words indexed' ); 
    25        cmp_ok( $out{properties}, '==',  5, 'num properties' ); 
    26        cmp_ok( $out{files},      '==',  3, 'files indexed' ); 
    27        cmp_ok( $out{bytes},      '==', 24, 'bytes indexed' ); 
    28        cmp_ok( $out{words},      '==',  4, 'total words indexed' ); 
    29          
     23    cmp_ok( scalar((keys(%out))),   '>',   2, "Indexing output: " . scalar(%out) );  
     24    cmp_ok( $out{unique},     '==',  2, 'unique words indexed' ); 
     25    cmp_ok( $out{properties}, '==',  5, 'num properties' ); 
     26    cmp_ok( $out{files},      '==',  3, 'files indexed' ); 
     27    cmp_ok( $out{bytes},      '==', 24, 'bytes indexed' ); 
     28    cmp_ok( $out{words},      '==',  4, 'total words indexed' ); 
     29     
    3030    DoSearch::open_index( "blib/index/$base.index" ); 
    31        my @rows = DoSearch::do_search( "blib/index/$base.index", "swishe OR test"); 
     31    my @rows = DoSearch::do_search( "blib/index/$base.index", "swishe OR test"); 
    3232    DoSearch::close_index( "blib/index/$base.index" ); 
    33        cmp_ok(scalar(@rows), '==', 3, "num results from 'swishe OR test'") 
     33    cmp_ok(scalar(@rows), '==', 3, "num results from 'swishe OR test'") 
    3434 
    3535}; 
  • Swishetest/trunk/t/011-C011-trivial-html.t

    r1959 r1970  
    1212 
    1313BEGIN {  
    14        require Carp; 
    15        $SIG{__WARN__} = sub { Carp::confess $_[0] }; 
    16        use File::Path qw(mkpath); 
    17        mkpath( ["blib/index"], 0, 0755); 
    18        my $base = "C011"; 
    19        my (%out) = BuildIndex::build_index_from_directory( "data/$base-trivial-html", "blib/index/$base.index" ); 
     14    require Carp; 
     15    $SIG{__WARN__} = sub { Carp::confess $_[0] }; 
     16    use File::Path qw(mkpath); 
     17    mkpath( ["blib/index"], 0, 0755); 
     18    my $base = "C011"; 
     19    my (%out) = BuildIndex::build_index_from_directory( "data/$base-trivial-html", "blib/index/$base.index" ); 
    2020 
    21        cmp_ok( scalar(keys(%out)),    '>',    2, "Indexing output" );  
    22        cmp_ok( $out{unique},     '==',   2, 'unique words indexed' ); 
    23        cmp_ok( $out{properties}, '==',   5, 'num properties' ); 
    24        cmp_ok( $out{files},      '==',   4, 'files indexed' ); 
    25        cmp_ok( $out{bytes},      '==', 318, 'bytes indexed' ); 
    26        cmp_ok( $out{words},      '==',   8, 'total words indexed' ); 
    27          
     21    cmp_ok( scalar(keys(%out)),    '>',    2, "Indexing output" );  
     22    cmp_ok( $out{unique},     '==',   2, 'unique words indexed' ); 
     23    cmp_ok( $out{properties}, '==',   5, 'num properties' ); 
     24    cmp_ok( $out{files},      '==',   4, 'files indexed' ); 
     25    cmp_ok( $out{bytes},      '==', 318, 'bytes indexed' ); 
     26    cmp_ok( $out{words},      '==',   8, 'total words indexed' ); 
     27     
    2828    DoSearch::open_index( "blib/index/$base.index" ); 
    29        my @rows = DoSearch::do_search( "blib/index/$base.index", "swishe OR test"); 
     29    my @rows = DoSearch::do_search( "blib/index/$base.index", "swishe OR test"); 
    3030    DoSearch::close_index( "blib/index/$base.index" ); 
    31        cmp_ok(scalar(@rows), '==', 3, "num results from 'swishe OR test'") 
     31    cmp_ok(scalar(@rows), '==', 3, "num results from 'swishe OR test'") 
    3232 
    3333}; 
  • Swishetest/trunk/t/012-C012-trivial-xml.t

    r1959 r1970  
    1212 
    1313BEGIN {  
    14        require Carp; 
    15        $SIG{__WARN__} = sub { Carp::confess $_[0] }; 
    16        use File::Path qw(mkpath); 
    17        mkpath( ["blib/index"], 0, 0755); 
    18        my $base = "C012"; 
    19        my (%out) = BuildIndex::build_index_from_directory( "data/$base-trivial-xml", "blib/index/$base.index" ); 
     14    require Carp; 
     15    $SIG{__WARN__} = sub { Carp::confess $_[0] }; 
     16    use File::Path qw(mkpath); 
     17    mkpath( ["blib/index"], 0, 0755); 
     18    my $base = "C012"; 
     19    my (%out) = BuildIndex::build_index_from_directory( "data/$base-trivial-xml", "blib/index/$base.index" ); 
    2020 
    21        cmp_ok( scalar(keys(%out)),     '>',    2, "Indexing output" );  
    22        cmp_ok( $out{unique},     '==',   2, 'unique words indexed' ); 
    23        cmp_ok( $out{properties}, '==',   5, 'num properties' ); 
    24        cmp_ok( $out{files},      '==',   4, 'files indexed' ); 
    25        cmp_ok( $out{bytes},      '==', 301, 'bytes indexed' ); 
    26        cmp_ok( $out{words},      '==',   8, 'total words indexed' ); 
    27          
     21    cmp_ok( scalar(keys(%out)),     '>',    2, "Indexing output" );  
     22    cmp_ok( $out{unique},     '==',   2, 'unique words indexed' ); 
     23    cmp_ok( $out{properties}, '==',   5, 'num properties' ); 
     24    cmp_ok( $out{files},      '==',   4, 'files indexed' ); 
     25    cmp_ok( $out{bytes},      '==', 301, 'bytes indexed' ); 
     26    cmp_ok( $out{words},      '==',   8, 'total words indexed' ); 
     27     
    2828    DoSearch::open_index( "blib/index/$base.index" ); 
    29        my @rows = DoSearch::do_search( "blib/index/$base.index", "swishe OR test"); 
     29    my @rows = DoSearch::do_search( "blib/index/$base.index", "swishe OR test"); 
    3030    DoSearch::close_index( "blib/index/$base.index" ); 
    31        cmp_ok(scalar(@rows), '==', 3, "num results from 'swishe OR test'") 
     31    cmp_ok(scalar(@rows), '==', 3, "num results from 'swishe OR test'") 
    3232 
    3333}; 
  • Swishetest/trunk/t/020-C020-wordsbasic-txt.t

    r1959 r1970  
    1212 
    1313BEGIN {  
    14        use File::Path qw(mkpath); 
    15        mkpath( ["blib/index"], 0, 0755); 
    16        my $base = "C020"; 
    17        my (%out) = BuildIndex::build_index_from_directory( "data/$base-words-txt", "blib/index/$base.index" ); 
     14    use File::Path qw(mkpath); 
     15    mkpath( ["blib/index"], 0, 0755); 
     16    my $base = "C020"; 
     17    my (%out) = BuildIndex::build_index_from_directory( "data/$base-words-txt", "blib/index/$base.index" ); 
    1818 
    19        cmp_ok( scalar(keys(%out)), '>',          2, "Indexing output" );  
    20        cmp_ok( $out{unique},     '==',    252983, 'unique words indexed' ); 
    21        cmp_ok( $out{properties}, '==',         5, 'num properties' ); 
    22        cmp_ok( $out{files},      '==',         2, 'files indexed' ); 
    23        cmp_ok( $out{bytes},      '==',   2896130, 'bytes indexed' ); 
    24        cmp_ok( $out{words},      '==',    280381, 'total words indexed' ); 
     19    cmp_ok( scalar(keys(%out)), '>',          2, "Indexing output" );  
     20    cmp_ok( $out{unique},     '==',    252983, 'unique words indexed' ); 
     21    cmp_ok( $out{properties}, '==',         5, 'num properties' ); 
     22    cmp_ok( $out{files},      '==',         2, 'files indexed' ); 
     23    cmp_ok( $out{bytes},      '==',   2896130, 'bytes indexed' ); 
     24    cmp_ok( $out{words},      '==',    280381, 'total words indexed' ); 
    2525 
    2626    DoSearch::open_index( "blib/index/$base.index" ); 
    27        my @rows = DoSearch::do_search( "blib/index/$base.index", "swishe OR test"); 
     27    my @rows = DoSearch::do_search( "blib/index/$base.index", "swishe OR test"); 
    2828    DoSearch::close_index( "blib/index/$base.index" ); 
    29        cmp_ok(scalar(@rows), '==', 2, "num results from 'swishe OR test'")  
     29    cmp_ok(scalar(@rows), '==', 2, "num results from 'swishe OR test'")  
    3030}; 
    3131 
  • Swishetest/trunk/t/030-C030-medsm-xml.t

    r1959 r1970  
    1818    use MinMax; 
    1919    use File::Path qw(mkpath); 
    20        use GetDictionaryWords; 
    21        use Test::More qw(no_plan); 
    22        my $max_words = MinMax::min(1_000_000, ($ENV{MAX_INDEX_FILES} || 1_000_000)); 
    23        # predict number of tests based on number of files in dictionaries and number of index types 
    24        my @dicts = qw( data/C020-words-txt/words-linux-fc1.txt data/C020-words-txt/words-osx-10_3.txt); 
     20    use GetDictionaryWords; 
     21    use Test::More qw(no_plan); 
     22    my $max_words = MinMax::min(1_000_000, ($ENV{MAX_INDEX_FILES} || 1_000_000)); 
     23    # predict number of tests based on number of files in dictionaries and number of index types 
     24    my @dicts = qw( data/C020-words-txt/words-linux-fc1.txt data/C020-words-txt/words-osx-10_3.txt); 
    2525    my @filetypes = qw(html xml txt); 
    2626    my $numdicts = scalar(@dicts); 
     
    2828    # three tests plus one for each word, for each dictionary and filetype. 
    2929    #plan tests => ($numdicts * $numfiletypes * (3 + $max_words )); 
    30        mkpath( ["blib/index"], 0, 0755); 
    31        my $base = "C030"; 
    32        for my $dict (@dicts) { 
    33                for my $filetype ( @filetypes ) { 
    34                        ( my $dictname = $dict ) =~ s/^.*-(([^.]|-)+)\.txt$/$1/; 
    35                        #( my $dictname = $dict ) =~ s/\.txt$//;        # this doesn't work 
    36                        #$dictname =~ s![^/]*/!!;       # this doesn't work 
     30    mkpath( ["blib/index"], 0, 0755); 
     31    my $base = "C030"; 
     32    for my $dict (@dicts) { 
     33        for my $filetype ( @filetypes ) { 
     34            ( my $dictname = $dict ) =~ s/^.*-(([^.]|-)+)\.txt$/$1/; 
     35            #( my $dictname = $dict ) =~ s/\.txt$//;    # this doesn't work 
     36            #$dictname =~ s![^/]*/!!;   # this doesn't work 
    3737 
    38                        my $index = "blib/index/${base}_${dictname}_${filetype}.index"; 
    39                        my ($words, $word_count) = GetDictionaryWords::get_dictionary_words( $dict, 0, $max_words); 
    40                                # this filename should come from somewhere factored 
    41                        die "Couldn't get words from $dict" unless @$words; 
    42                          
    43                        # make a collection from dict, one word per document 
    44                        my $cmd = "./make_collection --dict=$dict --norand --noenglishify " . 
    45                                                "--filetype=$filetype --min_words=1 --max_words=1 --num_files=" . scalar(@$words); 
    46                        print STDERR "Using $cmd\n" if $ENV{TEST_VERBOSE}; 
     38            my $index = "blib/index/${base}_${dictname}_${filetype}.index"; 
     39            my ($words, $word_count) = GetDictionaryWords::get_dictionary_words( $dict, 0, $max_words); 
     40                # this filename should come from somewhere factored 
     41            die "Couldn't get words from $dict" unless @$words; 
     42             
     43            # make a collection from dict, one word per document 
     44            my $cmd = "./make_collection --dict=$dict --norand --noenglishify " . 
     45                        "--filetype=$filetype --min_words=1 --max_words=1 --num_files=" . scalar(@$words); 
     46            print STDERR "Using $cmd\n" if $ENV{TEST_VERBOSE}; 
    4747 
    48                        my (%out) = BuildIndex::build_index_from_external_program( $cmd, $index); 
     48            my (%out) = BuildIndex::build_index_from_external_program( $cmd, $index); 
    4949 
    50                        # first three tests: did the indexing seem to work? 
    51                        cmp_ok( scalar(%out),     '>',          0,              "Indexing output" );  
    52                        cmp_ok( $out{files},      '==', scalar(@$words), 'files indexed' ); 
    53                        cmp_ok( $out{properties}, '==',         5,              'num properties' ); 
     50            # first three tests: did the indexing seem to work? 
     51            cmp_ok( scalar(%out),     '>',          0,      "Indexing output" );  
     52            cmp_ok( $out{files},      '==', scalar(@$words), 'files indexed' ); 
     53            cmp_ok( $out{properties}, '==',         5,      'num properties' ); 
    5454 
    5555            DoSearch::open_index($index); 
    56                        for my $word (@$words) {        # then, one test for each word in the test 
    57                                my @rows = DoSearch::do_search($index, "'$word'");  # quote the word 
    58                                my ($num_expected_rows) = (             # look up the count unless it's AND, OR, or NOT 
    59                                        ($word =~ /^\s*(and|or|not|near)\s*$/i) ? 0 : ($word_count->{lc($word)} || 1)); 
    60                                cmp_ok(scalar(@rows), "==", $num_expected_rows, "search '$word' ($filetype index from $dict)"); 
    61                        
     56            for my $word (@$words) {    # then, one test for each word in the test 
     57                my @rows = DoSearch::do_search($index, "'$word'");  # quote the word 
     58                my ($num_expected_rows) = (     # look up the count unless it's AND, OR, or NOT 
     59                    ($word =~ /^\s*(and|or|not|near)\s*$/i) ? 0 : ($word_count->{lc($word)} || 1)); 
     60                cmp_ok(scalar(@rows), "==", $num_expected_rows, "search '$word' ($filetype index from $dict)"); 
     61           
    6262            DoSearch::close_index($index); 
    63                        $words = undef; 
    64                        $word_count = undef; 
    65                
    66        
     63            $words = undef; 
     64            $word_count = undef; 
     65       
     66   
    6767}; 
    6868 
     
    7070 
    7171BEGIN {  
    72        use File::Path qw(mkpath); 
    73        mkpath( ["blib/index"], 0, 0755); 
    74        my $base = "C030"; 
    75        my (%out) = build_index(  
    76                "data/C030-medsm-xml", "blib/index/$base.index"); 
     72    use File::Path qw(mkpath); 
     73    mkpath( ["blib/index"], 0, 0755); 
     74    my $base = "C030"; 
     75    my (%out) = build_index(  
     76        "data/C030-medsm-xml", "blib/index/$base.index"); 
    7777 
    78        cmp_ok( scalar(%out),     '>',          2, "Indexing output" );  
    79        cmp_ok( $out{unique},     '==',    117468, 'unique words indexed' ); 
    80        cmp_ok( $out{properties}, '==',         4, 'num properties' ); 
    81        cmp_ok( $out{files},      '==',      1000, 'files indexed' ); 
    82        cmp_ok( $out{bytes},      '==',  16626260, 'bytes indexed' ); 
    83        cmp_ok( $out{words},      '==',   1513714, 'total words indexed' ); 
     78    cmp_ok( scalar(%out),     '>',          2, "Indexing output" );  
     79    cmp_ok( $out{unique},     '==',    117468, 'unique words indexed' ); 
     80    cmp_ok( $out{properties}, '==',         4, 'num properties' ); 
     81    cmp_ok( $out{files},      '==',      1000, 'files indexed' ); 
     82    cmp_ok( $out{bytes},      '==',  16626260, 'bytes indexed' ); 
     83    cmp_ok( $out{words},      '==',   1513714, 'total words indexed' ); 
    8484 
    85          
    86        my @rows = do_search(  
    87                "blib/index/$base.index", "swishe OR test"); 
    88        cmp_ok(scalar(@rows), '==', 14, "num results from 'swishe OR test'")  
     85     
     86    my @rows = do_search(  
     87        "blib/index/$base.index", "swishe OR test"); 
     88    cmp_ok(scalar(@rows), '==', 14, "num results from 'swishe OR test'")  
    8989}; 
    9090 
  • Swishetest/trunk/t/050-C020-largeindex.t

    r1968 r1970  
    1313BEGIN {  
    1414    exit(0) unless $ENV{TEST_HUGE_INDEX}; 
    15        use File::Path qw(mkpath); 
    16        mkpath( ["blib/index"], 0, 0755); 
    17        my $base = "T050-$$";  # test 050 
     15    use File::Path qw(mkpath); 
     16    mkpath( ["blib/index"], 0, 0755); 
     17    my $base = "T050-$$";  # test 050 
    1818    warn "base is $base\n"; 
    19        my (%out) = BuildIndex::build_index_from_external_program(  
     19    my (%out) = BuildIndex::build_index_from_external_program(  
    2020        #"./make_collection -min_words=1000    -max_words=1000    -num_files=100", # this makes 920K of data, 2.33MB index, 476k propfile 
    2121        #"./make_collection -min_words=10000   -max_words=10000   -num_files=1000", # this makes 38M index, 40MB prop  
     
    2727    ); 
    2828 
    29        cmp_ok( scalar(keys(%out)), '>',          2, "Indexing output" );  
    30        cmp_ok( $out{unique},     '==',    252983, 'unique words indexed' ); 
    31        cmp_ok( $out{properties}, '==',         5, 'num properties' ); 
    32        cmp_ok( $out{files},      '==',         2, 'files indexed' ); 
    33        cmp_ok( $out{bytes},      '==',   2896130, 'bytes indexed' ); 
    34        cmp_ok( $out{words},      '==',    280381, 'total words indexed' ); 
     29    cmp_ok( scalar(keys(%out)), '>',          2, "Indexing output" );  
     30    cmp_ok( $out{unique},     '==',    252983, 'unique words indexed' ); 
     31    cmp_ok( $out{properties}, '==',         5, 'num properties' ); 
     32    cmp_ok( $out{files},      '==',         2, 'files indexed' ); 
     33    cmp_ok( $out{bytes},      '==',   2896130, 'bytes indexed' ); 
     34    cmp_ok( $out{words},      '==',    280381, 'total words indexed' ); 
    3535 
    3636    DoSearch::open_index( "blib/index/$base.index" ); 
    37        my @rows = DoSearch::do_search( "blib/index/$base.index", "swishe OR test"); 
     37    my @rows = DoSearch::do_search( "blib/index/$base.index", "swishe OR test"); 
    3838    DoSearch::close_index( "blib/index/$base.index" ); 
    39        cmp_ok(scalar(@rows), '==', 2, "num results from 'swishe OR test'")  
     39    cmp_ok(scalar(@rows), '==', 2, "num results from 'swishe OR test'")  
    4040}; 
    4141