@@ -33,7 +33,7 @@ bool UnitTestReadTree::run() {
33
33
// TODO will be chnaged this to keeped files on the disk
34
34
CompStruct comp;
35
35
36
- std::string sFilename = " ./data/readtreetest/example1.obj-tree" ;
36
+ std::string sFilename = " ./data/readtreetest/example1.wsjcpp- obj-tree" ;
37
37
std::string sError ;
38
38
bool bWrote = comp.readTreeFromFile (sFilename , sError );
39
39
compareB (bTestSuccess, " read from file" , bWrote, true );
@@ -42,13 +42,26 @@ bool UnitTestReadTree::run() {
42
42
}
43
43
44
44
WsjcppLog::info (TAG, " \n " + comp.toString ());
45
-
46
- // char *pBuffer = nullptr;
47
- // int nBufferSize = 0;
48
- // WsjcppCore::readFileToBuffer(sFilename, &pBuffer, nBufferSize);
45
+ compareN (bTestSuccess, " user version " , comp.getUserVersionOfTree (), 1 );
46
+
47
+ std::vector<WsjcppObjTreeNodeString *> vFoundNodes;
48
+
49
+ comp.findNodes (" PCI_EXPRESS" , vFoundNodes);
50
+
51
+ compareN (bTestSuccess, " find PCI_EXPRESS" , vFoundNodes.size (), 1 );
52
+ if (vFoundNodes.size () == 1 ) {
53
+ WsjcppObjTreeNodeString *pNode = vFoundNodes[0 ];
54
+ compareN (bTestSuccess, " node id" , pNode->getId (), 13 );
55
+ compareN (bTestSuccess, " find PCI_EXPRESS" , pNode->getChilds ().size (), 1 );
56
+ if (pNode->getChilds ().size () == 1 ) {
57
+ WsjcppObjTreeNode *pNodeChild_ = pNode->getChilds ()[0 ];
58
+ compareN (bTestSuccess, " child node type" , pNodeChild_->getType (), WSJCPP_OBJ_TREE_NODE_INTEGER);
59
+ compareN (bTestSuccess, " child node id" , pNodeChild_->getId (), 14 );
60
+ compareN (bTestSuccess, " child node parent id (1)" , pNode->getId (), pNodeChild_->getParent ()->getId ());
61
+ compareN (bTestSuccess, " child node parent id (2)" , pNodeChild_->getParent ()->getId (), 13 );
62
+ }
63
+ }
49
64
50
- // compareN(bTestSuccess, "read to file", nBufferSize, 296);
51
-
52
65
return bTestSuccess;
53
66
}
54
67
0 commit comments