6 SourceFileTest::IsParentOf ( const SourceFile
* parent
,
7 const SourceFile
* child
)
10 for ( i
= 0; i
< child
->parents
.size (); i
++ )
12 if ( child
->parents
[i
] != NULL
)
14 if ( child
->parents
[i
] == parent
)
20 for ( i
= 0; i
< child
->parents
.size (); i
++ )
22 if ( child
->parents
[i
] != NULL
)
24 if ( IsParentOf ( parent
,
35 SourceFileTest::IncludeTest ()
37 const Project
project ( RBUILD_BASE
"tests" SSEP
"data" SSEP
"automaticdependency_include.xml" );
38 AutomaticDependency
automaticDependency ( project
);
39 automaticDependency
.Process ();
40 ARE_EQUAL( 4, automaticDependency
.sourcefile_map
.size () );
41 const SourceFile
* include
= automaticDependency
.RetrieveFromCache ( RBUILD_BASE
"tests" SSEP
"data" SSEP
"sourcefile_include.h" );
42 IS_NOT_NULL( include
);
43 const SourceFile
* includenext
= automaticDependency
.RetrieveFromCache ( RBUILD_BASE
"tests" SSEP
"data" SSEP
"sourcefile1" SSEP
"sourcefile_includenext.h" );
44 IS_NOT_NULL( includenext
);
48 SourceFileTest::FullParseTest ()
50 const Project
project ( RBUILD_BASE
"tests" SSEP
"data" SSEP
"automaticdependency.xml" );
51 AutomaticDependency
automaticDependency ( project
);
52 automaticDependency
.Process ();
53 ARE_EQUAL( 5, automaticDependency
.sourcefile_map
.size () );
54 const SourceFile
* header1
= automaticDependency
.RetrieveFromCache ( RBUILD_BASE
"tests" SSEP
"data" SSEP
"sourcefile1_header1.h" );
55 IS_NOT_NULL( header1
);
56 const SourceFile
* recurse
= automaticDependency
.RetrieveFromCache ( RBUILD_BASE
"tests" SSEP
"data" SSEP
"sourcefile1_recurse.h" );
57 IS_NOT_NULL( recurse
);
58 IS_TRUE( IsParentOf ( header1
,
60 IS_FALSE( IsParentOf ( recurse
,
66 SourceFileTest::Run ()