~ubuntu-branches/ubuntu/natty/koffice/natty-security

« back to all changes in this revision

Viewing changes to kplato/libs/kernel/tests/PerformanceTester.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2011-01-19 12:29:32 UTC
  • mfrom: (0.17.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110119122932-8acdswnc4rc2owxq
Tags: 1:2.3.1-0ubuntu1
* New upstream release
* Add kubuntu_03_libwpg_02.diff from Fedora for libwpg 0.2 support,
  add back libwpg-dev build-depend
* Depend on libwpd-dev not libwpd8-dev
* Remove kubuntu_02_kpresenterpart.diff now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    delete p1;
37
37
    p1 = 0;
38
38
    r1 = 0;
 
39
    r2 = 0;
 
40
    s1 = 0;
39
41
    t1 = 0;
 
42
    s2 = 0;
40
43
    m1 = 0;
41
44
}
42
45
 
59
62
    }
60
63
    p1->addCalendar( c );
61
64
 
62
 
    t1 = p1->createTask( p1 );
 
65
    s1 = p1->createTask( p1 );
 
66
    s1->setName( "S1" );
 
67
    p1->addTask( s1, p1 );
 
68
 
 
69
    t1 = p1->createTask( s1 );
63
70
    t1->setName( "T1" );
64
71
    t1->estimate()->setUnit( Duration::Unit_d );
65
72
    t1->estimate()->setExpectedEstimate( 5.0 );
66
73
    t1->estimate()->setType( Estimate::Type_Effort );
67
 
    p1->addTask( t1, p1 );
 
74
    p1->addSubTask( t1, s1 );
68
75
    
69
 
    m1 = p1->createTask( p1 );
 
76
    s2 = p1->createTask( p1 );
 
77
    s2->setName( "S2" );
 
78
    p1->addTask( s2, p1 );
 
79
 
 
80
    m1 = p1->createTask( s2 );
70
81
    m1->estimate()->setExpectedEstimate( 0 );
71
82
    m1->setName( "M1" );
72
 
    p1->addTask( m1, p1 );
 
83
    p1->addSubTask( m1, s2 );
73
84
    
74
85
    ResourceGroup *g = new ResourceGroup();
75
86
    g->setName( "G1" );
96
107
    r2->setNormalRate( 0.0 ); // NOTE
97
108
    p1->addResource( m, r2 );
98
109
 
 
110
    r3 = new Resource();
 
111
    r3->setName( "Material 2" );
 
112
    r3->setType( Resource::Type_Material );
 
113
    r3->setNormalRate( 6.0 );
 
114
    p1->addResource( m, r3 );
 
115
 
99
116
    gr = new ResourceGroupRequest( m );
100
117
    t1->addRequest( gr );
101
118
    rr = new ResourceRequest( r2, 100 );
167
184
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
168
185
    QCOMPARE( ecm.costOnDate( d ), 8.5 );
169
186
 
 
187
    // check sub-task
 
188
    d = t1->startTime().date();
 
189
    ecm = s1->bcwsPrDay();
 
190
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
 
191
    QCOMPARE( ecm.costOnDate( d ), 8.5 );
 
192
 
 
193
    d = s1->endTime().date();
 
194
    ecm = s1->bcwsPrDay();
 
195
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
 
196
    QCOMPARE( ecm.costOnDate( d ), 8.5 );
170
197
}
171
198
 
172
199
void PerformanceTester::bcwpPrDayTask()
254
281
    d = t1->startTime().date();
255
282
    ecm = t1->bcwpPrDay();
256
283
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 8.0 );
257
 
    QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.05 ); //10% progress
 
284
    QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.5 ); //10% progress
258
285
 
259
286
    // add shutdown cost
260
287
    t1->setShutdownCost( 0.5 );
265
292
    Debug::print( t1->completion(), t1->name(), "BCWP Performance with shutdown cost" );
266
293
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 80.0 );
267
294
    QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.5 ); //100% progress
 
295
 
 
296
    // check sub-task
 
297
    d = s1->startTime().date();
 
298
    ecm = s1->bcwpPrDay();
 
299
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 8.0 );
 
300
    QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.5 ); //10% progress
 
301
 
 
302
    // add shutdown cost
 
303
    d = s1->endTime().date();
 
304
    ecm = s1->bcwpPrDay();
 
305
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 80.0 );
 
306
    QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.5 ); //100% progress
