summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon/tests')
-rw-r--r--indra/llcommon/tests/commonmisc_test.cpp6
-rw-r--r--indra/llcommon/tests/lleventdispatcher_test.cpp8
-rw-r--r--indra/llcommon/tests/llsdserialize_test.cpp18
-rw-r--r--indra/llcommon/tests/llstring_test.cpp26
-rw-r--r--indra/llcommon/tests/threadsafeschedule_test.cpp6
5 files changed, 32 insertions, 32 deletions
diff --git a/indra/llcommon/tests/commonmisc_test.cpp b/indra/llcommon/tests/commonmisc_test.cpp
index 3deb864c0c..0057a1f639 100644
--- a/indra/llcommon/tests/commonmisc_test.cpp
+++ b/indra/llcommon/tests/commonmisc_test.cpp
@@ -67,7 +67,7 @@ namespace tut
std::ostringstream resp;
resp << "{'connect':true, 'position':[r128,r128,r128], 'look_at':[r0,r1,r0], 'agent_access':'M', 'region_x':i8192, 'region_y':i8192}";
std::string str = resp.str();
- LLMemoryStream mstr((U8*)str.c_str(), str.size());
+ LLMemoryStream mstr((U8*)str.c_str(), static_cast<S32>(str.size()));
LLSD response;
S32 count = LLSDSerialize::fromNotation(response, mstr, str.size());
ensure("stream parsed", response.isDefined());
@@ -252,7 +252,7 @@ namespace tut
resp << "{'label':'short binary test', 'singlebinary':b(1)\"A\", 'singlerawstring':s(1)\"A\", 'endoftest':'end' }";
std::string str = resp.str();
LLSD sd;
- LLMemoryStream mstr((U8*)str.c_str(), str.size());
+ LLMemoryStream mstr((U8*)str.c_str(), static_cast<S32>(str.size()));
S32 count = LLSDSerialize::fromNotation(sd, mstr, str.size());
ensure_equals("parse count", count, 5);
ensure("sd created", sd.isDefined());
@@ -456,7 +456,7 @@ namespace tut
void mem_object::test<1>()
{
const char HELLO_WORLD[] = "hello world";
- LLMemoryStream mem((U8*)&HELLO_WORLD[0], strlen(HELLO_WORLD)); /* Flawfinder: ignore */
+ LLMemoryStream mem((U8*)&HELLO_WORLD[0], static_cast<S32>(strlen(HELLO_WORLD))); /* Flawfinder: ignore */
std::string hello;
std::string world;
mem >> hello >> world;
diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp
index a99acba848..44f772e322 100644
--- a/indra/llcommon/tests/lleventdispatcher_test.cpp
+++ b/indra/llcommon/tests/lleventdispatcher_test.cpp
@@ -491,7 +491,7 @@ namespace tut
// Partial defaults arrays.
for (LLSD::String a: ab)
{
- LLSD::Integer partition(std::min(partial_offset, dft_array_full[a].size()));
+ LLSD::Integer partition(static_cast<LLSD::Integer>(std::min(partial_offset, dft_array_full[a].size())));
dft_array_partial[a] =
llsd_copy_array(dft_array_full[a].beginArray() + partition,
dft_array_full[a].endArray());
@@ -508,7 +508,7 @@ namespace tut
// (params, dft_array_full). Part of the point of using map-style
// defaults is to allow any subset of the target function's
// parameters to be optional, not just the rightmost.
- for (LLSD::Integer ix = 0, ixend = params[a].size(); ix < ixend; ix += 2)
+ for (LLSD::Integer ix = 0, ixend = static_cast<LLSD::Integer>(params[a].size()); ix < ixend; ix += 2)
{
dft_map_partial[a][params[a][ix].asString()] = dft_array_full[a][ix];
}
@@ -696,7 +696,7 @@ namespace tut
LLSD zipmap(const LLSD& keys, const LLSD& values)
{
LLSD map;
- for (LLSD::Integer i = 0, iend = keys.size(); i < iend; ++i)
+ for (LLSD::Integer i = 0, iend = static_cast<LLSD::Integer>(keys.size()); i < iend; ++i)
{
// Have to select asString() since you can index an LLSD
// object with either String or Integer.
@@ -955,7 +955,7 @@ namespace tut
allreq[a] = zipmap(params[a], LLSD::emptyArray());
// Same for leftreq, save that we use the subset of the params not
// supplied by dft_array_partial[a].
- LLSD::Integer partition(params[a].size() - dft_array_partial[a].size());
+ LLSD::Integer partition(static_cast<LLSD::Integer>(params[a].size() - dft_array_partial[a].size()));
leftreq[a] = zipmap(llsd_copy_array(params[a].beginArray(),
params[a].beginArray() + partition),
LLSD::emptyArray());
diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp
index 56fdc51e82..fb2af1d2db 100644
--- a/indra/llcommon/tests/llsdserialize_test.cpp
+++ b/indra/llcommon/tests/llsdserialize_test.cpp
@@ -701,7 +701,7 @@ namespace tut
"<key>cam</key><real>1.23</real>"
"</map></llsd>",
v,
- v.size() + 1);
+ static_cast<S32>(v.size()) + 1);
}
template<> template<>
@@ -721,7 +721,7 @@ namespace tut
"<key>cam</key><real>1.23</real>"
"</map></llsd>",
v,
- v.size() + 1);
+ static_cast<S32>(v.size()) + 1);
v.clear();
v["amy"] = 23;
@@ -734,7 +734,7 @@ namespace tut
"<key>cam</key><real>1.23</real>"
"</map></llsd>",
v,
- v.size() + 1);
+ static_cast<S32>(v.size()) + 1);
v.clear();
v["amy"] = 23;
@@ -751,7 +751,7 @@ namespace tut
"<key>cam</key><real>1.23</real>"
"</map></llsd>",
v,
- v.size() + 1);
+ static_cast<S32>(v.size()) + 1);
v.clear();
v[0] = 23;
@@ -766,7 +766,7 @@ namespace tut
"<real>1.23</real>"
"</array></llsd>",
v,
- v.size() + 1);
+ static_cast<S32>(v.size()) + 1);
v.clear();
v[0] = 23;
@@ -782,7 +782,7 @@ namespace tut
"<real>1.23</real>"
"</array></llsd>",
v,
- v.size() + 1);
+ static_cast<S32>(v.size()) + 1);
}
template<> template<>
@@ -1405,13 +1405,13 @@ namespace tut
uint32_t size = htonl(1);
memcpy(&vec[1], &size, sizeof(uint32_t));
vec.push_back('k');
- int key_size_loc = vec.size();
+ auto key_size_loc = vec.size();
size = htonl(1); // 1 too short
vec.resize(vec.size() + 4);
memcpy(&vec[key_size_loc], &size, sizeof(uint32_t));
vec.push_back('a'); vec.push_back('m'); vec.push_back('y');
vec.push_back('i');
- int integer_loc = vec.size();
+ auto integer_loc = vec.size();
vec.resize(vec.size() + 4);
uint32_t val_int = htonl(23);
memcpy(&vec[integer_loc], &val_int, sizeof(uint32_t));
@@ -1473,7 +1473,7 @@ namespace tut
memcpy(&vec[1], &size, sizeof(uint32_t));
vec.push_back('"'); vec.push_back('a'); vec.push_back('m');
vec.push_back('y'); vec.push_back('"'); vec.push_back('i');
- int integer_loc = vec.size();
+ auto integer_loc = vec.size();
vec.resize(vec.size() + 4);
uint32_t val_int = htonl(23);
memcpy(&vec[integer_loc], &val_int, sizeof(uint32_t));
diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp
index ea5b0ee5fc..b68c63a15f 100644
--- a/indra/llcommon/tests/llstring_test.cpp
+++ b/indra/llcommon/tests/llstring_test.cpp
@@ -80,12 +80,12 @@ namespace tut
void string_index_object_t::test<3>()
{
std::string str("Len=5");
- ensure("isValidIndex failed", LLStringUtil::isValidIndex(str, 0) == TRUE &&
- LLStringUtil::isValidIndex(str, 5) == TRUE &&
- LLStringUtil::isValidIndex(str, 6) == FALSE);
+ ensure("isValidIndex failed", LLStringUtil::isValidIndex(str, 0) == true &&
+ LLStringUtil::isValidIndex(str, 5) == true &&
+ LLStringUtil::isValidIndex(str, 6) == false);
std::string str1;
- ensure("isValidIndex failed fo rempty string", LLStringUtil::isValidIndex(str1, 0) == FALSE);
+ ensure("isValidIndex failed fo rempty string", LLStringUtil::isValidIndex(str1, 0) == false);
}
template<> template<>
@@ -153,10 +153,10 @@ namespace tut
void string_index_object_t::test<10>()
{
std::string str_val("Second");
- ensure("1. isHead failed", LLStringUtil::isHead(str_val, "SecondLife Source") == TRUE);
- ensure("2. isHead failed", LLStringUtil::isHead(str_val, " SecondLife Source") == FALSE);
+ ensure("1. isHead failed", LLStringUtil::isHead(str_val, "SecondLife Source") == true);
+ ensure("2. isHead failed", LLStringUtil::isHead(str_val, " SecondLife Source") == false);
std::string str_val2("");
- ensure("3. isHead failed", LLStringUtil::isHead(str_val2, "") == FALSE);
+ ensure("3. isHead failed", LLStringUtil::isHead(str_val2, "") == false);
}
template<> template<>
@@ -206,10 +206,10 @@ namespace tut
void string_index_object_t::test<15>()
{
std::string str_val("Hello.\n\r\t");
- ensure("containsNonprintable failed", LLStringUtil::containsNonprintable(str_val) == TRUE);
+ ensure("containsNonprintable failed", LLStringUtil::containsNonprintable(str_val) == true);
str_val = "ABC ";
- ensure("containsNonprintable failed", LLStringUtil::containsNonprintable(str_val) == FALSE);
+ ensure("containsNonprintable failed", LLStringUtil::containsNonprintable(str_val) == false);
}
template<> template<>
@@ -231,7 +231,7 @@ namespace tut
template<> template<>
void string_index_object_t::test<17>()
{
- BOOL value;
+ bool value;
std::string str_val("1");
ensure("convertToBOOL 1 failed", LLStringUtil::convertToBOOL(str_val, value) && value);
str_val = "T";
@@ -457,17 +457,17 @@ namespace tut
std::string lhs_str("PROgraM12files");
std::string rhs_str("PROgram12Files");
ensure("compareDict 1 failed", LLStringUtil::compareDict(lhs_str, rhs_str) < 0);
- ensure("precedesDict 1 failed", LLStringUtil::precedesDict(lhs_str, rhs_str) == TRUE);
+ ensure("precedesDict 1 failed", LLStringUtil::precedesDict(lhs_str, rhs_str) == true);
lhs_str = "PROgram12Files";
rhs_str = "PROgram12Files";
ensure("compareDict 2 failed", LLStringUtil::compareDict(lhs_str, rhs_str) == 0);
- ensure("precedesDict 2 failed", LLStringUtil::precedesDict(lhs_str, rhs_str) == FALSE);
+ ensure("precedesDict 2 failed", LLStringUtil::precedesDict(lhs_str, rhs_str) == false);
lhs_str = "PROgram12Files";
rhs_str = "PROgRAM12FILES";
ensure("compareDict 3 failed", LLStringUtil::compareDict(lhs_str, rhs_str) > 0);
- ensure("precedesDict 3 failed", LLStringUtil::precedesDict(lhs_str, rhs_str) == FALSE);
+ ensure("precedesDict 3 failed", LLStringUtil::precedesDict(lhs_str, rhs_str) == false);
}
template<> template<>
diff --git a/indra/llcommon/tests/threadsafeschedule_test.cpp b/indra/llcommon/tests/threadsafeschedule_test.cpp
index f2f17dd2e6..5e5d6e1259 100644
--- a/indra/llcommon/tests/threadsafeschedule_test.cpp
+++ b/indra/llcommon/tests/threadsafeschedule_test.cpp
@@ -47,11 +47,11 @@ namespace tut
// the timestamp for each one -- but since we're passing explicit
// timestamps, make the queue reorder them.
auto now{ Queue::Clock::now() };
- queue.push(Queue::TimeTuple(now + 200ms, "ghi"));
+ queue.push(Queue::TimeTuple(now + 200ms, "ghi"s));
// Given the various push() overloads, you have to match the type
// exactly: conversions are ambiguous.
- queue.push("abc"s);
- queue.push(now + 100ms, "def");
+ queue.push(now, "abc"s);
+ queue.push(now + 100ms, "def"s);
queue.close();
auto entry = queue.pop();
ensure_equals("failed to pop first", std::get<0>(entry), "abc"s);