* Bring back rbuild build to be used until bug 6372 is fixed.
[reactos.git] / tools / rbuild / tests / iftest.cpp
1 /*
2 * Copyright (C) 2005 Casper S. Hornstrup
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18 #include "test.h"
19
20 using std::string;
21
22 void
23 IfTest::TestProjectIf ( Project& project )
24 {
25 ARE_EQUAL ( 1, project.non_if_data.ifs.size () );
26 If& if1 = *project.non_if_data.ifs[0];
27 ARE_EQUAL ( "VAR1", if1.property );
28 ARE_EQUAL ( "value1", if1.value );
29
30 ARE_EQUAL ( 1, if1.data.compilerFlags.size () );
31 CompilerFlag& compilerFlag1 = *if1.data.compilerFlags[0];
32 ARE_EQUAL( "compilerflag1", compilerFlag1.flag );
33 }
34
35 void
36 IfTest::TestModuleIf ( Project& project )
37 {
38 ARE_EQUAL ( 1, project.modules.size () );
39 Module& module1 = *project.modules[0];
40
41 ARE_EQUAL ( 1, module1.non_if_data.ifs.size () );
42 If& if1 = *module1.non_if_data.ifs[0];
43 ARE_EQUAL ( "VAR2", if1.property );
44 ARE_EQUAL ( "value2", if1.value );
45
46 ARE_EQUAL ( 1, if1.data.files.size () );
47 File& file1 = *if1.data.files[0];
48 ARE_EQUAL( SSEP "file1.c", file1.name );
49
50 ARE_EQUAL ( 1, module1.non_if_data.files.size () );
51 File& file2 = *module1.non_if_data.files[0];
52 ARE_EQUAL( SSEP "file2.c", file2.name );
53
54 ARE_EQUAL ( 1, if1.data.compilerFlags.size () );
55 CompilerFlag& compilerFlag2 = *if1.data.compilerFlags[0];
56 ARE_EQUAL( "compilerflag2", compilerFlag2.flag );
57 }
58
59 void
60 IfTest::Run ()
61 {
62 string projectFilename ( RBUILD_BASE "tests/data/if.xml" );
63 Configuration configuration;
64 Project project ( configuration, projectFilename );
65
66 TestProjectIf ( project );
67 TestModuleIf ( project );
68 }