268
307
}
269
308
 
270
309
void PerformanceTester::acwpPrDayTask()
366
405
    Debug::print( t1->completion(), t1->name(), "ACWP Performance with shutdown cost" );
367
406
    QCOMPARE( eca.hoursOnDate( d ), 12.0 );
368
407
    QCOMPARE( eca.costOnDate( d ), 12.25 );
 
408
 
 
409
    // check sub-task
 
410
    d = s1->startTime().date();
 
411
    eca = s1->acwp();
 
412
    QCOMPARE( eca.hoursOnDate( d ), 8.0 );
 
413
    QCOMPARE( eca.costOnDate( d ), 8.5 );
 
414
 
 
415
    // add shutdown cost
 
416
    d = s1->endTime().date();
 
417
    eca = s1->acwp();
 
418
    QCOMPARE( eca.hoursOnDate( d ), 12.0 );
 
419
    QCOMPARE( eca.costOnDate( d ), 12.25 );
369
420
}
370
421
 
371
422
void PerformanceTester::bcwsMilestone()
432
483
    Debug::print( ecm, "BCWP Milestone" );
433
484
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 0.0 );
434
485
    QCOMPARE( ecm.bcwpCostOnDate( d ), 0.75 );
 
486
 
 
487
    // check sub-milestone
 
488
    d = s2->startTime().date();
 
489
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 0.0 );
 
490
    QCOMPARE( ecm.bcwpCostOnDate( d ), 0.75 );
435
491
}
436
492
 
437
493
void PerformanceTester::acwpMilestone()
463
519
    Debug::print( m1->completion(), m1->name(), "ACWP Milestone with shutdown cost" );
464
520
    QCOMPARE( eca.hoursOnDate( d ), 0.0 );
465
521
    QCOMPARE( eca.costOnDate( d ), 0.75 );
 
522
 
 
523
    // check sub-milestone
 
524
    d = s2->endTime().date();
 
525
    eca = s2->acwp();
 
526
    QCOMPARE( eca.hoursOnDate( d ), 0.0 );
 
527
    QCOMPARE( eca.costOnDate( d ), 0.75 );
466
528
}
467
529
 
468
530
void PerformanceTester::bcwsPrDayTaskMaterial()
476
538
    d = d.addDays( 1 );
477
539
    ecm = t1->bcwsPrDay();
478
540
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) ); //material+work resource
479
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
480
541
    QCOMPARE( ecm.costOnDate( d ), 8.8 );
481
542
    
482
543
    d = d.addDays( 1 );
483
544
    ecm = t1->bcwsPrDay();
484
545
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
485
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
486
 
    QCOMPARE( ecm.costOnDate( d ), 8.8 );
487
 
 
488
 
    d = d.addDays( 1 );
489
 
    ecm = t1->bcwsPrDay();
490
 
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
491
 
//     QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
492
 
    QCOMPARE( ecm.costOnDate( d ), 8.8 );
493
 
 
494
 
    d = d.addDays( 1 );
495
 
    ecm = t1->bcwsPrDay();
496
 
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
497
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
498
 
    QCOMPARE( ecm.costOnDate( d ), 8.8 );
499
 
 
500
 
    d = d.addDays( 1 );
501
 
    ecm = t1->bcwsPrDay();
502
 
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
503
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
 
546
    QCOMPARE( ecm.costOnDate( d ), 8.8 );
 
547
 
 
548
    d = d.addDays( 1 );
 
549
    ecm = t1->bcwsPrDay();
 
550
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
 
551
    QCOMPARE( ecm.costOnDate( d ), 8.8 );
 
552
 
 
553
    d = d.addDays( 1 );
 
554
    ecm = t1->bcwsPrDay();
 
555
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
 
556
    QCOMPARE( ecm.costOnDate( d ), 8.8 );
 
557
 
 
558
    d = d.addDays( 1 );
 
559
    ecm = t1->bcwsPrDay();
 
560
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
504
561
    QCOMPARE( ecm.costOnDate( d ), 8.8 );
505
562
 
506
563
    d = d.addDays( 1 );
514
571
    d = t1->startTime().date();
515
572
    ecm = t1->bcwsPrDay();
516
573
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
517
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
518
574
    QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.5 + 0.8 );
519
575
 
520
576
    // add shutdown cost
523
579
    d = t1->endTime().date();
524
580
    ecm = t1->bcwsPrDay();
525
581
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
526
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
527
 
    QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.25 + 0.8 );
528
 
 
 
582
    QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.25 + 0.8 );
 
583
 
 
584
    // check sub-task
 
585
    d = s1->startTime().date();
 
586
    ecm = s1->bcwsPrDay();
 
587
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
 
588
    QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.5 + 0.8 );
 
589
 
 
590
    d = s1->endTime().date();
 
591
    ecm = s1->bcwsPrDay();
 
592
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
 
593
    QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.25 + 0.8 );
529
594
}
530
595
 
531
596
void PerformanceTester::bcwpPrDayTaskMaterial()
535
600
    QDate d = t1->startTime().date();
536
601
    EffortCostMap ecm = t1->bcwpPrDay();
537
602
    QCOMPARE( ecm.effortOnDate( d ), Duration( 0, 16, 0 ) );
538
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
539
603
    QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.8 );
540
604
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 0.0 );
541
605
    QCOMPARE( ecm.bcwpCostOnDate( d ), 0.0 );
545
609
    delete cmd;
546
610
    ecm = t1->bcwpPrDay();
547
611
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 8.0 );
548
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
549
612
    QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.4 );
550
613
    
551
614
    d = d.addDays( 1 );
554
617
    delete cmd;
555
618
    ecm = t1->bcwpPrDay();
556
619
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 16.0 );
557
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
558
620
    QCOMPARE( ecm.bcwpCostOnDate( d ), 8.0 + 0.8 );
559
621
 
560
622
    d = d.addDays( 1 );
563
625
    delete cmd;
564
626
    ecm = t1->bcwpPrDay();
565
627
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 24.0 );
566
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
567
628
    QCOMPARE( ecm.bcwpCostOnDate( d ), 12.0 + 1.2 );
568
629
 
569
630
    d = d.addDays( 1 );
572
633
    delete cmd;
573
634
    ecm = t1->bcwpPrDay();
574
635
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 32.0 );
575
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
576
636
    QCOMPARE( ecm.bcwpCostOnDate( d ), 16.0 + 1.6 );
577
637
 
578
638
    d = d.addDays( 1 );
581
641
    delete cmd;
582
642
    ecm = t1->bcwpPrDay();
583
643
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 40.0 );
584
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
585
644
    QCOMPARE( ecm.bcwpCostOnDate( d ), 20.0 + 2.0 );
586
645
 
587
646
    // modify last day
590
649
    delete cmd;
591
650
    ecm = t1->bcwpPrDay();
592
651
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 80.0 );
593
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
594
652
    QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 4.0 );
595
653
 
596
654
    // add startup cost
599
657
    d = t1->startTime().date();
600
658
    ecm = t1->bcwpPrDay();
601
659
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 8.0 );
602
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
603
 
    QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.05 + 0.4 ); // 10% progress
 
660
    QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.5 + 0.4 ); // 10% progress
604
661
 
605
662
    // add shutdown cost
606
663
    t1->setShutdownCost( 0.25 );
610
667
    ecm = t1->bcwpPrDay();
611
668
    Debug::print( t1->completion(), t1->name(), "BCWP Material with shutdown cost" );
612
669
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 80.0 );
613
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
614
 
    QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.25 + 4.0 ); // 100% progress
 
670
    QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.25 + 4.0 ); // 100% progress
 
671
 
 
672
    // check sub-task
 
673
    d = s1->startTime().date();
 
674
    ecm = s1->bcwpPrDay();
 
675
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 8.0 );
 
676
    QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.5 + 0.4 ); // 10% progress
 
677
 
 
678
    d = s1->endTime().date();
 
679
    ecm = s1->bcwpPrDay();
 
680
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 80.0 );
 
681
    QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.25 + 4.0 ); // 100% progress
 
682
 
615
683
}
616
684
 
617
685
void PerformanceTester::acwpPrDayTaskMaterial()
628
696
    EffortCostMap eca = t1->acwp();
629
697
 
630
698
    QCOMPARE( ecb.effortOnDate( d ), Duration( 0, 16, 0 ) );
631
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
632
699
    QCOMPARE( ecb.costOnDate( d ), 8.0 + 0.8 );
633
700
    QCOMPARE( ecb.bcwpEffortOnDate( d ), 0.0 );
634
701
    QCOMPARE( ecb.bcwpCostOnDate( d ), 0.0 );
