1 /*************************************************************************/
2 /*  test_main.cpp                                                        */
3 /*************************************************************************/
4 /*                       This file is part of:                           */
5 /*                           GODOT ENGINE                                */
6 /*                      https://godotengine.org                          */
7 /*************************************************************************/
8 /* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur.                 */
9 /*                                                                       */
10 /* Permission is hereby granted, free of charge, to any person obtaining */
11 /* a copy of this software and associated documentation files (the       */
12 /* "Software"), to deal in the Software without restriction, including   */
13 /* without limitation the rights to use, copy, modify, merge, publish,   */
14 /* distribute, sublicense, and/or sell copies of the Software, and to    */
15 /* permit persons to whom the Software is furnished to do so, subject to */
16 /* the following conditions:                                             */
17 /*                                                                       */
18 /* The above copyright notice and this permission notice shall be        */
19 /* included in all copies or substantial portions of the Software.       */
20 /*                                                                       */
21 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
22 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
23 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
24 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
25 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
26 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
27 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
28 /*************************************************************************/
29 #include "list.h"
30 #include "os/main_loop.h"
31 
32 #ifdef DEBUG_ENABLED
33 
34 #include "test_containers.h"
35 #include "test_detailer.h"
36 #include "test_gdscript.h"
37 #include "test_gui.h"
38 #include "test_image.h"
39 #include "test_io.h"
40 #include "test_math.h"
41 #include "test_misc.h"
42 #include "test_particles.h"
43 #include "test_physics.h"
44 #include "test_physics_2d.h"
45 #include "test_python.h"
46 #include "test_render.h"
47 #include "test_shader_lang.h"
48 #include "test_sound.h"
49 #include "test_string.h"
50 
tests_get_names()51 const char **tests_get_names() {
52 
53 	static const char *test_names[] = {
54 		"string",
55 		"containers",
56 		"math",
57 		"render",
58 		"particles",
59 		"multimesh",
60 		"gui",
61 		"io",
62 		"shaderlang",
63 		"physics",
64 		NULL
65 	};
66 
67 	return test_names;
68 }
69 
test_main(String p_test,const List<String> & p_args)70 MainLoop *test_main(String p_test, const List<String> &p_args) {
71 
72 	if (p_test == "string") {
73 
74 		return TestString::test();
75 	}
76 
77 	if (p_test == "containers") {
78 
79 		return TestContainers::test();
80 	}
81 
82 	if (p_test == "math") {
83 
84 		return TestMath::test();
85 	}
86 
87 	if (p_test == "physics") {
88 
89 		return TestPhysics::test();
90 	}
91 
92 	if (p_test == "physics_2d") {
93 
94 		return TestPhysics2D::test();
95 	}
96 
97 	if (p_test == "misc") {
98 
99 		return TestMisc::test();
100 	}
101 
102 	if (p_test == "render") {
103 
104 		return TestRender::test();
105 	}
106 
107 #ifndef _3D_DISABLED
108 	if (p_test == "gui") {
109 
110 		return TestGUI::test();
111 	}
112 #endif
113 
114 	if (p_test == "sound") {
115 
116 		return TestSound::test();
117 	}
118 
119 	if (p_test == "io") {
120 
121 		return TestIO::test();
122 	}
123 
124 	if (p_test == "particles") {
125 
126 		return TestParticles::test();
127 	}
128 
129 	if (p_test == "multimesh") {
130 
131 		return TestMultiMesh::test();
132 	}
133 
134 	if (p_test == "shaderlang") {
135 
136 		return TestShaderLang::test();
137 	}
138 
139 	if (p_test == "gd_tokenizer") {
140 
141 		return TestGDScript::test(TestGDScript::TEST_TOKENIZER);
142 	}
143 
144 	if (p_test == "gd_parser") {
145 
146 		return TestGDScript::test(TestGDScript::TEST_PARSER);
147 	}
148 
149 	if (p_test == "gd_compiler") {
150 
151 		return TestGDScript::test(TestGDScript::TEST_COMPILER);
152 	}
153 
154 	if (p_test == "gd_bytecode") {
155 
156 		return TestGDScript::test(TestGDScript::TEST_BYTECODE);
157 	}
158 
159 	if (p_test == "image") {
160 
161 		return TestImage::test();
162 	}
163 
164 	if (p_test == "detailer") {
165 
166 		return TestMultiMesh::test();
167 	}
168 
169 #ifdef PYTHON_ENABLED
170 
171 	if (p_test == "python") {
172 
173 		return TestPython::test();
174 	}
175 #endif
176 
177 	return NULL;
178 }
179 
180 #else
181 
tests_get_names()182 const char **tests_get_names() {
183 
184 	static const char *test_names[] = {
185 		NULL
186 	};
187 
188 	return test_names;
189 }
190 
test_main(String p_test,const List<String> & p_args)191 MainLoop *test_main(String p_test, const List<String> &p_args) {
192 
193 	return NULL;
194 }
195 
196 #endif
197