Commit Graph

370 Commits

Author SHA1 Message Date
Andrii Doroshenko (Xrayez) 6f426c3360 Port ClassDB tests to use doctest
Extracted the most minimal core initialization functionality from
`setup()` and `setup2()` so that `ClassDB` could be tested properly
(input, audio, rendering, physics etc, are excluded).

Display and rendering servers/singletons are not initialized at all.

Due to the fact that most subsystems are disabled, fixed various crashes in the
process (in order):
- `AcceptDialog` OK/cancel swap behavior (used `DisplayServer` while
  `register_scene_types()`);
- `make_default_theme` which depends on `RenderingServer`;
- `XRServer` singleton access while calling `register_modules_types()`;
- hidden bug in a way joypads are cleaned up (MacOS and Linux only).

Removed manual `ClassDB` init/cleanup calls from `test_validate_testing.h`.

ClassDB tests:

Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
2020-08-16 16:41:02 +03:00
Rémi Verschelde c9dbe14a8f
Merge pull request #41117 from 3akev/master
Port OrderedHashMap tests to doctest
2020-08-14 13:08:57 +02:00
Rémi Verschelde b3707aeff2
Merge pull request #40940 from fire/tests-port-basis
Port Basis tests to use doctest.
2020-08-11 12:43:52 +02:00
Aladdin Al-Khafaji 9118a41dea Port OrderedHashMap tests to doctest 2020-08-08 15:49:50 +03:00
Andrii Doroshenko (Xrayez) 76e00d2405 Stringify `Variant` compatible types for doctest output 2020-08-02 01:38:24 +03:00
K. S. Ernest (iFire) Lee 98b709c3f8 Port Basis tests to use doctest. 2020-08-01 08:27:10 -07:00
Andrii Doroshenko (Xrayez) db1259ac70 Fix memory leak in test args 2020-07-31 23:58:22 +03:00
Rémi Verschelde 29df1919e1
Merge pull request #40928 from bruvzg/fix_test_heap_use_after_free
Fix heap use after free in the doctest "main".
2020-07-31 21:21:18 +02:00
Hugo Locurcio 979072b9a4
Add a test suite for Color 2020-07-31 21:04:16 +02:00
bruvzg 0a89498f51
Fix heap use after free in the doctest "main". 2020-07-31 21:52:48 +03:00
Andrii Doroshenko (Xrayez) 3645317036 Port AStar tests to use doctest 2020-07-31 02:09:40 +03:00
Andrii Doroshenko (Xrayez) 0512cc01d9 Hide implementation details of doctest macros
`test_macros.h` is created to provide various macros acting as aliases for
doctest macros to work better with Godot internals and conventions. This also
makes it accessible for those who'd like to start writing tests in Godot, as
most vital information can be put together and documented directly in
`test_macros.h` header.

Developers are encouraged to include the new `tests/test_macros.h` for writing
new tests over `thirdparty/doctest/doctest.h`.

Added `TEST_CASE_PENDING("name")` as an alias for
`TEST_CASE("name", doctest::skip())` which could be used to mark failing tests
for issues yet to be fixed, so as to not affect CI testing results.

Added `ERR_PRINT_OFF` and `ERR_PRINT_ON` to control error printing for testing
various **expected** failure paths within Godot without polluting the test
summary with error messages.
2020-07-30 16:58:12 +03:00
Andrii Doroshenko (Xrayez) 63720648e8 Cleanup obsolete tests from displaying in help 2020-07-29 15:07:16 +03:00
Andrii Doroshenko (Xrayez) 3f77056dc6 Add test suite for `Variant`
Added a test case for `VariantWriter` and `VariantParser` overflows.
2020-07-28 18:34:55 +03:00
Aaron Franke 56e2c6c704
Make all String float conversion methods be 64-bit 2020-07-27 18:38:53 -04:00
Gordon 968bfdb72a Crash when debugging tests by disabling thread_local in /MT context 2020-07-26 18:24:52 +01:00
Rémi Verschelde b35be146da
Merge pull request #40720 from Xrayez/modules-tests
Enable support for C++ modules tests
2020-07-26 17:04:41 +02:00
Andrii Doroshenko (Xrayez) 60f53140b8 Enable support for C++ modules tests
Modules-specific tests can be written under respective module folders.
Each module should have "tests" folder created with the tests implemented
as `doctest` headers, so they can be collected by the buildsystem and
included directly in `tests/test_main.cpp` to be compiled.
2020-07-26 17:41:46 +03:00
Rémi Verschelde a3a980eb0d SCons: Build tests/ and main/ in cloned environments
Allows switching `tests=yes`/`no` and rebuilding only tests and main,
instead of the whole engine.

Co-authored-by: Andrii Doroshenko (Xrayez) <xrayez@gmail.com>
2020-07-26 16:03:11 +02:00
Andrii Doroshenko (Xrayez) 9f649efe5d Move `tests` to the top-level directory 2020-07-26 00:06:07 +03:00