- rework the testsuite after new boost in factory broke it.
[platform/upstream/libzypp.git] / tests / zypp / ProgressData_test.cc
1
2 #include <iostream>
3 #include <fstream>
4 #include <list>
5 #include <string>
6
7 #include "zypp/base/Logger.h"
8 #include "zypp/base/Exception.h"
9
10 #include <boost/test/unit_test.hpp>
11
12 #include "zypp/ProgressData.h"
13
14 using boost::unit_test::test_case;
15
16 using namespace std;
17 using namespace zypp;
18
19 BOOST_AUTO_TEST_CASE(progressdata_test)
20 {
21   {
22     ProgressData progress(100);
23     CombinedProgressData sub1rcv(progress, 80);
24     
25     ProgressData sub1progress(100);
26     sub1progress.sendTo(sub1rcv);
27     
28     // task 1 goes to 50%
29     sub1progress.set(50);
30     // which is 50% of 80% in task 1
31     BOOST_CHECK_EQUAL( progress.val(), 40 );
32   }
33   
34   {
35     ProgressData progress(40000);
36     CombinedProgressData sub2rcv(progress, 10000);
37     
38     ProgressData sub2progress(500);
39     sub2progress.sendTo(sub2rcv);
40     sub2progress.set(250);
41     
42     // which is 50% of 80% in task 1
43     BOOST_CHECK_EQUAL( progress.val(), 5000 );
44   }
45   
46   {
47     ProgressData progress(20000,60000);
48     CombinedProgressData sub2rcv(progress, 10000);
49     
50     ProgressData sub2progress(500);
51     sub2progress.sendTo(sub2rcv);
52     sub2progress.set(250);
53     
54     // which is 50% of 80% in task 1
55     BOOST_CHECK_EQUAL( progress.val(), 25000 );
56   }
57   
58 }
59    
60