Add copyright notices and GPL headers to rbuild
[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 RBUILD_BASE "tools" SSEP "rbuild" SSEP
25
26 class BaseTest
27 {
28 public:
29 bool Failed;
30 BaseTest ();
31 virtual ~BaseTest ();
32 virtual void Run () = 0;
33 protected:
34 void Assert ( const char *message,
35 ... );
36 void IsNull ( void* reference,
37 const char* file,
38 int line );
39 void IsNotNull ( void* reference,
40 const char* file,
41 int line );
42 void IsTrue ( bool condition,
43 const char* file,
44 int line );
45 void IsFalse ( bool condition,
46 const char* file,
47 int line );
48 void AreEqual ( int expected,
49 int actual,
50 const char* file,
51 int line );
52 void AreEqual ( const std::string& expected,
53 const std::string& actual,
54 const char* file,
55 int line );
56 void AreNotEqual ( int expected,
57 int actual,
58 const char* file,
59 int line );
60 private:
61 void Fail ();
62 };
63
64 #define IS_NULL(reference) IsNull((void*)reference,__FILE__,__LINE__)
65 #define IS_NOT_NULL(reference) IsNotNull((void*)reference,__FILE__,__LINE__)
66 #define IS_TRUE(condition) IsTrue(condition,__FILE__,__LINE__)
67 #define IS_FALSE(condition) IsFalse(condition,__FILE__,__LINE__)
68 #define ARE_EQUAL(expected,actual) AreEqual(expected,actual,__FILE__,__LINE__)
69 #define ARE_NOT_EQUAL(expected,actual) AreNotEqual(expected,actual,__FILE__,__LINE__)
70
71 class ProjectTest : public BaseTest
72 {
73 public:
74 void Run ();
75 };
76
77
78 class ModuleTest : public BaseTest
79 {
80 public:
81 void Run ();
82 };
83
84
85 class DefineTest : public BaseTest
86 {
87 public:
88 void Run ();
89 };
90
91
92 class IncludeTest : public BaseTest
93 {
94 public:
95 void Run ();
96 };
97
98
99 class InvokeTest : public BaseTest
100 {
101 public:
102 void Run ();
103 };
104
105
106 class LinkerFlagTest : public BaseTest
107 {
108 public:
109 void Run ();
110 };
111
112
113 class IfTest : public BaseTest
114 {
115 public:
116 void Run ();
117 private:
118 void TestProjectIf ( Project& project );
119 void TestModuleIf ( Project& project );
120 };
121
122
123 class FunctionTest : public BaseTest
124 {
125 public:
126 void Run ();
127 };
128
129
130 class SourceFileTest : public BaseTest
131 {
132 public:
133 void Run ();
134 void IncludeTest ();
135 void FullParseTest ();
136 private:
137 bool IsParentOf ( const SourceFile* parent,
138 const SourceFile* child );
139
140 };
141
142
143 class CDFileTest : public BaseTest
144 {
145 public:
146 void Run ();
147 };
148
149
150 class SymbolTest : public BaseTest
151 {
152 public:
153 void Run ();
154 };
155
156 #endif /* __TEST_H */