def test_counter(self): node = HeaderNode("file.hpp") self.assertEqual(node.getCounter(), 0) node.setCounter(1) self.assertEqual(node.getCounter(), 1) node.setCounter(2) self.assertEqual(node.getCounter(), 2)
def test_included(self): node = HeaderNode("file.hpp") self.assertFalse(node.isIncluded()) node.setIncluded(True) self.assertTrue(node.isIncluded()) node.setIncluded(False) self.assertFalse(node.isIncluded())
def test_counter( self ): node = HeaderNode( "file.hpp" ) self.assertEqual( node.getCounter(), 0 ) node.setCounter( 1 ) self.assertEqual( node.getCounter(), 1 ) node.setCounter( 2 ) self.assertEqual( node.getCounter(), 2 )
def test_included( self ): node = HeaderNode( "file.hpp" ) self.assertFalse( node.isIncluded() ) node.setIncluded( True ) self.assertTrue( node.isIncluded() ) node.setIncluded( False ) self.assertFalse( node.isIncluded() )
def test_init(self): node = HeaderNode("file.hpp") self.assertEqual(node.getData(), "file.hpp") self.assertEqual(len(node.getChildren()), 0) self.assertEqual(len(node.getParents()), 0) self.assertFalse(node.isIncluded()) self.assertEqual(node.getCounter(), 0)
def test_threshold_5( self ): options = processArgv( [ "-t", "80", "-p", "/project", "test.cpp", "test.cpp", "test.cpp" ] ) inPCH = ShouldBeInPCH( options ) parent = HeaderNode( "root" ) node = HeaderNode( "test.hpp" ) node.addParent( parent ) node.setCounter( 2 ) self.assertEqual( inPCH( node ), True )
def test_application_header_2( self ): options = processArgv( [ "-p", "/project", "test.cpp" ] ) inPCH = ShouldBeInPCH( options ) parent = HeaderNode( "root" ) node = HeaderNode( "/project/main.hpp" ) node.addParent( parent ) node.setCounter( 1 ) self.assertEqual( inPCH( node ), False )
def test_init( self ): node = HeaderNode( "file.hpp" ) self.assertEqual( node.getData(), "file.hpp" ) self.assertEqual( len( node.getChildren() ), 0 ) self.assertEqual( len( node.getParents() ), 0 ) self.assertFalse( node.isIncluded() ) self.assertEqual( node.getCounter(), 0 )
def test_exclude_except( self ): options = processArgv( [ "-e", "boost", "-x", "thread", "shared_ptr", "-p", "/project", "--", "test.cpp" ] ) inPCH = ShouldBeInPCH( options ) parent = HeaderNode( "root" ) node1 = HeaderNode( "boost/tokenizer" ) node1.addParent( parent ) node1.setCounter( 1 ) self.assertEqual( inPCH( node1 ), False ) node2 = HeaderNode( "/boost/thread" ) node2.addParent( parent ) node2.setCounter( 1 ) self.assertEqual( inPCH( node2 ), True ) node3 = HeaderNode( "/boost/shared_ptr" ) node3.addParent( parent ) self.assertEqual( inPCH( node3 ), True ) node4 = HeaderNode( "/stl/..." ) node4.addParent( parent ) self.assertEqual( inPCH( node4 ), True )
def test_exclude( self ): options = processArgv( [ "-e", "boost", "-p", "/project", "--", "test.cpp" ] ) inPCH = ShouldBeInPCH( options ) parent = HeaderNode( "root" ) node1 = HeaderNode( "boost/..." ) node1.addParent( parent ) node1.setCounter( 1 ) self.assertEqual( inPCH( node1 ), False ) node2 = HeaderNode( ".../boost/..." ) node2.addParent( parent ) node2.setCounter( 1 ) self.assertEqual( inPCH( node2 ), False ) node3 = HeaderNode( "/stl/..." ) node3.addParent( parent ) self.assertEqual( inPCH( node3 ), True )
def test_application_header_3( self ): options = processArgv( [ "-p", "test", "test.cpp" ] ) inPCH = ShouldBeInPCH( options ) parent = HeaderNode( "root" ) node = HeaderNode( "test.hpp" ) node.addParent( parent ) node.setCounter( 1 ) deepNode = HeaderNode( "test.impl.hpp" ) deepNode.addParent( node ) deepNode.setCounter( 1 ) self.assertEqual( inPCH( deepNode ), False )