Skip to content
Snippets Groups Projects
Commit 7a569fdf authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Revert "Add a few tests for LLUUID and absl format support to lluuid"

This reverts commit 32cf7894.
parent 233a2fd1
No related branches found
No related tags found
No related merge requests found
......@@ -348,7 +348,6 @@ if (LL_TESTS)
LL_ADD_INTEGRATION_TEST(lltreeiterators "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(lluri "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(llunits "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(lluuid "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(stringize "" "${test_libs}")
## llexception_test.cpp isn't a regression test, and doesn't need to be run
......
......@@ -179,24 +179,9 @@ void LLUUID::toString(std::string& out) const
// *TODO: deprecate
void LLUUID::toString(char *out) const
{
absl::SNPrintF(out,UUID_STR_SIZE,
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
(U8)(mData[0]),
(U8)(mData[1]),
(U8)(mData[2]),
(U8)(mData[3]),
(U8)(mData[4]),
(U8)(mData[5]),
(U8)(mData[6]),
(U8)(mData[7]),
(U8)(mData[8]),
(U8)(mData[9]),
(U8)(mData[10]),
(U8)(mData[11]),
(U8)(mData[12]),
(U8)(mData[13]),
(U8)(mData[14]),
(U8)(mData[15]));
std::string buffer;
toString(buffer);
strcpy(out,buffer.c_str()); /* Flawfinder: ignore */
}
void LLUUID::toCompressedString(std::string& out) const
......
......@@ -36,7 +36,6 @@
#include <immintrin.h>
#include "absl/hash/hash.h"
#include "absl/strings/str_format.h"
class LLMutex;
......@@ -189,18 +188,6 @@ class LL_COMMON_API LLUUID
return H::combine_contiguous(std::move(h), id.mData, UUID_BYTES);
}
friend absl::FormatConvertResult<absl::FormatConversionCharSet::kString>
AbslFormatConvert(const LLUUID& id,
const absl::FormatConversionSpec& spec,
absl::FormatSink* s) {
if (spec.conversion_char() == absl::FormatConversionChar::s) {
char uuid_str[UUID_STR_SIZE];
id.toString(uuid_str);
s->Append(uuid_str);
}
return { true };
}
// xor functions. Useful since any two random uuids xored together
// will yield a determinate third random unique id that can be
// used as a key in a single uuid that represents 2.
......
/**
* @file lluuid_test.cpp
* @author Rye Mutt <rye@alchemyviewer.org>
* @date 2020-10-08
*
* $LicenseInfo:firstyear=2020&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2020, Alchemy Development Group
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "../test/lltut.h"
#include "../lluuid.h"
const std::string TEST_ID_STR("ba2a564a-f0f1-4b82-9c61-b7520bfcd09f");
const LLUUID TEST_ID("ba2a564a-f0f1-4b82-9c61-b7520bfcd09f");
namespace tut
{
struct uuid
{
};
typedef test_group<uuid> uuid_t;
typedef uuid_t::object uuid_object_t;
tut::uuid_t tut_uuid("LLUUID");
template<> template<>
void uuid_object_t::test<1>()
{
std::string out_str;
TEST_ID.toString(out_str);
ensure_equals(out_str, TEST_ID_STR);
}
template<> template<>
void uuid_object_t::test<2>()
{
char out_cstr[UUID_STR_SIZE] = {};
TEST_ID.toString(out_cstr);
ensure(strncmp(out_cstr, TEST_ID_STR.c_str(), UUID_STR_SIZE) == 0);
}
template<> template<>
void uuid_object_t::test<3>()
{
auto str = absl::StrFormat("%s", TEST_ID);
ensure_equals(str, TEST_ID_STR);
}
template<> template<>
void uuid_object_t::test<4>()
{
char out_cstr[UUID_STR_SIZE] = {};
absl::SNPrintF(out_cstr, UUID_STR_SIZE, "%s", TEST_ID);
ensure_equals(out_cstr, TEST_ID_STR);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment