Adds debug printing of units in unit tests.

Bug: webrtc:9656
Change-Id: I643b79bc214643f47b2b64967ce713665dbef5c9
Reviewed-on: https://webrtc-review.googlesource.com/95652
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24436}
This commit is contained in:
Sebastian Jansson
2018-08-23 14:44:05 +02:00
committed by Commit Bot
parent 1946a3f0fe
commit 2afd281ec4
8 changed files with 70 additions and 3 deletions

View File

@ -22,7 +22,12 @@ std::string ToString(const TimeDelta& value) {
} else if (value.IsMinusInfinity()) {
sb << "-inf ms";
} else {
sb << value.ms() << " ms";
if (value.us() == 0 || (value.us() % 1000) != 0)
sb << value.us() << " us";
else if (value.ms() % 1000 != 0)
sb << value.ms() << " ms";
else
sb << value.seconds() << " s";
}
return sb.str();
}