Be More Forgiving in EXPECT_ALMOST()

(This is a merge of http://go/wvgerrit/14776)

This change widens the range in EXPECT_ALMOST slightly, to allow for
slight timing errors in the tests.

Bug: 21489628
Change-Id: Ibb074c2d037566c307c0438efdda3841bc48f7ed
This commit is contained in:
John "Juce" Bruce
2015-06-18 19:00:06 -07:00
parent 57fd014f6d
commit 6a773e3630

View File

@@ -59,6 +59,7 @@ const int kShortSleep = 1 * kSpeedMultiplier;
const int kLongSleep = 2 * kSpeedMultiplier;
const uint32_t kDuration = 2 * kSpeedMultiplier;
const uint32_t kLongDuration = 5 * kSpeedMultiplier;
const uint32_t kAlmostRange = 3 * kSpeedMultiplier;
} // namespace
namespace wvoec {
@@ -736,9 +737,9 @@ static void dump_openssl_error() {
}
// We don't expect exact timing.
#define EXPECT_ALMOST(A, B) \
EXPECT_GE(A + kSpeedMultiplier, B); \
EXPECT_LE(A - kSpeedMultiplier, B);
#define EXPECT_ALMOST(A, B) \
EXPECT_GE(A + kAlmostRange, B); \
EXPECT_LE(A - kAlmostRange, B);
class Session {
public: