Skip to content
Snippets Groups Projects
Commit e33448d5 authored by Mnikolenko Productengine's avatar Mnikolenko Productengine
Browse files

SL-13669 updated tests

parent cf83b9f8
No related branches found
No related tags found
No related merge requests found
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
#include "linden_common.h" #include "linden_common.h"
#include "llsd.h" #include "llsd.h"
#include "llsdserialize.h"
#include "../llinventory.h" #include "../llinventory.h"
#include "../test/lltut.h" #include "../test/lltut.h"
...@@ -320,27 +320,39 @@ namespace tut ...@@ -320,27 +320,39 @@ namespace tut
template<> template<> template<> template<>
void inventory_object::test<7>() void inventory_object::test<7>()
{ {
LLFILE* fp = LLFile::fopen("linden_file.dat","w+"); std::string filename("linden_file.dat");
if(!fp) llofstream fileXML(filename.c_str());
if (!fileXML.is_open())
{ {
LL_ERRS() << "file could not be opened\n" << LL_ENDL; LL_ERRS() << "file could not be opened\n" << LL_ENDL;
return; return;
} }
LLPointer<LLInventoryItem> src1 = create_random_inventory_item(); LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
src1->exportFile(fp, TRUE); fileXML << LLSDOStreamer<LLSDNotationFormatter>(src1->asLLSD()) << std::endl;
fclose(fp); fileXML.close();
LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
fp = LLFile::fopen("linden_file.dat","r+"); LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
if(!fp) llifstream file(filename.c_str());
if (!file.is_open())
{ {
LL_ERRS() << "file could not be opened\n" << LL_ENDL; LL_ERRS() << "file could not be opened\n" << LL_ENDL;
return; return;
} }
std::string line;
src2->importFile(fp); LLPointer<LLSDParser> parser = new LLSDNotationParser();
fclose(fp); 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("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID()); ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
...@@ -457,27 +469,38 @@ namespace tut ...@@ -457,27 +469,38 @@ namespace tut
template<> template<> template<> template<>
void inventory_object::test<13>() void inventory_object::test<13>()
{ {
LLFILE* fp = LLFile::fopen("linden_file.dat","w"); std::string filename("linden_file.dat");
if(!fp) 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; return;
} }
LLPointer<LLInventoryCategory> src1 = create_random_inventory_cat(); LLPointer<LLInventoryCategory> src1 = create_random_inventory_cat();
src1->exportFile(fp, TRUE); fileXML << LLSDOStreamer<LLSDNotationFormatter>(ll_create_sd_from_inventory_category(src1)) << std::endl;
fclose(fp); fileXML.close();
LLPointer<LLInventoryCategory> src2 = new LLInventoryCategory(); llifstream file(filename.c_str());
fp = LLFile::fopen("linden_file.dat","r"); if (!file.is_open())
if(!fp)
{ {
LL_ERRS() << "file coudnt be opened\n" << LL_ENDL; LL_ERRS() << "file could not be opened\n" << LL_ENDL;
return; return;
} }
std::string line;
src2->importFile(fp); LLPointer<LLSDParser> parser = new LLSDNotationParser();
fclose(fp); 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("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID()); ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
......
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