mirror of https://github.com/vitalif/grive2
56 lines
1.5 KiB
C++
56 lines
1.5 KiB
C++
![]() |
/*
|
||
|
grive: an GPL program to sync a local directory with Google Drive
|
||
|
Copyright (C) 2012 Wan Wai Ho
|
||
|
|
||
|
This program is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU General Public License
|
||
|
as published by the Free Software Foundation version 2
|
||
|
of the License.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this program; if not, write to the Free Software
|
||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
#include "NodeTest.hh"
|
||
|
|
||
|
#include "xml/Node.hh"
|
||
|
|
||
|
#include <iostream>
|
||
|
|
||
|
namespace grut {
|
||
|
|
||
|
using namespace gr::xml ;
|
||
|
|
||
|
NodeTest::NodeTest( )
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void NodeTest::TestTree( )
|
||
|
{
|
||
|
Node node = Node::Element( "root" ) ;
|
||
|
CPPUNIT_ASSERT_EQUAL( 1UL, node.RefCount() ) ;
|
||
|
CPPUNIT_ASSERT_EQUAL( Node::element, node.GetType() ) ;
|
||
|
|
||
|
Node c1 = node.AddElement( "child1" ) ;
|
||
|
c1.AddText( "this is a line" ) ;
|
||
|
Node c11 = c1.AddElement( "b" ) ;
|
||
|
CPPUNIT_ASSERT_EQUAL( 2UL, c1.RefCount() ) ;
|
||
|
|
||
|
Node c2 = node.AddElement( "child2" ) ;
|
||
|
Node c0 = node.AddElement( "child0" ) ;
|
||
|
|
||
|
Node c1_ = node["child1"] ;
|
||
|
Node c11_ = node["child1"]["b"] ;
|
||
|
|
||
|
CPPUNIT_ASSERT_EQUAL( 3UL, c1_.RefCount() ) ;
|
||
|
CPPUNIT_ASSERT_EQUAL( std::string("child1"), c1_.Str() ) ;
|
||
|
}
|
||
|
|
||
|
} // end of namespace grut
|