Ejemplo n.º 1
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 )
Ejemplo n.º 2
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 )
Ejemplo n.º 3
0
    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 )
Ejemplo n.º 4
0
    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 )
Ejemplo n.º 5
0
def runApplication():
    options = processArgv(sys.argv[1:])

    dag = generateHeadersDag(options, GCCFacade())

    tSorter = TopologicalSorter(dag)

    predicate = ShouldBeInPCH(options)

    rFilter = RecursiveFilter(tSorter, predicate, options)

    dag = updateHeadersDag(dag, rFilter, options, GCCFacade())

    tSorter = TopologicalSorter(dag)

    rFilter = RecursiveFilter(tSorter, predicate, options)

    generatePCH(rFilter, options)

    printWatchHeaderInfo(dag, options)
Ejemplo n.º 6
0
    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 )