23TEST_CASE(
"Default OpenMP loop watcher tracks and reports progress",
"[ipc::ompLoopWatcher][default]" )
25 std::ostringstream output;
30 for(
int iteration = 0; iteration < 9; ++iteration )
34 REQUIRE( output.str().empty() );
37 REQUIRE( output.str().find(
"3 / 20 (15%)" ) != std::string::npos );
38 REQUIRE( output.str().find(
"s/loop" ) != std::string::npos );
39 REQUIRE( output.str().find(
"s left" ) != std::string::npos );
40 REQUIRE( output.str().back() ==
'\r' );
44 for(
int iteration = 0; iteration < 10; ++iteration )
48 REQUIRE( output.str().find(
"13 / 20 (65%)" ) != std::string::npos );
52 for(
int iteration = 0; iteration < 10; ++iteration )
56 REQUIRE( output.str().find(
"23 / 20 (115%)" ) != std::string::npos );
61 REQUIRE( output.str().find(
"s elapsed" ) != std::string::npos );
62 REQUIRE( output.str().find(
"s/loop" ) != std::string::npos );
63 REQUIRE( output.str().back() ==
'\r' );
68 REQUIRE( output.str().find_first_not_of(
' ' ) == output.str().size() - 1 );
69 REQUIRE( output.str().back() ==
'\r' );
76TEST_CASE(
"OpenMP loop watcher honors formatting policies",
"[ipc::ompLoopWatcher][format]" )
78 std::ostringstream prettyOutput;
80 for(
int iteration = 0; iteration < 10; ++iteration )
84 REQUIRE( prettyOutput.str().find(
"10 / 4 (250%)" ) != std::string::npos );
85 REQUIRE( prettyOutput.str().back() ==
'\n' );
87 prettyOutput.str(
"" );
90 REQUIRE( prettyOutput.str().find(
"s elapsed" ) != std::string::npos );
91 REQUIRE( prettyOutput.str().back() ==
'\n' );
93 std::ostringstream rawOutput;
95 for(
int iteration = 0; iteration < 10; ++iteration )
99 REQUIRE( rawOutput.str().find(
"108125" ) == 0 );
100 REQUIRE( rawOutput.str().back() ==
'\n' );
105 REQUIRE_FALSE( rawOutput.str().empty() );
106 REQUIRE( rawOutput.str().front() ==
' ' );
107 REQUIRE( rawOutput.str().back() ==
'\n' );
109 std::ostringstream terseOutput;
111 for(
int iteration = 0; iteration < 10; ++iteration )
115 REQUIRE( terseOutput.str() ==
"10" );
117 terseOutput.str(
"" );
120 REQUIRE( terseOutput.str().empty() );
122 REQUIRE( terseOutput.str().empty() );