644
711
//     Debug::print( t1->completion(), t1->name(), QString( "ACWP on date: %1" ).arg( d.toString( Qt::ISODate ) ) );
645
712
//     Debug::print( eca, "ACWP" );
646
713
    QCOMPARE( ecb.bcwpEffortOnDate( d ), 8.0 );
647
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
648
714
    QCOMPARE( ecb.bcwpCostOnDate( d ), 4.0 + 0.4 );
649
715
    QCOMPARE( eca.hoursOnDate( d ), 8.0 );
650
716
    QCOMPARE( eca.costOnDate( d ), 8.0 );
657
723
    ecb = t1->bcwpPrDay();
658
724
    eca = t1->acwp();
659
725
    QCOMPARE( ecb.bcwpEffortOnDate( d ), 16.0 );
660
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
661
726
    QCOMPARE( ecb.bcwpCostOnDate( d ), 8.0 + 0.8 );
662
727
    QCOMPARE( eca.hoursOnDate( d ), 6.0 );
663
728
    QCOMPARE( eca.costOnDate( d ), 6.0 );
670
735
    ecb = t1->bcwpPrDay();
671
736
    eca = t1->acwp();
672
737
    QCOMPARE( ecb.bcwpEffortOnDate( d ), 24.0 );
673
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
 
738
 
674
739
    QCOMPARE( ecb.bcwpCostOnDate( d ), 12.0 + 1.2 );
675
740
    QCOMPARE( eca.hoursOnDate( d ), 8.0 );
676
741
    QCOMPARE( eca.costOnDate( d ), 8.0 );
683
748
    ecb = t1->bcwpPrDay();
684
749
    eca = t1->acwp();
685
750
    QCOMPARE( ecb.bcwpEffortOnDate( d ), 40.0 );
686
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
687
751
    QCOMPARE( ecb.bcwpCostOnDate( d ), 20.0 + 2.0 );
688
752
    QCOMPARE( eca.hoursOnDate( d ), 8.0 );
689
753
    QCOMPARE( eca.costOnDate( d ), 8.0 );
696
760
    ecb = t1->bcwpPrDay();
697
761
    eca = t1->acwp();
698
762
    QCOMPARE( ecb.bcwpEffortOnDate( d ), 64.0 );
699
 
//    QEXPECT_FAIL( "", "Material resource cost is not included" , Continue );
700
763
    QCOMPARE( ecb.bcwpCostOnDate( d ), 32.0 + 3.2 );
701
764
    QCOMPARE( eca.hoursOnDate( d ), 12.0 );
702
765
    QCOMPARE( eca.costOnDate( d ), 12.0 );
721
784
    Debug::print( t1->completion(), t1->name(), "ACWP Performance with shutdown cost" );
722
785
    QCOMPARE( eca.hoursOnDate( d ), 12.0 );
723
786
    QCOMPARE( eca.costOnDate( d ), 12.0 + 0.25 ); //NOTE: material not included
 
787
 
 
788
    // check sub-task
 
789
    d = s1->startTime().date();
 
790
    eca = s1->acwp();
 
791
    QCOMPARE( eca.hoursOnDate( d ), 8.0 );
 
792
    QCOMPARE( eca.costOnDate( d ), 8.0 + 0.5 ); //NOTE: material not included
 
793
 
 
794
    // add shutdown cost
 
795
    d = s1->endTime().date();
 
796
    eca = s1->acwp();
 
797
    QCOMPARE( eca.hoursOnDate( d ), 12.0 );
 
798
    QCOMPARE( eca.costOnDate( d ), 12.0 + 0.25 ); //NOTE: material not included
724
799
}
725
800
 
726
801
void PerformanceTester::bcwsPrDayProject()
874
949
    d = p1->startTime().date();
875
950
    ecm = p1->bcwpPrDay();
876
951
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 8.0 );
877
 
    QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.05 ); // 10% progress
 
952
    QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.5 ); // 10% progress
878
953
 
879
954
    // add shutdown cost to task
880
955
    t1->setShutdownCost( 0.25 );
884
959
    ecm = p1->bcwpPrDay();
885
960
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 80.0 );
886
961
    QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.25 ); // 100% progress
 
962
 
 
963
    // check with ECCT_EffortWork
 
964
    
 
965
    d = p1->startTime().date();
 
966
    ecm = p1->bcwpPrDay( CURRENTSCHEDULE, ECCT_EffortWork );
 
