tests: increase canonize timeout in FaceUri tests to avoid spurious failures
Also fix "succeed" vs "fail" in diagnostic message.
Change-Id: Id21baeb072a9c71caa0fd8b57ac4a00aa98a51cc
Refs: #2148
diff --git a/tests/unit-tests/util/face-uri.t.cpp b/tests/unit-tests/util/face-uri.t.cpp
index 5ae5e28..c3246a7 100644
--- a/tests/unit-tests/util/face-uri.t.cpp
+++ b/tests/unit-tests/util/face-uri.t.cpp
@@ -57,22 +57,22 @@
}
private:
- struct CanonizeTestCase
+ class CanonizeTestCase
{
public:
CanonizeTestCase(const std::string& request,
bool shouldSucceed, const std::string& expectedUri)
- : m_request(request)
- , m_shouldSucceed(shouldSucceed)
+ : m_shouldSucceed(shouldSucceed)
, m_expectedUri(expectedUri)
+ , m_message(request + " should " + (shouldSucceed ? "succeed" : "fail"))
, m_isCompleted(false)
{
}
public:
- std::string m_request;
bool m_shouldSucceed;
std::string m_expectedUri;
+ std::string m_message;
bool m_isCompleted;
};
@@ -84,7 +84,7 @@
tc->m_isCompleted = true;
--m_nPending;
- BOOST_CHECK_MESSAGE(tc->m_shouldSucceed, tc->m_request + " should fail");
+ BOOST_CHECK_MESSAGE(tc->m_shouldSucceed, tc->m_message);
BOOST_CHECK_EQUAL(tc->m_expectedUri, canonicalUri.toString());
}
@@ -96,7 +96,7 @@
tc->m_isCompleted = true;
--m_nPending;
- BOOST_CHECK_MESSAGE(!tc->m_shouldSucceed, tc->m_request + " should succeed");
+ BOOST_CHECK_MESSAGE(!tc->m_shouldSucceed, tc->m_message);
}
private:
@@ -109,12 +109,12 @@
bool shouldSucceed, const std::string& expectedUri)
{
++m_nPending;
- shared_ptr<CanonizeTestCase> tc = ndn::make_shared<CanonizeTestCase>(
- request, shouldSucceed, expectedUri);
+ auto tc = make_shared<CanonizeTestCase>(request, shouldSucceed, expectedUri);
+
FaceUri uri(request);
uri.canonize(bind(&CanonizeFixture::onCanonizeSuccess, this, tc, _1),
bind(&CanonizeFixture::onCanonizeFailure, this, tc, _1),
- m_io, time::seconds(4));
+ m_io, time::seconds(10));
}
BOOST_AUTO_TEST_CASE(ParseInternal)