6 #use lib "$Bin/../lib";
15 my $verbose = $parms{'verbose'};
16 my $directory = $parms{'directory'};
18 my ($tests_passed, $tests_performed) = (0,0);
20 my $data = data
-> new
( filename
=> 'data_set_1.dta',
21 directory
=> $directory.'/files/data_test_dir',
25 print "\tdata: testing directory member\t\t\t... " if $verbose;
27 my $correct_value = $directory . 'files/data_test_dir/';
28 my $real_value = $data -> directory
;
29 if( $correct_value eq $real_value ){
30 print " OK \n" if $verbose;
33 print "FAILED: \n\t$correct_value not equal $real_value\n" if $verbose;
39 print "\tdata: testing full_name\t\t\t\t... " if $verbose;
41 my $correct_value = $directory . 'files/data_test_dir/data_set_1.dta';
42 my $real_value = $data -> full_name
;
43 if( $correct_value eq $real_value ){
44 print " OK \n" if $verbose;
47 print "FAILED: $correct_value not equal $real_value\n" if $verbose;
52 print "\tdata: testing bootstrap:ing of data\t\t... " if $verbose;
55 my ( $new_datas, $incl_ids, $incl_keys )
56 = $data -> bootstrap
( directory
=> $directory ,
57 name_stub
=> 'files/data_test_dir/bs_pr' ,
61 foreach my $data ( @
{$new_datas} ){
62 unless( ref $data eq 'data' ){
63 print "FAILED: bootstrap doesn't return data objects\n" if $verbose;
68 $tests_passed ++ unless( $failed );
74 my $correct_value = [[0,0,3.5,0,17.0,25.0,0,3.0,0,3.0,0,0,3.0,0,20.0,3.2,4.0,11.0,4.0,27.0,0,0,3.5,0,25.0,2.5,17.0,6.0,0,7.5,4.0,0,0,15.0,2.4,2.5,2.4,0,0,0,32.0,0,0,0,5.0,0,1.7,0,2.5,22.8,0,3.2,9.0,0,4.5,17.0,0,0,0,0,0,56.0,4.3,60.0,3.3,0,0,0,40.0,0,30.0,0,0,35.0,0,0,0,25.0,0,4.3,0,0,22.0,0,2.5,4.0,1.5,3.0,4.0,0,2.8,0,4.4,0,30.0,0,3.0,25.0,0,15.0,3.3,70.0,0,56.0,0,0,0,0,56.0,0,0,3.4,24.0,3.3,0,0,2.5,26.0,0,2.5,0,7.0,0,0,0,26.0,0,0,0,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0,7.5,0,0,26.0,0,0,9.0,4.0,0,0,7.5,2.4,70.0,0,0,0,10.0,3.5,0,30.0,3.7,0,0,3.5,9.5,4.0,0,0,7.5,0,9.5,0,0,2.5,0,0,19.0,2.8,70.0,0,6.0,0,2.4,3.5,0,3.0,14.0,20.0,0,3.3,0,0,0,4.0,0,4.0,0,0,1.5,14.0,9.5,0,24.0,9.0,0,2.5,20.0,0,2.0,7.5,0,0,3.0,0,0,25.0,0,6.0,0,3.0,0,0,0,34.0,0,0,24.0,0,0,2.5,9.0,20.0,3.5,0,0,0,0,0,0,0,0,2.8,9.0,0,4.0,0,70.0,11.0,0,0,0,18.0,7.5,0,0,0,27.0,2.8,2.5,0,0,6.0,0,0,3.5,28.0,0,0,2.5,0,17.0,20.0,0,1.5,3.0,0,0,3.0,1.7,0,2.5,0,4.5,2.5,0,0,0,0,3.4,3.4,0,0,0,0,25.0,0,0,3.0,4.4,3.5,0,34.0,27.0,0,4.0,0,0,3.0,2.5,0,0,4.4,6.0,0,15.0,2.5,0,0,26.0,0,0,0,1.7,0,0,0,1.7,4.4,0,20.0,27.0,0,0,0,0,3.0,1.7,4.3,17.5,7.5,0,0,5.0,22.8,2.0,12.0,0,3.0,10.0,5.0,27.0,],];
79 OUTER
: for(my $i = 0; $i <= $#{$incl_ids}; $i++ ){
80 my $ids_inner = $incl_ids -> [$i];
82 for(my $j = 0; $j <= $#{$ids_inner};$j++){
83 # print $ids_inner -> [$j] , ",";
84 if( $ids_inner -> [$j] != $correct_value -> [$i] -> [$j] ){
85 print $ids_inner -> [$j], " ", $correct_value -> [$i] -> [$j] , "\n";
86 print "FAILED: bootstrap doesn't include the correct IDs\n" if $verbose;
95 $tests_passed ++ unless( $failed );
101 #print "\n", @{@{$incl_ids}[0]}, "\n", @{$incl_keys}, "\n";
140 # renumber_descending
152 # _fisher_yates_shuffle
154 # _read_first_individual
160 return ( $tests_passed, $tests_performed );