tests: rewrite StrategyChoiceManager test suite
refs #3868
Change-Id: I3ff124bcbf8a8a0b2badfc9adedbbaa09f91e72f
diff --git a/tests/manager-common-fixture.cpp b/tests/manager-common-fixture.cpp
index 88db7e1..bc04045 100644
--- a/tests/manager-common-fixture.cpp
+++ b/tests/manager-common-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -85,15 +85,18 @@
data = m_responses.at(idx);
}
catch (const std::out_of_range&) {
+ BOOST_TEST_MESSAGE("response[" << idx << "] does not exist");
return CheckResponseResult::OUT_OF_BOUNDARY;
}
if (data.getName() != expectedName) {
+ BOOST_TEST_MESSAGE("response[" << idx << "] has wrong name " << data.getName());
return CheckResponseResult::WRONG_NAME;
}
if (expectedContentType != -1 &&
data.getContentType() != static_cast<uint32_t>(expectedContentType)) {
+ BOOST_TEST_MESSAGE("response[" << idx << "] has wrong ContentType " << data.getContentType());
return CheckResponseResult::WRONG_CONTENT_TYPE;
}
@@ -102,23 +105,28 @@
response.wireDecode(data.getContent().blockFromValue());
}
catch (const tlv::Error&) {
+ BOOST_TEST_MESSAGE("response[" << idx << "] cannot be decoded");
return CheckResponseResult::INVALID_RESPONSE;
}
if (response.getCode() != expectedResponse.getCode()) {
+ BOOST_TEST_MESSAGE("response[" << idx << "] has wrong StatusCode " << response.getCode());
return CheckResponseResult::WRONG_CODE;
}
if (response.getText() != expectedResponse.getText()) {
+ BOOST_TEST_MESSAGE("response[" << idx << "] has wrong StatusText " << response.getText());
return CheckResponseResult::WRONG_TEXT;
}
const Block& body = response.getBody();
const Block& expectedBody = expectedResponse.getBody();
if (body.value_size() != expectedBody.value_size()) {
+ BOOST_TEST_MESSAGE("response[" << idx << "] has wrong body size " << body.value_size());
return CheckResponseResult::WRONG_BODY_SIZE;
}
if (body.value_size() > 0 && memcmp(body.value(), expectedBody.value(), body.value_size()) != 0) {
+ BOOST_TEST_MESSAGE("response[" << idx << "] has wrong body value");
return CheckResponseResult::WRONG_BODY_VALUE;
}