summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2020-08-07 19:55:18 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2020-08-07 19:55:18 +0300
commite33448d5eb93422d2a9161f28951162def2d0e9f (patch)
tree8fab6d7c613909ab44296ce9e3daa7a9c99a3180 /indra
parentcf83b9f890ec7bc62b34cf56f7402d1307afe8e5 (diff)
SL-13669 updated tests
Diffstat (limited to 'indra')
-rw-r--r--indra/llinventory/tests/inventorymisc_test.cpp71
1 files changed, 47 insertions, 24 deletions
diff --git a/indra/llinventory/tests/inventorymisc_test.cpp b/indra/llinventory/tests/inventorymisc_test.cpp
index 7b15552f24..6eb3f04827 100644
--- a/indra/llinventory/tests/inventorymisc_test.cpp
+++ b/indra/llinventory/tests/inventorymisc_test.cpp
@@ -28,9 +28,9 @@
#include "linden_common.h"
#include "llsd.h"
+#include "llsdserialize.h"
#include "../llinventory.h"
-
#include "../test/lltut.h"
@@ -320,27 +320,39 @@ namespace tut
template<> template<>
void inventory_object::test<7>()
{
- LLFILE* fp = LLFile::fopen("linden_file.dat","w+");
- if(!fp)
+ std::string filename("linden_file.dat");
+ llofstream fileXML(filename.c_str());
+ if (!fileXML.is_open())
{
LL_ERRS() << "file could not be opened\n" << LL_ENDL;
return;
}
LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
- src1->exportFile(fp, TRUE);
- fclose(fp);
+ fileXML << LLSDOStreamer<LLSDNotationFormatter>(src1->asLLSD()) << std::endl;
+ fileXML.close();
- LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
- fp = LLFile::fopen("linden_file.dat","r+");
- if(!fp)
+
+ LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
+ llifstream file(filename.c_str());
+ if (!file.is_open())
{
LL_ERRS() << "file could not be opened\n" << LL_ENDL;
return;
}
-
- src2->importFile(fp);
- fclose(fp);
+ std::string line;
+ LLPointer<LLSDParser> parser = new LLSDNotationParser();
+ std::getline(file, line);
+ LLSD s_item;
+ std::istringstream iss(line);
+ if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
+ {
+ LL_ERRS()<< "Parsing cache failed" << LL_ENDL;
+ return;
+ }
+ src2->fromLLSD(s_item);
+
+ file.close();
ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
@@ -457,27 +469,38 @@ namespace tut
template<> template<>
void inventory_object::test<13>()
{
- LLFILE* fp = LLFile::fopen("linden_file.dat","w");
- if(!fp)
+ std::string filename("linden_file.dat");
+ llofstream fileXML(filename.c_str());
+ if (!fileXML.is_open())
{
- LL_ERRS() << "file coudnt be opened\n" << LL_ENDL;
+ LL_ERRS() << "file could not be opened\n" << LL_ENDL;
return;
}
-
+
LLPointer<LLInventoryCategory> src1 = create_random_inventory_cat();
- src1->exportFile(fp, TRUE);
- fclose(fp);
+ fileXML << LLSDOStreamer<LLSDNotationFormatter>(ll_create_sd_from_inventory_category(src1)) << std::endl;
+ fileXML.close();
- LLPointer<LLInventoryCategory> src2 = new LLInventoryCategory();
- fp = LLFile::fopen("linden_file.dat","r");
- if(!fp)
+ llifstream file(filename.c_str());
+ if (!file.is_open())
{
- LL_ERRS() << "file coudnt be opened\n" << LL_ENDL;
+ LL_ERRS() << "file could not be opened\n" << LL_ENDL;
return;
}
-
- src2->importFile(fp);
- fclose(fp);
+ std::string line;
+ LLPointer<LLSDParser> parser = new LLSDNotationParser();
+ std::getline(file, line);
+ LLSD s_item;
+ std::istringstream iss(line);
+ if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
+ {
+ LL_ERRS()<< "Parsing cache failed" << LL_ENDL;
+ return;
+ }
+
+ file.close();
+
+ LLPointer<LLInventoryCategory> src2 = ll_create_category_from_sd(s_item);
ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());