Merge from branch ReactX to Trunk,
[reactos.git] / reactos / tools / rbuild / test.h
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
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18 #ifndef __TEST_H
19 #define __TEST_H
20
21 #include "rbuild.h"
22 #include "backend/mingw/mingw.h"
23
24 #define SSEP DEF_SSEP
25
26 #define RBUILD_BASE "tools" SSEP "rbuild" SSEP
27
28 class BaseTest
29 {
30 public:
31 bool Failed;
32 BaseTest ();
33 virtual ~BaseTest ();
34 virtual void Run () = 0;
35 protected:
36 void Assert ( const char *message,
37 ... );
38 void IsNull ( void* reference,
39 const char* file,
40 int line );
41 void IsNotNull ( void* reference,
42 const char* file,
43 int line );
44 void IsTrue ( bool condition,
45 const char* file,
46 int line );
47 void IsFalse ( bool condition,
48 const char* file,
49 int line );
50 void AreEqual ( int expected,
51 int actual,
52 const char* file,
53 int line );
54 void AreEqual ( const std::string& expected,
55 const std::string& actual,
56 const char* file,
57 int line );
58 void AreNotEqual ( int expected,
59 int actual,
60 const char* file,
61 int line );
62 private:
63 void Fail ();
64 };
65
66 #define IS_NULL(reference) IsNull((void*)reference,__FILE__,__LINE__)
67 #define IS_NOT_NULL(reference) IsNotNull((void*)reference,__FILE__,__LINE__)
68 #define IS_TRUE(condition) IsTrue(condition,__FILE__,__LINE__)
69 #define IS_FALSE(condition) IsFalse(condition,__FILE__,__LINE__)
70 #define ARE_EQUAL(expected,actual) AreEqual(expected,actual,__FILE__,__LINE__)
71 #define ARE_NOT_EQUAL(expected,actual) AreNotEqual(expected,actual,__FILE__,__LINE__)
72
73 class ProjectTest : public BaseTest
74 {
75 public:
76 void Run ();
77 };
78
79
80 class ModuleTest : public BaseTest
81 {
82 public:
83 void Run ();
84 };
85
86
87 class DefineTest : public BaseTest
88 {
89 public:
90 void Run ();
91 };
92
93
94 class IncludeTest : public BaseTest
95 {
96 public:
97 void Run ();
98 };
99
100
101 class InvokeTest : public BaseTest
102 {
103 public:
104 void Run ();
105 };
106
107
108 class LinkerFlagTest : public BaseTest
109 {
110 public:
111 void Run ();
112 };
113
114
115 class IfTest : public BaseTest
116 {
117 public:
118 void Run ();
119 private:
120 void TestProjectIf ( Project& project );
121 void TestModuleIf ( Project& project );
122 };
123
124
125 class FunctionTest : public BaseTest
126 {
127 public:
128 void Run ();
129 };
130
131
132 class SourceFileTest : public BaseTest
133 {
134 public:
135 void Run ();
136 void IncludeTest ();
137 void FullParseTest ();
138 private:
139 bool IsParentOf ( const SourceFile* parent,
140 const SourceFile* child );
141
142 };
143
144
145 class CDFileTest : public BaseTest
146 {
147 public:
148 void Run ();
149 };
150
151
152 class SymbolTest : public BaseTest
153 {
154 public:
155 void Run ();
156 };
157
158 class CompilationUnitTest : public BaseTest
159 {
160 public:
161 void Run ();
162 };
163
164 #endif /* __TEST_H */