| 1 |
#include <pbcopper/utility/Stopwatch.h> |
| 2 |
|
| 3 |
#include <chrono> |
| 4 |
|
| 5 |
#include <gtest/gtest.h> |
| 6 |
|
| 7 |
TEST(Utility_Stopwatch, can_pretty_print_time) |
| 8 |
{ |
| 9 |
auto prettyPrintHours = [](int hours) { |
| 10 |
return PacBio::Utility::Stopwatch::PrettyPrintNanoseconds( |
| 11 |
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::hours(hours)) |
| 12 |
.count()); |
| 13 |
}; |
| 14 |
|
| 15 |
EXPECT_EQ("4h ", prettyPrintHours(4)); |
| 16 |
EXPECT_EQ("4d ", prettyPrintHours(4 * 24)); |
| 17 |
EXPECT_EQ("4d 1h ", prettyPrintHours(4 * 24 + 1)); |
| 18 |
} |