test_main.cpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /**************************************************************************/
  2. /* test_main.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #include "test_main.h"
  31. #include "core/list.h"
  32. #ifdef DEBUG_ENABLED
  33. #include "test_astar.h"
  34. #include "test_basis.h"
  35. #include "test_crypto.h"
  36. #include "test_gdscript.h"
  37. #include "test_gui.h"
  38. #include "test_math.h"
  39. #include "test_oa_hash_map.h"
  40. #include "test_ordered_hash_map.h"
  41. #include "test_physics.h"
  42. #include "test_physics_2d.h"
  43. #include "test_render.h"
  44. #include "test_shader_lang.h"
  45. #include "test_string.h"
  46. #include "test_theme.h"
  47. #include "test_transform.h"
  48. #include "test_xml_parser.h"
  49. const char **tests_get_names() {
  50. static const char *test_names[] = {
  51. "string",
  52. "math",
  53. "basis",
  54. "transform",
  55. "physics",
  56. "physics_2d",
  57. "render",
  58. "oa_hash_map",
  59. "gui",
  60. "shaderlang",
  61. "gd_tokenizer",
  62. "gd_parser",
  63. "gd_compiler",
  64. "gd_bytecode",
  65. "ordered_hash_map",
  66. "astar",
  67. "xml_parser",
  68. "theme",
  69. nullptr
  70. };
  71. return test_names;
  72. }
  73. MainLoop *test_main(String p_test, const List<String> &p_args) {
  74. if (p_test == "string") {
  75. return TestString::test();
  76. }
  77. if (p_test == "math") {
  78. return TestMath::test();
  79. }
  80. if (p_test == "basis") {
  81. return TestBasis::test();
  82. }
  83. if (p_test == "transform") {
  84. return TestTransform::test();
  85. }
  86. if (p_test == "physics") {
  87. return TestPhysics::test();
  88. }
  89. if (p_test == "physics_2d") {
  90. return TestPhysics2D::test();
  91. }
  92. if (p_test == "render") {
  93. return TestRender::test();
  94. }
  95. if (p_test == "oa_hash_map") {
  96. return TestOAHashMap::test();
  97. }
  98. #ifndef _3D_DISABLED
  99. if (p_test == "gui") {
  100. return TestGUI::test();
  101. }
  102. #endif
  103. if (p_test == "shaderlang") {
  104. return TestShaderLang::test();
  105. }
  106. if (p_test == "crypto") {
  107. return TestCrypto::test();
  108. }
  109. if (p_test == "gd_tokenizer") {
  110. return TestGDScript::test(TestGDScript::TEST_TOKENIZER);
  111. }
  112. if (p_test == "gd_parser") {
  113. return TestGDScript::test(TestGDScript::TEST_PARSER);
  114. }
  115. if (p_test == "gd_compiler") {
  116. return TestGDScript::test(TestGDScript::TEST_COMPILER);
  117. }
  118. if (p_test == "gd_bytecode") {
  119. return TestGDScript::test(TestGDScript::TEST_BYTECODE);
  120. }
  121. if (p_test == "ordered_hash_map") {
  122. return TestOrderedHashMap::test();
  123. }
  124. if (p_test == "astar") {
  125. return TestAStar::test();
  126. }
  127. if (p_test == "xml_parser") {
  128. return TestXMLParser::test();
  129. }
  130. if (p_test == "theme") {
  131. return TestTheme::test();
  132. }
  133. print_line("Unknown test: " + p_test);
  134. return nullptr;
  135. }
  136. #else
  137. const char **tests_get_names() {
  138. static const char *test_names[] = {
  139. NULL
  140. };
  141. return test_names;
  142. }
  143. MainLoop *test_main(String p_test, const List<String> &p_args) {
  144. return NULL;
  145. }
  146. #endif