summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/tests/test_httpstatus.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcorehttp/tests/test_httpstatus.hpp')
-rw-r--r--[-rwxr-xr-x]indra/llcorehttp/tests/test_httpstatus.hpp126
1 files changed, 51 insertions, 75 deletions
diff --git a/indra/llcorehttp/tests/test_httpstatus.hpp b/indra/llcorehttp/tests/test_httpstatus.hpp
index 0b379836c9..4502d32fe1 100755..100644
--- a/indra/llcorehttp/tests/test_httpstatus.hpp
+++ b/indra/llcorehttp/tests/test_httpstatus.hpp
@@ -55,77 +55,68 @@ void HttpStatusTestObjectType::test<1>()
// auto allocation fine for this
HttpStatus status;
- status.mType = HttpStatus::EXT_CURL_EASY;
- status.mStatus = 0;
+
+ status = HttpStatus(HttpStatus::EXT_CURL_EASY, 0);
ensure(bool(status));
ensure(false == !(status));
- status.mType = HttpStatus::EXT_CURL_MULTI;
- status.mStatus = 0;
+ status = HttpStatus(HttpStatus::EXT_CURL_MULTI, 0);
ensure(bool(status));
ensure(false == !(status));
-
- status.mType = HttpStatus::LLCORE;
- status.mStatus = HE_SUCCESS;
+
+ status = HttpStatus(HttpStatus::LLCORE, HE_SUCCESS);
ensure(bool(status));
ensure(false == !(status));
- status.mType = HttpStatus::EXT_CURL_MULTI;
- status.mStatus = -1;
+ status = HttpStatus(HttpStatus::EXT_CURL_MULTI, -1);
ensure(false == bool(status));
ensure(!(status));
- status.mType = HttpStatus::EXT_CURL_EASY;
- status.mStatus = CURLE_BAD_DOWNLOAD_RESUME;
+ status = HttpStatus(HttpStatus::EXT_CURL_EASY, CURLE_BAD_DOWNLOAD_RESUME);
ensure(false == bool(status));
ensure(!(status));
}
-template <> template <>
-void HttpStatusTestObjectType::test<2>()
-{
- set_test_name("HttpStatus memory structure");
-
- // Require that an HttpStatus object can be trivially
- // returned as a function return value in registers.
- // One should fit in an int on all platforms.
-
- ensure(sizeof(HttpStatus) <= sizeof(int));
-}
+// template <> template <>
+// void HttpStatusTestObjectType::test<2>()
+// {
+// set_test_name("HttpStatus memory structure");
+//
+// // Require that an HttpStatus object can be trivially
+// // returned as a function return value in registers.
+// // One should fit in an int on all platforms.
+//
+// //ensure(sizeof(HttpStatus) <= sizeof(int));
+// }
template <> template <>
-void HttpStatusTestObjectType::test<3>()
+void HttpStatusTestObjectType::test<2>()
{
set_test_name("HttpStatus valid status string conversion");
- HttpStatus status;
- status.mType = HttpStatus::EXT_CURL_EASY;
- status.mStatus = 0;
+ HttpStatus status = HttpStatus(HttpStatus::EXT_CURL_EASY, 0);
std::string msg = status.toString();
// std::cout << "Result: " << msg << std::endl;
ensure(msg.empty());
-
- status.mType = HttpStatus::EXT_CURL_EASY;
- status.mStatus = CURLE_BAD_FUNCTION_ARGUMENT;
+
+ status = HttpStatus(HttpStatus::EXT_CURL_EASY, CURLE_BAD_FUNCTION_ARGUMENT);
msg = status.toString();
// std::cout << "Result: " << msg << std::endl;
ensure(! msg.empty());
- status.mType = HttpStatus::EXT_CURL_MULTI;
- status.mStatus = CURLM_OUT_OF_MEMORY;
+ status = HttpStatus(HttpStatus::EXT_CURL_MULTI, CURLM_OUT_OF_MEMORY);
msg = status.toString();
// std::cout << "Result: " << msg << std::endl;
ensure(! msg.empty());
- status.mType = HttpStatus::LLCORE;
- status.mStatus = HE_SHUTTING_DOWN;
+ status = HttpStatus(HttpStatus::LLCORE, HE_SHUTTING_DOWN);
msg = status.toString();
// std::cout << "Result: " << msg << std::endl;
ensure(! msg.empty());
@@ -133,32 +124,28 @@ void HttpStatusTestObjectType::test<3>()
template <> template <>
-void HttpStatusTestObjectType::test<4>()
+void HttpStatusTestObjectType::test<3>()
{
set_test_name("HttpStatus invalid status string conversion");
- HttpStatus status;
- status.mType = HttpStatus::EXT_CURL_EASY;
- status.mStatus = 32726;
+ HttpStatus status = HttpStatus(HttpStatus::EXT_CURL_EASY, 32726);
std::string msg = status.toString();
// std::cout << "Result: " << msg << std::endl;
ensure(! msg.empty());
-
- status.mType = HttpStatus::EXT_CURL_MULTI;
- status.mStatus = -470;
+
+ status = HttpStatus(HttpStatus::EXT_CURL_MULTI, -470);
msg = status.toString();
// std::cout << "Result: " << msg << std::endl;
ensure(! msg.empty());
- status.mType = HttpStatus::LLCORE;
- status.mStatus = 923;
+ status = HttpStatus(HttpStatus::LLCORE, 923);
msg = status.toString();
// std::cout << "Result: " << msg << std::endl;
ensure(! msg.empty());
}
template <> template <>
-void HttpStatusTestObjectType::test<5>()
+void HttpStatusTestObjectType::test<4>()
{
set_test_name("HttpStatus equality/inequality testing");
@@ -170,62 +157,55 @@ void HttpStatusTestObjectType::test<5>()
HttpStatus status2(HttpStatus::EXT_CURL_EASY, HE_SUCCESS);
ensure(status1 != status2);
- status1.mType = HttpStatus::LLCORE;
- status1.mStatus = HE_REPLY_ERROR;
- status2.mType = HttpStatus::LLCORE;
- status2.mStatus= HE_SHUTTING_DOWN;
+ status1 = HttpStatus(HttpStatus::LLCORE, HE_REPLY_ERROR);
+ status1 = HttpStatus(HttpStatus::LLCORE, HE_SHUTTING_DOWN);
+
ensure(status1 != status2);
}
template <> template <>
-void HttpStatusTestObjectType::test<6>()
+void HttpStatusTestObjectType::test<5>()
{
set_test_name("HttpStatus basic HTTP status encoding");
HttpStatus status;
- status.mType = 200;
- status.mStatus = HE_SUCCESS;
+
+ status = HttpStatus(200, HE_SUCCESS);
std::string msg = status.toString();
ensure(msg.empty());
ensure(bool(status));
// Normally a success but application says error
- status.mStatus = HE_REPLY_ERROR;
+ status = HttpStatus(200, HE_REPLY_ERROR);
msg = status.toString();
ensure(! msg.empty());
ensure(! bool(status));
ensure(status.toULong() > 1UL); // Biggish number, not a bool-to-ulong
// Same statuses with distinct success/fail are distinct
- status.mType = 200;
- status.mStatus = HE_SUCCESS;
+ status = HttpStatus(200, HE_SUCCESS);
HttpStatus status2(200, HE_REPLY_ERROR);
ensure(status != status2);
// Normally an error but application says okay
- status.mType = 406;
- status.mStatus = HE_SUCCESS;
+ status = HttpStatus(406, HE_SUCCESS);
msg = status.toString();
ensure(msg.empty());
ensure(bool(status));
// Different statuses but both successful are distinct
- status.mType = 200;
- status.mStatus = HE_SUCCESS;
- status2.mType = 201;
- status2.mStatus = HE_SUCCESS;
+ status = HttpStatus(200, HE_SUCCESS);
+ status2 = HttpStatus(201, HE_SUCCESS);
ensure(status != status2);
// Different statuses but both failed are distinct
- status.mType = 200;
- status.mStatus = HE_REPLY_ERROR;
- status2.mType = 201;
- status2.mStatus = HE_REPLY_ERROR;
+ status = HttpStatus(200, HE_REPLY_ERROR);
+ status2 = HttpStatus(201, HE_REPLY_ERROR);
ensure(status != status2);
}
template <> template <>
-void HttpStatusTestObjectType::test<7>()
+void HttpStatusTestObjectType::test<6>()
{
set_test_name("HttpStatus HTTP status text strings");
@@ -234,34 +214,30 @@ void HttpStatusTestObjectType::test<7>()
ensure(! msg.empty()); // Should be something
ensure(msg == "Continue");
- status.mStatus = HE_SUCCESS;
+ status = HttpStatus(200, HE_SUCCESS);
msg = status.toString();
ensure(msg.empty()); // Success is empty
- status.mType = 199;
- status.mStatus = HE_REPLY_ERROR;
+ status = HttpStatus(199, HE_REPLY_ERROR);
msg = status.toString();
ensure(msg == "Unknown error");
- status.mType = 505; // Last defined string
- status.mStatus = HE_REPLY_ERROR;
+ status = HttpStatus(505, HE_REPLY_ERROR);
msg = status.toString();
ensure(msg == "HTTP Version not supported");
- status.mType = 506; // One beyond
- status.mStatus = HE_REPLY_ERROR;
+ status = HttpStatus(506, HE_REPLY_ERROR);
msg = status.toString();
ensure(msg == "Unknown error");
- status.mType = 999; // Last HTTP status
- status.mStatus = HE_REPLY_ERROR;
+ status = HttpStatus(999, HE_REPLY_ERROR);
msg = status.toString();
ensure(msg == "Unknown error");
}
template <> template <>
-void HttpStatusTestObjectType::test<8>()
+void HttpStatusTestObjectType::test<7>()
{
set_test_name("HttpStatus toHex() nominal function");
@@ -273,7 +249,7 @@ void HttpStatusTestObjectType::test<8>()
template <> template <>
-void HttpStatusTestObjectType::test<9>()
+void HttpStatusTestObjectType::test<8>()
{
set_test_name("HttpStatus toTerseString() nominal function");