13 #include <gtest/gtest.h>
17 using namespace std::chrono_literals;
20 TEST(TestParseRsyncProgress, Invalid) {
27 <<
"aB/s should not be accepted";
29 <<
"bad unit should not be accepted";
31 <<
"Comma separated speed should not be accepted";
33 <<
"Semi-colon separated time should not be accepted";
35 <<
"Period separated time should not be accepted";
38 TEST(TestParseRsyncProgress, Initial) {
41 EXPECT_NEAR(p->progress, 0.f, 0.01);
42 EXPECT_NEAR(p->speed, 0.f, 0.01);
46 TEST(TestParseRsyncProgress, Mid1) {
49 EXPECT_NEAR(p->progress, 0.33f, 0.01);
50 EXPECT_NEAR(p->speed, 344.5 * 1024 * 1024, 0.01);
54 TEST(TestParseRsyncProgress, Mid2) {
57 EXPECT_NEAR(p->progress, 0.0f, 0.01);
58 EXPECT_NEAR(p->speed, 200.09 * 1024, 0.01);
59 EXPECT_EQ(p->remaining, 1h + 28min + 51s);
62 TEST(TestParseRsyncProgress, Final) {
65 EXPECT_NEAR(p->progress, 1.f, 0.01);
66 EXPECT_NEAR(p->speed, 344.5 * 1024.0f * 1024.0f, 0.01);
TEST(TestParseRsyncProgress, Invalid)
std::optional< RsyncProgress > ParseRsyncProgress(std::string const &line) noexcept
Parse progress update from rsync.
daq::RsyncAsyncProcess and related class declarations.
EXPECT_EQ(meta.rr_uri, "zpb.rr://meta")