test_main.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /*************************************************************************/
  2. /* test_main.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  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 "core/list.h"
  31. #include "core/os/main_loop.h"
  32. #ifdef DEBUG_ENABLED
  33. #include "test_astar.h"
  34. #include "test_gdscript.h"
  35. #include "test_gui.h"
  36. #include "test_image.h"
  37. #include "test_math.h"
  38. #include "test_oa_hash_map.h"
  39. #include "test_ordered_hash_map.h"
  40. #include "test_physics.h"
  41. #include "test_physics_2d.h"
  42. #include "test_render.h"
  43. #include "test_shader_lang.h"
  44. #include "test_string.h"
  45. const char **tests_get_names() {
  46. static const char *test_names[] = {
  47. "string",
  48. "math",
  49. "physics",
  50. "physics_2d",
  51. "render",
  52. "oa_hash_map",
  53. "gui",
  54. "shaderlang",
  55. "gd_tokenizer",
  56. "gd_parser",
  57. "gd_compiler",
  58. "gd_bytecode",
  59. "image",
  60. "ordered_hash_map",
  61. "astar",
  62. NULL
  63. };
  64. return test_names;
  65. }
  66. MainLoop *test_main(String p_test, const List<String> &p_args) {
  67. if (p_test == "string") {
  68. return TestString::test();
  69. }
  70. if (p_test == "math") {
  71. return TestMath::test();
  72. }
  73. if (p_test == "physics") {
  74. return TestPhysics::test();
  75. }
  76. if (p_test == "physics_2d") {
  77. return TestPhysics2D::test();
  78. }
  79. if (p_test == "render") {
  80. return TestRender::test();
  81. }
  82. if (p_test == "oa_hash_map") {
  83. return TestOAHashMap::test();
  84. }
  85. #ifndef _3D_DISABLED
  86. if (p_test == "gui") {
  87. return TestGUI::test();
  88. }
  89. #endif
  90. if (p_test == "shaderlang") {
  91. return TestShaderLang::test();
  92. }
  93. if (p_test == "gd_tokenizer") {
  94. return TestGDScript::test(TestGDScript::TEST_TOKENIZER);
  95. }
  96. if (p_test == "gd_parser") {
  97. return TestGDScript::test(TestGDScript::TEST_PARSER);
  98. }
  99. if (p_test == "gd_compiler") {
  100. return TestGDScript::test(TestGDScript::TEST_COMPILER);
  101. }
  102. if (p_test == "gd_bytecode") {
  103. return TestGDScript::test(TestGDScript::TEST_BYTECODE);
  104. }
  105. if (p_test == "image") {
  106. return TestImage::test();
  107. }
  108. if (p_test == "ordered_hash_map") {
  109. return TestOrderedHashMap::test();
  110. }
  111. if (p_test == "astar") {
  112. return TestAStar::test();
  113. }
  114. return NULL;
  115. }
  116. #else
  117. const char **tests_get_names() {
  118. static const char *test_names[] = {
  119. NULL
  120. };
  121. return test_names;
  122. }
  123. MainLoop *test_main(String p_test, const List<String> &p_args) {
  124. return NULL;
  125. }
  126. #endif