Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.54 KB | None | 0 0
  1. UAV_TEST(TestAProjectSerializeDeserialize)
  2. {
  3.  
  4.     AProject * bonch;
  5.     bonch = new AProject("TestProject", "C:/test");
  6.  
  7.     AProject * bonch2;
  8.     bonch2 = new AProject("TestProject", "C:/test");
  9.  
  10.     xmlDocPtr doc1 = xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION);
  11.     xmlNodePtr rootnode = xmlNewNode(NULL, BAD_CAST "at_project");
  12.     xmlNodeSetContent(rootnode, BAD_CAST "");
  13.     xmlDocSetRootElement(doc1, rootnode);
  14.  
  15.     bonch->serialize(rootnode);
  16.     bonch->deserialize(rootnode);
  17.     /*
  18.     if (*bonch == *bonch2) {
  19.         std::cout << "Test Passed" << std::endl;
  20.     }
  21.         */
  22.     test_check_eq("Cant serialize/deserialize", *bonch, *bonch2);
  23.  
  24. }
  25.  
  26. UAV_TEST(SaveLoadEDFDDoc)
  27. {
  28.     EDFDDocument * sqwonch = new EDFDDocument();
  29.     sqwonch->saveToFile("C:/test2");
  30.     EDFDDocument * sqwonch2 = new EDFDDocument();
  31.     sqwonch2->loadFromFile("C:/test2");
  32.  
  33.     test_check_eq("test2", *sqwonch, *sqwonch2);
  34.  
  35. }
  36.  
  37. UAV_TEST(SaveLoadEDFDDocWithDetails)
  38. {
  39.     EDFDDocument * sqwonch = new EDFDDocument();
  40.  
  41.     EDFDDocument * sqwonch2 = new EDFDDocument();
  42.  
  43.     DFDElement * new_el(nullptr);
  44.     new_el = new DFDEntity();
  45.     new_el->SetComment("1");
  46.     new_el->mDetalization.used = false;
  47.     shared_ptr<DFDElement> el(new_el);
  48.     std::vector<std::shared_ptr<DFDElement>> els = (sqwonch->elements());
  49.     els.push_back(el);
  50.  
  51.     new_el = new DFDEntity();
  52.     new_el->SetComment("1");
  53.     new_el->mDetalization.used = false;
  54.     shared_ptr<DFDElement> el2(new_el);
  55.     els = (sqwonch2->elements());
  56.     els.push_back(el2);
  57.  
  58.     sqwonch->saveToFile("C:/lol");
  59.     sqwonch->loadFromFile("C:/lol");
  60.     test_check_eq("Raz", *sqwonch, *sqwonch2);
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement