summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/tests/test_bufferstream.hpp
diff options
context:
space:
mode:
authorAnsariel <ansariel.hiller@phoenixviewer.com>2024-05-22 19:04:52 +0200
committerAnsariel <ansariel.hiller@phoenixviewer.com>2024-05-22 19:04:52 +0200
commit1b67dd855c41f5a0cda7ec2a68d98071986ca703 (patch)
treeab243607f74f78200787bba5b9b88f07ef1b966f /indra/llcorehttp/tests/test_bufferstream.hpp
parent6d6eabca44d08d5b97bfe3e941d2b9687c2246ea (diff)
parente1623bb276f83a43ce7a197e388720c05bdefe61 (diff)
Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts: # autobuild.xml # indra/cmake/CMakeLists.txt # indra/cmake/GoogleMock.cmake # indra/llaudio/llaudioengine_fmodstudio.cpp # indra/llaudio/llaudioengine_fmodstudio.h # indra/llaudio/lllistener_fmodstudio.cpp # indra/llaudio/lllistener_fmodstudio.h # indra/llaudio/llstreamingaudio_fmodstudio.cpp # indra/llaudio/llstreamingaudio_fmodstudio.h # indra/llcharacter/llmultigesture.cpp # indra/llcharacter/llmultigesture.h # indra/llimage/llimage.cpp # indra/llimage/llimagepng.cpp # indra/llimage/llimageworker.cpp # indra/llimage/tests/llimageworker_test.cpp # indra/llmessage/tests/llmockhttpclient.h # indra/llprimitive/llgltfmaterial.h # indra/llrender/llfontfreetype.cpp # indra/llui/llcombobox.cpp # indra/llui/llfolderview.cpp # indra/llui/llfolderviewmodel.h # indra/llui/lllineeditor.cpp # indra/llui/lllineeditor.h # indra/llui/lltextbase.cpp # indra/llui/lltextbase.h # indra/llui/lltexteditor.cpp # indra/llui/lltextvalidate.cpp # indra/llui/lltextvalidate.h # indra/llui/lluictrl.h # indra/llui/llview.cpp # indra/llwindow/llwindowmacosx.cpp # indra/newview/app_settings/settings.xml # indra/newview/llappearancemgr.cpp # indra/newview/llappearancemgr.h # indra/newview/llavatarpropertiesprocessor.cpp # indra/newview/llavatarpropertiesprocessor.h # indra/newview/llbreadcrumbview.cpp # indra/newview/llbreadcrumbview.h # indra/newview/llbreastmotion.cpp # indra/newview/llbreastmotion.h # indra/newview/llconversationmodel.h # indra/newview/lldensityctrl.cpp # indra/newview/lldensityctrl.h # indra/newview/llface.inl # indra/newview/llfloatereditsky.cpp # indra/newview/llfloatereditwater.cpp # indra/newview/llfloateremojipicker.h # indra/newview/llfloaterimsessiontab.cpp # indra/newview/llfloaterprofiletexture.cpp # indra/newview/llfloaterprofiletexture.h # indra/newview/llgesturemgr.cpp # indra/newview/llgesturemgr.h # indra/newview/llimpanel.cpp # indra/newview/llimpanel.h # indra/newview/llinventorybridge.cpp # indra/newview/llinventorybridge.h # indra/newview/llinventoryclipboard.cpp # indra/newview/llinventoryclipboard.h # indra/newview/llinventoryfunctions.cpp # indra/newview/llinventoryfunctions.h # indra/newview/llinventorygallery.cpp # indra/newview/lllistbrowser.cpp # indra/newview/lllistbrowser.h # indra/newview/llpanelobjectinventory.cpp # indra/newview/llpanelprofile.cpp # indra/newview/llpanelprofile.h # indra/newview/llpreviewgesture.cpp # indra/newview/llsavedsettingsglue.cpp # indra/newview/llsavedsettingsglue.h # indra/newview/lltooldraganddrop.cpp # indra/newview/llurllineeditorctrl.cpp # indra/newview/llvectorperfoptions.cpp # indra/newview/llvectorperfoptions.h # indra/newview/llviewerparceloverlay.cpp # indra/newview/llviewertexlayer.cpp # indra/newview/llviewertexturelist.cpp # indra/newview/macmain.h # indra/test/test.cpp
Diffstat (limited to 'indra/llcorehttp/tests/test_bufferstream.hpp')
-rw-r--r--indra/llcorehttp/tests/test_bufferstream.hpp288
1 files changed, 144 insertions, 144 deletions
diff --git a/indra/llcorehttp/tests/test_bufferstream.hpp b/indra/llcorehttp/tests/test_bufferstream.hpp
index 2739a6e38e..556abf45a2 100644
--- a/indra/llcorehttp/tests/test_bufferstream.hpp
+++ b/indra/llcorehttp/tests/test_bufferstream.hpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file test_bufferstream.hpp
* @brief unit tests for the LLCore::BufferArrayStreamBuf/BufferArrayStream classes
*
@@ -42,8 +42,8 @@ namespace tut
struct BufferStreamTestData
{
- // the test objects inherit from this so the member functions and variables
- // can be referenced directly inside of the test functions.
+ // the test objects inherit from this so the member functions and variables
+ // can be referenced directly inside of the test functions.
};
typedef test_group<BufferStreamTestData> BufferStreamTestGroupType;
@@ -55,194 +55,194 @@ typedef BufferArrayStreamBuf::traits_type tst_traits_t;
template <> template <>
void BufferStreamTestObjectType::test<1>()
{
- set_test_name("BufferArrayStreamBuf construction with NULL BufferArray");
-
- // create a new ref counted object with an implicit reference
- BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(NULL);
-
- // Not much will work with a NULL
- ensure("underflow() on NULL fails", tst_traits_t::eof() == bsb->underflow());
- ensure("uflow() on NULL fails", tst_traits_t::eof() == bsb->uflow());
- ensure("pbackfail() on NULL fails", tst_traits_t::eof() == bsb->pbackfail('c'));
- ensure("showmanyc() on NULL fails", bsb->showmanyc() == -1);
- ensure("overflow() on NULL fails", tst_traits_t::eof() == bsb->overflow('c'));
- ensure("xsputn() on NULL fails", bsb->xsputn("blah", 4) == 0);
- ensure("seekoff() on NULL fails", bsb->seekoff(0, std::ios_base::beg, std::ios_base::in) == std::streampos(-1));
-
- // release the implicit reference, causing the object to be released
- delete bsb;
- bsb = NULL;
+ set_test_name("BufferArrayStreamBuf construction with NULL BufferArray");
+
+ // create a new ref counted object with an implicit reference
+ BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(NULL);
+
+ // Not much will work with a NULL
+ ensure("underflow() on NULL fails", tst_traits_t::eof() == bsb->underflow());
+ ensure("uflow() on NULL fails", tst_traits_t::eof() == bsb->uflow());
+ ensure("pbackfail() on NULL fails", tst_traits_t::eof() == bsb->pbackfail('c'));
+ ensure("showmanyc() on NULL fails", bsb->showmanyc() == -1);
+ ensure("overflow() on NULL fails", tst_traits_t::eof() == bsb->overflow('c'));
+ ensure("xsputn() on NULL fails", bsb->xsputn("blah", 4) == 0);
+ ensure("seekoff() on NULL fails", bsb->seekoff(0, std::ios_base::beg, std::ios_base::in) == std::streampos(-1));
+
+ // release the implicit reference, causing the object to be released
+ delete bsb;
+ bsb = NULL;
}
template <> template <>
void BufferStreamTestObjectType::test<2>()
{
- set_test_name("BufferArrayStream construction with NULL BufferArray");
-
- // create a new ref counted object with an implicit reference
- BufferArrayStream * bas = new BufferArrayStream(NULL);
-
- // Not much will work with a NULL here
- ensure("eof() is false on NULL", ! bas->eof());
- ensure("fail() is false on NULL", ! bas->fail());
- ensure("good() on NULL", bas->good());
-
- // release the implicit reference, causing the object to be released
- delete bas;
- bas = NULL;
+ set_test_name("BufferArrayStream construction with NULL BufferArray");
+
+ // create a new ref counted object with an implicit reference
+ BufferArrayStream * bas = new BufferArrayStream(NULL);
+
+ // Not much will work with a NULL here
+ ensure("eof() is false on NULL", ! bas->eof());
+ ensure("fail() is false on NULL", ! bas->fail());
+ ensure("good() on NULL", bas->good());
+
+ // release the implicit reference, causing the object to be released
+ delete bas;
+ bas = NULL;
}
template <> template <>
void BufferStreamTestObjectType::test<3>()
{
- set_test_name("BufferArrayStreamBuf construction with empty BufferArray");
-
- // create a new ref counted BufferArray with implicit reference
- BufferArray * ba = new BufferArray;
- BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(ba);
-
- // I can release my ref on the BA
- ba->release();
- ba = NULL;
-
- // release the implicit reference, causing the object to be released
- delete bsb;
- bsb = NULL;
+ set_test_name("BufferArrayStreamBuf construction with empty BufferArray");
+
+ // create a new ref counted BufferArray with implicit reference
+ BufferArray * ba = new BufferArray;
+ BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(ba);
+
+ // I can release my ref on the BA
+ ba->release();
+ ba = NULL;
+
+ // release the implicit reference, causing the object to be released
+ delete bsb;
+ bsb = NULL;
}
template <> template <>
void BufferStreamTestObjectType::test<4>()
{
- set_test_name("BufferArrayStream construction with empty BufferArray");
+ set_test_name("BufferArrayStream construction with empty BufferArray");
- // create a new ref counted BufferArray with implicit reference
- BufferArray * ba = new BufferArray;
+ // create a new ref counted BufferArray with implicit reference
+ BufferArray * ba = new BufferArray;
- {
- // create a new ref counted object with an implicit reference
- BufferArrayStream bas(ba);
- }
+ {
+ // create a new ref counted object with an implicit reference
+ BufferArrayStream bas(ba);
+ }
- // release the implicit reference, causing the object to be released
- ba->release();
- ba = NULL;
+ // release the implicit reference, causing the object to be released
+ ba->release();
+ ba = NULL;
}
template <> template <>
void BufferStreamTestObjectType::test<5>()
{
- set_test_name("BufferArrayStreamBuf construction with real BufferArray");
-
- // create a new ref counted BufferArray with implicit reference
- BufferArray * ba = new BufferArray;
- const char * content("This is a string. A fragment.");
- const size_t c_len(strlen(content));
- ba->append(content, c_len);
-
- // Creat an adapter for the BufferArray
- BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(ba);
-
- // I can release my ref on the BA
- ba->release();
- ba = NULL;
-
- // Various static state
- ensure("underflow() returns 'T'", bsb->underflow() == 'T');
- ensure("underflow() returns 'T' again", bsb->underflow() == 'T');
- ensure("uflow() returns 'T'", bsb->uflow() == 'T');
- ensure("uflow() returns 'h'", bsb->uflow() == 'h');
- ensure("pbackfail('i') fails", tst_traits_t::eof() == bsb->pbackfail('i'));
- ensure("pbackfail('T') fails", tst_traits_t::eof() == bsb->pbackfail('T'));
- ensure("pbackfail('h') succeeds", bsb->pbackfail('h') == 'h');
- ensure("showmanyc() is everything but the 'T'", bsb->showmanyc() == (c_len - 1));
- ensure("overflow() appends", bsb->overflow('c') == 'c');
- ensure("showmanyc() reflects append", bsb->showmanyc() == (c_len - 1 + 1));
- ensure("xsputn() appends some more", bsb->xsputn("bla!", 4) == 4);
- ensure("showmanyc() reflects 2nd append", bsb->showmanyc() == (c_len - 1 + 5));
- ensure("seekoff() succeeds", bsb->seekoff(0, std::ios_base::beg, std::ios_base::in) == std::streampos(0));
- ensure("seekoff() succeeds 2", bsb->seekoff(4, std::ios_base::cur, std::ios_base::in) == std::streampos(4));
- ensure("showmanyc() picks up seekoff", bsb->showmanyc() == (c_len + 5 - 4));
- ensure("seekoff() succeeds 3", bsb->seekoff(0, std::ios_base::end, std::ios_base::in) == std::streampos(c_len + 4));
- ensure("pbackfail('!') succeeds", tst_traits_t::eof() == bsb->pbackfail('!'));
-
- // release the implicit reference, causing the object to be released
- delete bsb;
- bsb = NULL;
+ set_test_name("BufferArrayStreamBuf construction with real BufferArray");
+
+ // create a new ref counted BufferArray with implicit reference
+ BufferArray * ba = new BufferArray;
+ const char * content("This is a string. A fragment.");
+ const size_t c_len(strlen(content));
+ ba->append(content, c_len);
+
+ // Creat an adapter for the BufferArray
+ BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(ba);
+
+ // I can release my ref on the BA
+ ba->release();
+ ba = NULL;
+
+ // Various static state
+ ensure("underflow() returns 'T'", bsb->underflow() == 'T');
+ ensure("underflow() returns 'T' again", bsb->underflow() == 'T');
+ ensure("uflow() returns 'T'", bsb->uflow() == 'T');
+ ensure("uflow() returns 'h'", bsb->uflow() == 'h');
+ ensure("pbackfail('i') fails", tst_traits_t::eof() == bsb->pbackfail('i'));
+ ensure("pbackfail('T') fails", tst_traits_t::eof() == bsb->pbackfail('T'));
+ ensure("pbackfail('h') succeeds", bsb->pbackfail('h') == 'h');
+ ensure("showmanyc() is everything but the 'T'", bsb->showmanyc() == (c_len - 1));
+ ensure("overflow() appends", bsb->overflow('c') == 'c');
+ ensure("showmanyc() reflects append", bsb->showmanyc() == (c_len - 1 + 1));
+ ensure("xsputn() appends some more", bsb->xsputn("bla!", 4) == 4);
+ ensure("showmanyc() reflects 2nd append", bsb->showmanyc() == (c_len - 1 + 5));
+ ensure("seekoff() succeeds", bsb->seekoff(0, std::ios_base::beg, std::ios_base::in) == std::streampos(0));
+ ensure("seekoff() succeeds 2", bsb->seekoff(4, std::ios_base::cur, std::ios_base::in) == std::streampos(4));
+ ensure("showmanyc() picks up seekoff", bsb->showmanyc() == (c_len + 5 - 4));
+ ensure("seekoff() succeeds 3", bsb->seekoff(0, std::ios_base::end, std::ios_base::in) == std::streampos(c_len + 4));
+ ensure("pbackfail('!') succeeds", tst_traits_t::eof() == bsb->pbackfail('!'));
+
+ // release the implicit reference, causing the object to be released
+ delete bsb;
+ bsb = NULL;
}
template <> template <>
void BufferStreamTestObjectType::test<6>()
{
- set_test_name("BufferArrayStream construction with real BufferArray");
-
- // create a new ref counted BufferArray with implicit reference
- BufferArray * ba = new BufferArray;
- //const char * content("This is a string. A fragment.");
- //const size_t c_len(strlen(content));
- //ba->append(content, strlen(content));
-
- {
- // Creat an adapter for the BufferArray
- BufferArrayStream bas(ba);
-
- // Basic operations
- bas << "Hello" << 27 << ".";
- ensure("BA length 8", ba->size() == 8);
-
- std::string str;
- bas >> str;
- ensure("reads correctly", str == "Hello27.");
- }
-
- // release the implicit reference, causing the object to be released
- ba->release();
- ba = NULL;
+ set_test_name("BufferArrayStream construction with real BufferArray");
+
+ // create a new ref counted BufferArray with implicit reference
+ BufferArray * ba = new BufferArray;
+ //const char * content("This is a string. A fragment.");
+ //const size_t c_len(strlen(content));
+ //ba->append(content, strlen(content));
+
+ {
+ // Creat an adapter for the BufferArray
+ BufferArrayStream bas(ba);
+
+ // Basic operations
+ bas << "Hello" << 27 << ".";
+ ensure("BA length 8", ba->size() == 8);
+
+ std::string str;
+ bas >> str;
+ ensure("reads correctly", str == "Hello27.");
+ }
+
+ // release the implicit reference, causing the object to be released
+ ba->release();
+ ba = NULL;
}
template <> template <>
void BufferStreamTestObjectType::test<7>()
{
- set_test_name("BufferArrayStream with LLSD serialization");
+ set_test_name("BufferArrayStream with LLSD serialization");
+
+ // create a new ref counted BufferArray with implicit reference
+ BufferArray * ba = new BufferArray;
- // create a new ref counted BufferArray with implicit reference
- BufferArray * ba = new BufferArray;
+ {
+ // Creat an adapter for the BufferArray
+ BufferArrayStream bas(ba);
- {
- // Creat an adapter for the BufferArray
- BufferArrayStream bas(ba);
+ // LLSD
+ LLSD llsd = LLSD::emptyMap();
- // LLSD
- LLSD llsd = LLSD::emptyMap();
+ llsd["int"] = LLSD::Integer(3);
+ llsd["float"] = LLSD::Real(923289.28992);
+ llsd["string"] = LLSD::String("aksjdl;ajsdgfjgfal;sdgjakl;sdfjkl;ajsdfkl;ajsdfkl;jaskl;dfj");
- llsd["int"] = LLSD::Integer(3);
- llsd["float"] = LLSD::Real(923289.28992);
- llsd["string"] = LLSD::String("aksjdl;ajsdgfjgfal;sdgjakl;sdfjkl;ajsdfkl;ajsdfkl;jaskl;dfj");
+ LLSD llsd_map = LLSD::emptyMap();
+ llsd_map["int"] = LLSD::Integer(-2889);
+ llsd_map["float"] = LLSD::Real(2.37829e32);
+ llsd_map["string"] = LLSD::String("OHIGODHSPDGHOSDHGOPSHDGP");
- LLSD llsd_map = LLSD::emptyMap();
- llsd_map["int"] = LLSD::Integer(-2889);
- llsd_map["float"] = LLSD::Real(2.37829e32);
- llsd_map["string"] = LLSD::String("OHIGODHSPDGHOSDHGOPSHDGP");
+ llsd["map"] = llsd_map;
- llsd["map"] = llsd_map;
-
- // Serialize it
- LLSDSerialize::toXML(llsd, bas);
+ // Serialize it
+ LLSDSerialize::toXML(llsd, bas);
- std::string str;
- bas >> str;
- // std::cout << "SERIALIZED LLSD: " << str << std::endl;
- ensure("Extracted string has reasonable length", str.size() > 60);
- }
+ std::string str;
+ bas >> str;
+ // std::cout << "SERIALIZED LLSD: " << str << std::endl;
+ ensure("Extracted string has reasonable length", str.size() > 60);
+ }
- // release the implicit reference, causing the object to be released
- ba->release();
- ba = NULL;
+ // release the implicit reference, causing the object to be released
+ ba->release();
+ ba = NULL;
}