1 | |
---|---|
2 | // Copyright 2019 Peter Dimov. |
3 | // Distributed under the Boost Software License, Version 1.0. |
4 | |
5 | #include <boost/timer/progress_display.hpp> |
6 | #include <boost/core/lightweight_test.hpp> |
7 | #include <sstream> |
8 | #include <cstddef> |
9 | |
10 | int main() |
11 | { |
12 | int n = 17; |
13 | |
14 | std::ostringstream os; |
15 | boost::timer::progress_display pd( n, os, "L1:", "L2:", "L3:"); |
16 | |
17 | BOOST_TEST_EQ( os.str(), std::string( |
18 | "L1:0% 10 20 30 40 50 60 70 80 90 100%\n" |
19 | "L2:|----|----|----|----|----|----|----|----|----|----|\n" |
20 | "L3:") ); |
21 | |
22 | for( int i = 0; i < n; ++i ) |
23 | { |
24 | std::size_t m1 = os.str().size(); |
25 | ++pd; |
26 | std::size_t m2 = os.str().size(); |
27 | |
28 | BOOST_TEST_LE( m1, m2 ); |
29 | } |
30 | |
31 | BOOST_TEST_EQ( os.str(), std::string( |
32 | "L1:0% 10 20 30 40 50 60 70 80 90 100%\n" |
33 | "L2:|----|----|----|----|----|----|----|----|----|----|\n" |
34 | "L3:***************************************************\n") ); |
35 | |
36 | return boost::report_errors(); |
37 | } |
38 |