7 #include "zypp/base/Logger.h"
8 #include "zypp/base/Exception.h"
10 #include <boost/test/unit_test.hpp>
12 #include "zypp/ProgressData.h"
14 using boost::unit_test::test_case;
19 BOOST_AUTO_TEST_CASE(progressdata_test)
22 ProgressData progress(100);
23 CombinedProgressData sub1rcv(progress, 80);
25 ProgressData sub1progress(100);
26 sub1progress.sendTo(sub1rcv);
30 // which is 50% of 80% in task 1
31 BOOST_CHECK_EQUAL( progress.val(), 40 );
35 ProgressData progress(40000);
36 CombinedProgressData sub2rcv(progress, 10000);
38 ProgressData sub2progress(500);
39 sub2progress.sendTo(sub2rcv);
40 sub2progress.set(250);
42 // which is 50% of 80% in task 1
43 BOOST_CHECK_EQUAL( progress.val(), 5000 );
47 ProgressData progress(20000,60000);
48 CombinedProgressData sub2rcv(progress, 10000);
50 ProgressData sub2progress(500);
51 sub2progress.sendTo(sub2rcv);
52 sub2progress.set(250);
54 // which is 50% of 80% in task 1
55 BOOST_CHECK_EQUAL( progress.val(), 25000 );