make test pass for multicat parsing with two xlsx files for testing.
[sgn.git] / t / unit / CXGN / SplitplotDesign.t
blob1f34da17ec63f3d48a75ef509251d7bad672b580
1 use strict;
2 use warnings;
4 use Test::More;
5 use Test::Exception;
6 use Data::Dumper;
8 BEGIN {use_ok('CXGN::Trial::TrialDesign');}
10 BEGIN {require_ok('Moose');}
11 BEGIN {require_ok('MooseX::FollowPBP');}
12 BEGIN {require_ok('Moose::Util::TypeConstraints');}
13 BEGIN {require_ok('R::YapRI::Base');}
14 BEGIN {require_ok('R::YapRI::Data::Matrix');}
15 BEGIN {require_ok('POSIX');}
17 my $design_type = "splitplot";
18 my %design;
19 my $plot_start_number;
20 my @stock_names;
21 my @stock_list = (1..10);
22 my @treatment_list = ("A","B");
23 my $number_of_blocks = 2;
24 my $layout_format = "zigzag";
25 my $num_plants_per_plt = 5;
27 ok(my $trial_design = CXGN::Trial::TrialDesign->new(), "Create TrialDesign object");
28 $trial_design->set_trial_name("SPLITPLOTTESTTRIAL");
29 ok($trial_design->set_stock_list(\@stock_list), "Set stock names for trial design");
30 is_deeply($trial_design->get_stock_list(),\@stock_list, "Get stock names for trial design");
31 ok($trial_design->set_treatments(\@treatment_list), "Set treatments for trial design");
32 is_deeply($trial_design->get_treatments(),\@treatment_list, "Get treatments for trial design");
33 ok($trial_design->set_number_of_blocks($number_of_blocks), "Set num blocks for trial design");
34 is_deeply($trial_design->get_number_of_blocks(),$number_of_blocks, "Get num blocks for trial design");
35 ok($trial_design->set_plot_layout_format($layout_format), "Set zigzag for trial design");
36 is_deeply($trial_design->get_plot_layout_format(),$layout_format, "Get zigzag for trial design");
37 ok($trial_design->set_num_plants_per_plot($num_plants_per_plt), "Set num_plants_per_plt for trial design");
38 is_deeply($trial_design->get_num_plants_per_plot(),$num_plants_per_plt, "Get num_plants_per_plt for trial design");
40 ok($trial_design->set_design_type($design_type), "Set design type");
41 ok($trial_design->calculate_design(), "Calculate trial design");
42 ok(%design = %{$trial_design->get_design()}, "Get trial design");
43 is($design{'1004'}->{plot_number}, "1004");
44 print STDERR scalar(keys %design)."\n";
45 is(scalar(keys %design), 21, "Result of design");
46 print STDERR Dumper \%design;
48 done_testing();