967
    QCOMPARE( ecm.totalEffort(), Duration( 40.0, Duration::Unit_h ) );
 
968
    QCOMPARE( ecm.hoursOnDate( d ), 8.0 ); // hours from r1
 
969
    QCOMPARE( ecm.costOnDate( d ), 8.0 + 0.5 ); // cost from r1 (1.0) + r2 (0.0) + startup cost (0.5)
 
970
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 4.0 ); // 10% progress
 
971
    QCOMPARE( ecm.bcwpCostOnDate( d ), 4.0 + 0.5 ); // 10% progress
 
972
 
 
973
    d = p1->endTime().date();
 
974
    ecm = p1->bcwpPrDay( CURRENTSCHEDULE, ECCT_EffortWork );
 
975
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 40.0 ); // hours from r1
 
976
    QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.25 ); // 100% progress
 
977
 
 
978
    // add a new task with a material resource
 
979
    Task *tt = p1->createTask( p1 );
 
980
    tt->setName( "TT" );
 
981
    p1->addTask( tt, p1 );
 
982
    tt->estimate()->setUnit( Duration::Unit_d );
 
983
    tt->estimate()->setExpectedEstimate( 5.0 );
 
984
    tt->estimate()->setType( Estimate::Type_Duration );
 
985
    tt->estimate()->setCalendar( p1->calendarAt( 0 ) );
 
986
 
 
987
    r3->setNormalRate( 1.0 );
 
988
 
 
989
    ResourceGroupRequest *gr = new ResourceGroupRequest( r3->parentGroup() );
 
990
    tt->addRequest( gr );
 
991
    ResourceRequest *rr = new ResourceRequest( r3, 100 );
 
992
    gr->addResourceRequest( rr );
 
993
 
 
994
    ScheduleManager *sm = p1->createScheduleManager( "" );
 
995
    p1->addScheduleManager( sm );
 
996
    sm->createSchedules();
 
997
    p1->calculate( *sm );
 
998
 
 
999
    QString s = " Material resource, no progress ";
 
1000
    Debug::print( tt, s, true );
 
1001
 
 
1002
    d = tt->endTime().date();
 
1003
    ecm = tt->bcwpPrDay( sm->scheduleId(), ECCT_EffortWork );
 
1004
    Debug::print( ecm, "BCWP: " + tt->name() + s );
 
1005
 
 
1006
    QCOMPARE( ecm.hoursOnDate( d ), 0.0 );
 
1007
    QCOMPARE( ecm.costOnDate( d ), 16.0 );
 
1008
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 0.0 );
 
1009
    QCOMPARE( ecm.bcwpCostOnDate( d ), 0.0 ); // 0% progress
 
1010
 
 
1011
    d = p1->endTime().date();
 
1012
    ecm = p1->bcwpPrDay( sm->scheduleId(), ECCT_EffortWork );
 
1013
    Debug::print( p1, s, true );
 
1014
    Debug::print( ecm, "BCWP Project: " + p1->name() + s );
 
1015
    QCOMPARE( ecm.bcwpEffortOnDate( d ), 40.0 ); // hours from r1
 
1016
    QCOMPARE( ecm.bcwpCostOnDate( d ), 40.0 + 0.5 + 0.25 );
887
1017
}
888
1018
 
889
1019
void PerformanceTester::acwpPrDayProject()
968
1098
    t1->completion().setStartTime( t1->startTime() );
969
1099
    t1->completion().setStarted( true );
970
1100
    t1->setStartupCost( 0.5 );
971
 
    d = t1->startTime().date();
 
1101
    d = p1->startTime().date();
972
1102
    eca = p1->acwp();
973
1103
    QCOMPARE( eca.hoursOnDate( d ), 8.0 );
974
1104
    QCOMPARE( eca.costOnDate( d ), 8.0 + 0.5 );
980
1110
    cmd->execute(); delete cmd;
981
1111
    t1->completion().setFinished( true );
982
1112
    t1->completion().setFinishTime( t1->endTime() );
 
1113
    d = p1->endTime().date();
983
1114
    eca = p1->acwp();
984
1115
    QCOMPARE( eca.hoursOnDate( d ), 12.0 );
985
1116
    QCOMPARE( eca.costOnDate( d ), 12.25 );
986
 
 
987
1117
}
988
1118
 
989
1119
} //namespace KPlato