Commit Graph

30 Commits

Author SHA1 Message Date
Shauren
b705283d0e GCC build fix 2024-03-13 19:56:34 +01:00
Shauren
37899f3954 Tests: Disable intentionally triggered warning in test code 2024-03-13 18:17:04 +01:00
Shauren
f690b69338 Core/Utils: unique_trackable_ptr improvements
* Added comparison operators
* Added type casting helper functions
2024-03-13 17:04:26 +01:00
Shauren
1f3ebbb23c Fix tests build 2024-03-11 18:25:17 +01:00
Shauren
32e54b6bd1 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
2024-03-11 18:16:34 +01:00
Fabian
084d9d37b1 Tests: Add missing include 2024-03-01 11:40:12 +01:00
Shauren
cd62dc4491 Tests: Fixed environment variable confg test compilation on windows 2023-01-06 16:55:58 +01:00
Shauren
e8e330addd Core/Misc: Remove boost::heap::fibonacci_heap from header files 2023-01-06 16:54:16 +01:00
Shauren
42fbcf2fc5 Core/Utils: Replace boost flat_set with our own 2023-01-06 16:51:01 +01:00
Shauren
25c28c0c7d GCC build fix 2022-12-17 12:54:38 +01:00
Anton Popovichenko
8447f627ba 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>
(cherry picked from commit 1ddd9dc19c)
2022-03-13 16:37:01 +01:00
Treeston
3fd2eb126c [3.3.5] ChatCommands, the other half: chat command resolution refactor (PR #25463)
(cherry picked from commit 1eca51b417)
2022-02-27 20:08:41 +01:00
Treeston
378691aaa2 [3.3.5] Core/ChatCommands: Show error messages from argument parsers (PR #25443)
(cherry picked from commit 75f9e7396e)
2022-02-05 23:42:15 +01:00
Treeston
da8a66a05e Common/Util: Trinity::StringTo<double> support (PR #25364)
(cherry picked from commit f45aa5cac1)
2022-02-04 23:50:25 +01:00
Treeston
c4b287c7bf Core/Misc: DBC std::array refactors, and |Hachievement unit tests
(cherry picked from commit 3fbbe7cfbe)
2022-02-04 23:37:29 +01:00
Treeston
c82b107b6b UnitTests: Add a first set of item hyperlink tests
(cherry picked from commit 5394b2ef0f)
2022-02-04 22:11:42 +01:00
Treeston
627ff1587d UnitTests: Add basic hyperlink unit test
(cherry picked from commit 86e6438008)
2022-02-04 21:33:27 +01:00
Treeston
45e9e94311 Core/ChatCommands: C++17 cleanup (again) (PR #25323)
(cherry picked from commit 2f7d2ef3e9)
2022-02-04 21:21:17 +01:00
Treeston
2aaebc193c UnitTests: Cleanup + StringConvert/ChatCommand tests (PR #25353)
(cherry picked from commit 8ce3635d39)
2022-02-04 13:03:29 +01:00
Shauren
fc49ba2f85 Build/Tests: Set all our compile flags on tests
Closes #25349

(cherry picked from commit f8a5783327)
2022-02-04 12:08:48 +01:00
Shauren
8484376338 Build: Put tests-common and sfmt under correct folders when WITH_SOURCE_TREE is set to hierarchical-folders
(cherry picked from commit 19f69fcf06)
2022-02-04 10:59:00 +01:00
Carbenium
8809d54ca2 Core/Common: Merge TimeTrackerSmall with TimeTracker
(cherry picked from commit 228696bf80)
2022-01-24 21:34:36 +01:00
Carbenium
35e0002df3 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

(cherry picked from commit e55516348d)
2022-01-24 21:25:47 +01:00
Carbenium
906a47b161 tests/EventMap: Add tests for Repeat
(cherry picked from commit e6f36f83b8)
2022-01-24 00:01:48 +01:00
Carbenium
da17942af9 Core/EventMap: Clarify documentation of ScheduleEvent
(cherry picked from commit 7865c1c197)
2022-01-24 00:01:38 +01:00
Carbenium
a5d85deced 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.

(cherry picked from commit 4470b91223)
2022-01-24 00:01:25 +01:00
Carbenium
5512eb2f8f 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.

(cherry picked from commit e877f988d1)
2022-01-24 00:00:47 +01:00
Carbenium
27c1f47598 EventMap: Change GetTimeUntilEvent to return std::chrono types
(cherry picked from commit 8cb35b0d5f)
2022-01-23 23:59:46 +01:00
Carbenium
ddeae5e7d2 tests: Add some basic tests for EventMap
(cherry picked from commit 7950275697)
2022-01-23 22:48:58 +01:00
Carbenium
f837f28171 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
(cherry picked from commit 6a28ee7b2a)
2022-01-23 22:48:35 +01:00