//Check the attribute creation
CPPUNIT_ASSERT(_attr1);
+ //Check method Label
+ CPPUNIT_ASSERT(_attr1->Label() == "0:1:2");
+
_PTR(SObject) so2 = study->CreateObjectID("0:1:3");
_PTR(AttributeTreeNode) _attr2 = studyBuilder->FindOrCreateAttribute(so2, "AttributeTreeNode");
#ifdef SALOMEDS_ALL_TESTS
//Check method GetFather
- CPPUNIT_ASSERT(_attr1->GetFather() == _attr);
+ CPPUNIT_ASSERT(_attr1->GetFather()->Label() == _attr->Label());
//Check method Append
_attr->Append(_attr1);
CPPUNIT_ASSERT(_attr1->HasNext());
//Check method GetNext
- CPPUNIT_ASSERT(_attr1->GetNext() == _attr2);
+ CPPUNIT_ASSERT(_attr1->GetNext()->Label() == _attr2->Label());
- //Check method GetPrevious
- CPPUNIT_ASSERT(_attr2->GetPrevious());
+ //Check method HasPrevious
+ CPPUNIT_ASSERT(_attr2->HasPrevious());
- CPPUNIT_ASSERT(_attr2->GetPrevious() == _attr1);
+ //Check method GetPrevious
+ CPPUNIT_ASSERT(_attr2->GetPrevious()->Label() == _attr1->Label());
//Check method Depth
- CPPUNIT_ASSERT(_attr->Depth() == 2);
+ CPPUNIT_ASSERT(_attr->Depth() == 0 && _attr1->Depth() == 1);
//Check method IsRoot
CPPUNIT_ASSERT(_attr->IsRoot());
CPPUNIT_ASSERT(_attr2->IsDescendant(_attr));
//Check method GetFirst
- CPPUNIT_ASSERT(_attr->GetFirst() == _attr1);
+ CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr1->Label());
+
+ _attr2->Remove();
//Check method Prepend
_attr->Prepend(_attr2);
- CPPUNIT_ASSERT(_attr->GetFirst() == _attr2);
+ CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr2->Label());
+
+ _attr1->Remove();
//Check method InsertBefore
_attr2->InsertBefore(_attr1);
- CPPUNIT_ASSERT(_attr->GetFirst() == _attr1);
+ CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr1->Label());
+
+ _attr1->Remove();
//Check method InsertAfter
_attr2->InsertAfter(_attr1);
- CPPUNIT_ASSERT(_attr->GetFirst() == _attr2);
-
- //Check method Label
- CPPUNIT_ASSERT(_attr1->Label() == "0:1:2");
+ CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr2->Label());
//Check method Remove
_attr2->Remove();
- CPPUNIT_ASSERT(_attr->GetFirst() == _attr1);
+ CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr1->Label());
//Check method SetTreeID and GetTreeID
_attr2->SetTreeID(TreeNodeID);
CPPUNIT_ASSERT(_attr2->GetTreeID() == TreeNodeID);
-#else
+#else
cout << endl << "THE TEST IS NOT COMPLETE !!!" << endl;
-#endif
+#endif
sm->Close(study);
}
CPPUNIT_ASSERT(name_attr_sco1);
name_attr_sco1->SetValue("sco1");
+ //Check method GetComponentNames
+ vector<string> components = study->GetComponentNames(""); //The context doesn't matter
+ CPPUNIT_ASSERT(components.size() == 1 && components[0] == "sco1");
+
//Check method FindComponentID
_PTR(SComponent) sco3 = study->FindComponentID(sco1->GetID());
CPPUNIT_ASSERT(sco3 && sco3->GetID() == sco1->GetID());
locid_attr_sco1->SetValue(16661); //DIRECTORYID
_PTR(AttributeLocalID) locid_attr_so1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeLocalID");
CPPUNIT_ASSERT(locid_attr_so1);
- locid_attr_sco1->SetValue(16661); //DIRECTORYID
+ locid_attr_so1->SetValue(16661); //DIRECTORYID
vs = study->GetDirectoryNames(""); //Empty context (the current is taken)
CPPUNIT_ASSERT(vs.size() == 2);