Files
GServer-v2/Catch_tests/TPlayer/TPlayer_tests.cpp
T
死体 fefd62bf04 [WIP] Feature/unit testing (#52)
* Initial Catch2 testing stuff

* Add unit testing stage to Jenkins

* Update docker alpine version

* Fix tests

* Fix running tests

* Make CTest actually know there are tests available

* It was case sensitive on my mac

* Messing with unit tests, I think were at 20% now

* Fix so testing works for any target platform

* Update gs2compiler submodule

* Make unit testing more verbose

* Don't fail the whole build if test failed + notify discord on test failure

* Update gs2lib submodule

* Fix unit testing + Add linux x86_64 artifact build + improve release setup

* Add cmake to linux x86_64 to be able to run CTest

* Change path for testing

* Try again

* Fix copy path for Testing directory

* Fix github release

* Fix github release

* Fix github release

* Fix github release

* Fix github release

* Fix github release

* Fix github release

* Fix github release

* Fix github release

* Fix github release

* Fix github release

* Fix github release

* Publish test results

* Revert version

Co-authored-by: joey <1166538+xtjoeytx@users.noreply.github.com>
2022-12-06 02:35:26 +01:00

26 lines
560 B
C++

#define CATCH_CONFIG_MAIN
#include "catch2/catch_all.hpp"
#include <TPlayer.h>
#include <TServer.h>
SCENARIO( "TPlayer", "[object]" ) {
GIVEN( "TPlayer" ) {
int id = 123;
auto* server = new TServer("test");
auto* socket = new CSocket();
auto* player = new TPlayer(server, (CSocket*)socket, id);
WHEN( "getting player id" ) {
THEN( "id should be " << id ) {
REQUIRE( player->getId() == id );
}
}
WHEN( "getting player servername" ) {
THEN( "name should be test" ) {
REQUIRE( player->getServerName() == "test" );
}
}
}
}