From 38b5f26e19facc5571723d122f4fa97eea8ba395 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 9 Feb 2015 11:25:52 -0600 Subject: Adding time checking in --- tests/indicator-fixture.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/indicator-fixture.h') diff --git a/tests/indicator-fixture.h b/tests/indicator-fixture.h index 2948e6b..e16d254 100644 --- a/tests/indicator-fixture.h +++ b/tests/indicator-fixture.h @@ -33,6 +33,8 @@ class IndicatorFixture : public ::testing::Test std::string _indicatorPath; std::string _indicatorAddress; std::vector> _mocks; + protected: + std::chrono::milliseconds _eventuallyTime; class PerRunData { public: @@ -118,6 +120,7 @@ class IndicatorFixture : public ::testing::Test const std::string& addr) : _indicatorPath(path) , _indicatorAddress(addr) + , _eventuallyTime(std::chrono::seconds(5)) { }; @@ -202,14 +205,15 @@ class IndicatorFixture : public ::testing::Test std::promise retpromise; auto retfuture = retpromise.get_future(); + auto start = std::chrono::steady_clock::now(); /* The core of the idle function as an object so we can use the C++-isms of attaching the variables and make this code reasonably readable */ - auto idlefunc = [&loop, &retpromise, &testfunc]() -> void { + auto idlefunc = [&loop, &retpromise, &testfunc, &start, this]() -> void { auto result = testfunc(); + g_debug("Idle Ran"); - if (result == false) { - /* TODO: Check time */ + if (result == false && _eventuallyTime > (std::chrono::steady_clock::now() - start)) { return; } -- cgit v1.2.3