Commit Graph

34 Commits

Author SHA1 Message Date
Shauren
da4312c58c fix tests build 2024-09-10 18:48:41 +02:00
Shauren
08c293462f GCC build fix
(cherry picked from commit b705283d0e)
2024-03-14 00:14:31 +01:00
Shauren
668932cf1d Tests: Disable intentionally triggered warning in test code
(cherry picked from commit 37899f3954)
2024-03-13 22:13:45 +01:00
Shauren
e3ecd87a76 Core/Utils: unique_trackable_ptr improvements
* Added comparison operators
* Added type casting helper functions

(cherry picked from commit f690b69338)
2024-03-13 22:13:02 +01:00
Shauren
92547f4b31 Fix tests build
(cherry picked from commit 1f3ebbb23c)
2024-03-13 22:12:41 +01:00
Shauren
b0eee55897 Core/Utils: Added a custom smart pointer type unique_trackable_ptr - a specialized variant of std::shared_ptr that enforces unique ownership
* This is intended to be used by external code unable to track object lifetime such as custom scripting engines

(cherry picked from commit 32e54b6bd1)
2024-03-13 22:11:12 +01:00
Shauren
58f0c4b15a Tests: Fixed environment variable confg test compilation on windows
(cherry picked from commit cd62dc4491)
2023-08-12 17:56:16 +02:00
Shauren
cccc062ea0 Core/Misc: Remove boost::heap::fibonacci_heap from header files
(cherry picked from commit e8e330addd)
2023-08-12 17:56:15 +02:00
Shauren
30adff16ae Core/Utils: Replace boost flat_set with our own
(cherry picked from commit 42fbcf2fc5)
2023-08-12 17:56:15 +02:00
Anton Popovichenko
1ddd9dc19c Core/Config: Implement config override with env vars (#26811)
* Core/Config: Implement config override with env vars

Implement overriding of configuration from the .conf file with environment variables.
Environment variables keys are autogenerated based on the keys defined in .conf file.
Usage example:
$ export TC_DATA_DIR=/usr
$ TC_WORLD_SERVER_PORT=8080 ./worldserver

* Core/Config Fix typo in logs

Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com>

* Core/Config Fix code style in EnvVarForIniKey

Co-authored-by: Shauren <shauren.trinity@gmail.com>

* Update tests/common/Config.cpp

* Apply suggestions from code review

Co-authored-by: Peter Keresztes Schmidt <carbenium@outlook.com>

* Apply suggestions from code review

Co-authored-by: Peter Keresztes Schmidt <carbenium@outlook.com>

Co-authored-by: Anton Popovichenko <anton.popovichenko@mendix.com>
Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com>
Co-authored-by: Shauren <shauren.trinity@gmail.com>
Co-authored-by: Peter Keresztes Schmidt <carbenium@outlook.com>
2021-08-19 22:26:16 +02:00
Treeston
1eca51b417 [3.3.5] ChatCommands, the other half: chat command resolution refactor (PR #25463) 2020-09-20 02:50:38 +02:00
Treeston
090e3da96b Core/Chat: Fix hyperlink validation for inspected item links, for real this time. 2020-09-12 20:27:46 +02:00
Treeston
75f9e7396e [3.3.5] Core/ChatCommands: Show error messages from argument parsers (PR #25443) 2020-09-12 19:42:10 +02:00
Treeston
67b112f8a4 Revert "Tests: Use .empty() to test for empty string instead of == """
This reverts commit 697fb48747.
2020-09-06 22:08:19 +02:00
Carbenium
697fb48747 Tests: Use .empty() to test for empty string instead of == "" 2020-09-06 22:03:09 +02:00
Treeston
f45aa5cac1 Common/Util: Trinity::StringTo<double> support (PR #25364) 2020-09-02 22:04:45 +02:00
Treeston
470f45db7a UnitTests: |Hspell and |Htalent unit testing 2020-09-02 12:42:02 +02:00
Treeston
d0b91f6927 Core/Misc: More DBC std::array refactors, stricter |Hitem checks, and more hyperlink unit tests 2020-09-01 22:02:22 +02:00
Treeston
3fbbe7cfbe Core/Misc: DBC std::array refactors, and |Hachievement unit tests 2020-09-01 00:38:46 +02:00
Treeston
5394b2ef0f UnitTests: Add a first set of item hyperlink tests 2020-08-31 16:56:56 +02:00
Treeston
86e6438008 UnitTests: Add basic hyperlink unit test 2020-08-30 22:40:33 +02:00
Treeston
2f7d2ef3e9 Core/ChatCommands: C++17 cleanup (again) (PR #25323) 2020-08-30 02:50:25 +02:00
Treeston
8ce3635d39 UnitTests: Cleanup + StringConvert/ChatCommand tests (PR #25353) 2020-08-29 22:03:22 +02:00
Shauren
f8a5783327 Build/Tests: Set all our compile flags on tests
Closes #25349
2020-08-29 12:06:12 +02:00
Shauren
19f69fcf06 Build: Put tests-common and sfmt under correct folders when WITH_SOURCE_TREE is set to hierarchical-folders 2020-08-28 15:10:21 +02:00
Carbenium
228696bf80 Core/Common: Merge TimeTrackerSmall with TimeTracker 2020-08-01 12:43:55 +02:00
Carbenium
e55516348d Core/Common: Add a std::chrono interface to TimeTrackerSmall
New methods:
TimeTrackerSmall(Milliseconds expiry);
void Update(Milliseconds diff);
void Reset(Milliseconds expiry)
Milliseconds GetExpiry() const

Removed methods:
int32 GetExpiry() const

Also add basic unit tests.

Core/Scripts: Use std::chrono interface of TimeTrackerSmall
2020-08-01 12:43:55 +02:00
Carbenium
e6f36f83b8 tests/EventMap: Add tests for Repeat 2020-07-26 23:20:11 +02:00
Carbenium
7865c1c197 Core/EventMap: Clarify documentation of ScheduleEvent 2020-07-26 23:20:11 +02:00
Carbenium
4470b91223 Core/EventMap: Unify semantics of DelayEvents
DelayEvents(Milliseconds delay) had different semantics than
DelayEvents(Milliseconds delay, uint32 group).
The first method delayed the events only in the case the internal timer
already ticked at least for the amount of delay. In contrast the latter method
delayed events regardless of the internal timer value.

Use the latter semantics for DelayEvents(Milliseconds delay) as well which makes
the outcome more predictable. Adapt tests accordingly.
2020-07-26 23:20:11 +02:00
Carbenium
e877f988d1 tests/EventMap: Test for event past it's execution time
With the switch to std::chrono return type of GetTimeUntilEvent
we don't run into an overflow condition which happend with the previous
uint32 return value if the events scheduled execution time is in the past.
Test for this case.
2020-07-26 23:20:11 +02:00
Carbenium
8cb35b0d5f EventMap: Change GetTimeUntilEvent to return std::chrono types 2020-07-26 23:20:11 +02:00
Carbenium
7950275697 tests: Add some basic tests for EventMap 2020-07-24 12:00:54 +02:00
Carbenium
6a28ee7b2a dep: Add catch2 unit test framework and wire it up
To enable the test suite, make sure to configure CMake with -DBUILD_TESTING=1 , since it is disabled by default. The catch2 dependency will be downloaded during configure time.

Also add a new target "tests-common", which includes unit tests for the "common" project. To finally run the tests use the "test" target.

CircleCI: Run unit tests
2020-07-24 12:00:54 +02:00