Commit graph

294 commits

Author SHA1 Message Date
Yuri Roubinsky
38a5d22079 Renamed String.ord_at to unicode_at 2021-01-26 20:36:12 +03:00
Rémi Verschelde
6ddfc8e718
Merge pull request #44797 from a-ivanov/marshall-core-unit-tests
Marshall core unit tests
2021-01-24 20:41:57 +01:00
Anton Ivanov
69b554e92d
Unit tests for encoding/decoding Variant 2021-01-24 17:15:07 +03:00
Anton Ivanov
8aed1ee8f7
Unit tests for encoding/decoding of base types 2021-01-24 17:15:07 +03:00
Rémi Verschelde
1218441b16
Merge pull request #44514 from madmiraal/split-os-execute
Split OS::execute into two methods
2021-01-12 16:17:04 +01:00
AndreaCatania
5ba60c17dd Add function LocalVector::remove_unordered
Added LocalVector unit tests.
2021-01-11 13:47:31 +01:00
Marcel Admiraal
2a74b388d0 Split OS::execute into two methods
1. execute(): Executes a command and returns the results.
2. create_process(): Creates a new process and returns the new process' id.
2021-01-09 10:03:23 +00:00
Ignacio Etcheverry
fafdc0b0c1 Add ClassDB tests to look for core API deps on editor API
The ClassDB tests will detect when the core API has dependencies on
the editor API, which is not allowed.

This should prevent or warn early about issues like #44856
2021-01-09 00:18:03 +01:00
Andrii Doroshenko (Xrayez)
faab6ff97a Use comma over << operator for all unit test logging
The comma operator should be preferred now according to doctest.

Moved macro aliases from `ClassDB` tests to `test_macros.h`, because those
are also used in `TextServer` tests.
2021-01-08 14:15:43 +02:00
Rémi Verschelde
7917cb12df
doctest: Update to 2.4.4
Make ClassDB test macros enforce their msg to be constructed as String,
since doctest 2.4.2 changes the message passing to vararg.
2021-01-08 11:37:36 +01:00
Rémi Verschelde
b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Marcus Brummer
e455ca2f2f Added Geometry2D unit tests 2020-12-30 21:11:09 +01:00
Andrii Doroshenko (Xrayez)
21319feb9c Increase number of sections in object files for tests with MSVC 2020-12-30 15:48:23 +02:00
Rémi Verschelde
6cebb8c117
Merge pull request #44586 from madmiraal/rename-stepify
Rename Math::stepify to snapped
2020-12-28 21:46:43 +01:00
Rémi Verschelde
9addcb7603
Merge pull request #44751 from madmiraal/rename-rect-grow_margin
Rename Rect2 and Rect2i grow_margin() to grow_side()
2020-12-28 15:56:14 +01:00
Rémi Verschelde
e4c0572385
Merge pull request #44593 from madmiraal/rename-mainloop-methods
Rename MainLoop methods to match Node methods
2020-12-28 14:44:28 +01:00
Marcel Admiraal
b743a2ef3c Rename Math::stepify to snapped 2020-12-28 13:01:30 +00:00
Marcel Admiraal
b628912af0 Rename Rect2 and Rect2i grow_margin() to grow_side() 2020-12-28 12:47:33 +00:00
Rémi Verschelde
18fefe700f
Merge pull request #44687 from Xrayez/tests-data-rel-path
Use relative path to executable for loading test data
2020-12-28 13:34:19 +01:00
Marcel Admiraal
5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Andrii Doroshenko (Xrayez)
f018ae74f9 Use relative path to executable for loading test data
Fixes crash if tests are run outside the Godot root directory.
2020-12-25 20:28:28 +02:00
Marcel Admiraal
4b8b803931 Rename Control margin to offset 2020-12-23 06:25:56 +00:00
Marcel Admiraal
d9e9eb8d04 Rename MainLoop methods to match Node methods 2020-12-22 12:34:57 +00:00
Marco Cognetta
900e55eb70 simplify randi_range 2020-12-21 20:25:58 -05:00
reduz
37c6434e16 Add a paged array template
Used for reusable stacks, or filling arrays from multiple threads efficiently.
2020-12-21 15:06:50 -03:00
Andrii Doroshenko (Xrayez)
b12a6cb431 Add unit test for RandomNumberGenerator
This covers RNG functionality completely.

Co-authored-by: @vinayakmtiwari.
2020-12-21 03:12:53 +02:00
Rémi Verschelde
f3d1fceb16
Merge pull request #42136 from Xrayez/test-list-api
Add test cases for the `List` to cover public methods
2020-12-20 21:15:55 +01:00
Marcel Admiraal
2df9a8ccad Rename Rect2 and Rect2i clip() to intersection() 2020-12-19 12:59:08 +00:00
reduz
d2302f53d6 Implement automatic LOD (Level of Detail)
-Happens on import by default for all models
-Just works (tm)
-Biasing can be later adjusted per node or per viewport (as well as globally)
-Disabled AABB.get_support test because its broken
2020-12-18 15:48:03 +01:00
Andrii Doroshenko (Xrayez)
ed7014c67a Add test suite for FileAccess 2020-12-11 16:05:18 +02:00
Andrii Doroshenko (Xrayez)
932acad53f Add test suite for RandomNumberGenerator 2020-12-07 13:51:03 +02:00
Fabio Alessandrelli
502ff74fee
Merge pull request #43536 from jonbonazza/hmac
feat: HMAC support in Crypto APIs
2020-12-03 11:08:16 +01:00
Jon Bonazza
d5925fd522 feat: HMAC support in Crypto APIs 2020-11-26 18:39:56 -08:00
bruvzg
493da99269
[Complex Text Layouts] Implement TextServer interface. Implement Fallback TextServer. 2020-11-26 13:55:26 +02:00
Rémi Verschelde
a248e6f8c3
Merge pull request #43781 from MaxMutantMayer/regex_unit_tests
Move and add new RegEx test cases
2020-11-23 10:07:07 +01:00
Rémi Verschelde
6221210c6c
Merge pull request #43727 from Calinou/test-add-aabb
Add a test suite for AABB
2020-11-23 09:30:44 +01:00
Maximilian Mayer
7edb50a31c Move and add new RegEx test cases
Test cases for 'RegEx' are moved from 'test_string.h' to own test suite
in 'test_regex.h'. Additionally, new tests are introduced and '_init' is
removed as it isn't implemented/used anywhere.
2020-11-22 22:48:03 +01:00
Hugo Locurcio
6f24bc3e47
Add a test suite for AABB 2020-11-20 19:44:08 +01:00
Rémi Verschelde
34895e7b28
Merge pull request #43583 from Calinou/test-add-object
Add a test suite for Object
2020-11-20 14:03:12 +01:00
Rémi Verschelde
29f34782f0
Merge pull request #43514 from Calinou/test-add-rect2-rect2i
Add a test suite for Rect2 and Rect2i
2020-11-20 13:40:12 +01:00
Hugo Locurcio
e924bf9dec
Add a test suite for Object 2020-11-20 13:24:14 +01:00
Hugo Locurcio
7cb21c21b3
Add a test suite for Rect2 and Rect2i 2020-11-20 12:53:37 +01:00
Rémi Verschelde
d9dd3b2768
Style fix after #43517 2020-11-20 12:52:30 +01:00
Rémi Verschelde
d87e192be6
Merge pull request #43517 from Calinou/test-add-json
Add a test suite for JSON
2020-11-20 12:47:27 +01:00
Andrii Doroshenko (Xrayez)
dc980e5f96 doctest: Do not override command-line options
Those options were likely copy-pasted from documentation examples.
This change also allows to break in the debugger by default when
assertions fail, and this can be configured via command-line interface.
2020-11-20 13:21:45 +02:00
Aaron Franke
02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Hugo Locurcio
f91a6eba10
Add a test suite for ConfigFile 2020-11-16 14:35:10 +01:00
Rémi Verschelde
7a6eab2ce3
Merge pull request #43578 from Calinou/test-add-nodepath
Add a test suite for NodePath
2020-11-16 12:54:26 +01:00
Rémi Verschelde
db98a61913
Merge pull request #43572 from Calinou/test-add-pckpacker
Add a test suite for PCKPacker
2020-11-16 12:54:02 +01:00
Hugo Locurcio
bf82da3d0f
Add a test suite for NodePath 2020-11-15 22:28:25 +01:00
Hugo Locurcio
9574a834e5
Add a test suite for PCKPacker 2020-11-15 20:05:46 +01:00
Hugo Locurcio
038bbf7b6b
Add a test suite for JSON
This test suite doesn't attempt to test error/invalid cases since
the current JSON parser has a lot of false negatives.
2020-11-14 00:13:32 +01:00
Hugo Locurcio
8fefbda818
Add a test suite for Curve 2020-11-13 22:46:05 +01:00
Rémi Verschelde
9d2e8f2f27
Variant: Rename Type::_RID to Type::RID
The underscore prefix was used to avoid the conflict between the `RID` class
name and the matching enum value in `Variant::Type`.

This can be fixed differently by prefixing uses of the `RID` class in `Variant`
with the scope resolution operator, as done already for `AABB`.
2020-11-09 16:29:04 +01:00
reduz
127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
reduz
f2397809a8 Refactored Variant Operators.
-Using classes to call and a table
-For typed code (GDS or GDNative), can obtain functions to call prevalidated or ptr.
2020-11-06 12:45:50 -03:00
Hugo Locurcio
7adb6b91b3
Remove Color.contrasted() as its behavior is barely useful
Returning the most contrasting color isn't a trivial task, as there
are often many possible choices. It's usually best left for the user
to implement using a script.
2020-11-03 04:46:08 -05:00
reduz
ee06a70ea6 Refactor MethodBind to use variadic templates
Removed make_binders and the old style generated binders.
2020-10-18 12:28:44 +02:00
Lyuma
48e8da4aac core/command_queue_mt: Customizable size and tests
Adds unit tests for command_queue_mt.h/cpp
In this revision, some unit tests will fail due to issue #42107.
2020-10-12 08:24:08 -07:00
Andrii Doroshenko (Xrayez)
dbce08d4ba Add test cases for the List to cover public methods
Except for overloaded operators.
2020-09-23 14:03:13 +03:00
Rémi Verschelde
3e78963bb9
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2020-09-18 13:44:25 +02:00
Rémi Verschelde
6ac7b90097
Merge pull request #42013 from Xrayez/fix-list-swap
Fix `List` swap behavior on front, back and adjacent elements
2020-09-16 17:39:43 +02:00
Pawel Lampe
b2d8c5140e Add test cases for numeric literals with underscores 2020-09-14 20:21:07 +02:00
Andrii Doroshenko (Xrayez)
4e6b5169b0 Add a test suite for List
Adds a number of test cases for `List::swap()`.
2020-09-13 00:14:51 +03:00
Andrii Doroshenko (Xrayez)
174b6e817f Move GDNative String tests to respective module
GDNative-specific tests moved out of main `tests/` folder into
`modules/gdnative/tests`.

Include path for GDNative headers are still hardcoded in `tests/SCsub`,
but made conditional now.

Also fixed test case tag typos.

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2020-09-11 14:51:38 +03:00
bruvzg
80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
strank
16913368eb Fix doctest runner ignoring all arguments starting with --test
Instead of just the one argument that is exactly --test.
The long-form arguments --test-case and --test-suite were ignored.
2020-09-02 11:23:34 -04:00
Andrii Doroshenko (Xrayez)
0cc05c5a31 Register GDScript test tools as test commands to run via command-line 2020-09-02 01:43:26 +03:00
Andrii Doroshenko (Xrayez)
6b7e50ab34 Move GDScript tests to respective folder under modules 2020-09-02 01:09:32 +03:00
George Marques
635c6a0a18
Add GDScript disassembler 2020-09-01 14:36:30 -03:00
Aaron Franke
1a5ba0fc07
Fix Color test cases for RGBA 2020-09-01 02:07:35 -04:00
Rémi Verschelde
a276e6fc36
Merge pull request #40955 from Calinou/test-add-expression
Add a test suite for Expression
2020-08-31 11:12:34 +02:00
Hugo Locurcio
d5ffa42cd2
Add a test suite for Expression
This also makes the first parameter of `Expression::execute()` optional
from C++. Previously, it was only optional in the scripting API.
2020-08-27 15:16:09 +02:00
Hugo Locurcio
66de28ada5
Add a test suite for Gradient 2020-08-19 01:33:40 +02:00
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