mirror of
https://github.com/minetest/minetest.git
synced 2024-09-27 15:00:30 +02:00
Fix rebase mistakes
This commit is contained in:
parent
d796a426cf
commit
c4232d2412
|
@ -23,6 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
class TestClientActiveObject : public ClientActiveObject
|
class TestClientActiveObject : public ClientActiveObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -70,26 +72,31 @@ void TestClientActiveObjectMgr::runTests(IGameDef *gamedef)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static TestClientActiveObject* register_default_test_object(
|
||||||
|
client::ActiveObjectMgr &caomgr) {
|
||||||
|
auto test_obj = std::make_unique<TestClientActiveObject>();
|
||||||
|
auto result = test_obj.get();
|
||||||
|
REQUIRE(caomgr.registerObject(std::move(test_obj)));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("test client active object manager")
|
TEST_CASE("test client active object manager")
|
||||||
{
|
{
|
||||||
client::ActiveObjectMgr caomgr;
|
client::ActiveObjectMgr caomgr;
|
||||||
auto tcao1 = new TestClientActiveObject();
|
auto tcao1 = register_default_test_object(caomgr);
|
||||||
REQUIRE(caomgr.registerObject(tcao1) == true);
|
|
||||||
|
|
||||||
SECTION("When we register a client object, "
|
SECTION("When we register a client object, "
|
||||||
"then it should be assigned a unique ID.")
|
"then it should be assigned a unique ID.")
|
||||||
{
|
{
|
||||||
for (int i = 0; i < UINT8_MAX; ++i) {
|
for (int i = 0; i < UINT8_MAX; ++i) {
|
||||||
auto other_tcao = new TestClientActiveObject();
|
auto other_tcao = register_default_test_object(caomgr);
|
||||||
REQUIRE(caomgr.registerObject(other_tcao) == true);
|
|
||||||
CHECK(other_tcao->getId() != tcao1->getId());
|
CHECK(other_tcao->getId() != tcao1->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("two registered objects")
|
SECTION("two registered objects")
|
||||||
{
|
{
|
||||||
auto tcao2 = new TestClientActiveObject();
|
auto tcao2 = register_default_test_object(caomgr);
|
||||||
REQUIRE(caomgr.registerObject(tcao2) == true);
|
|
||||||
auto tcao2_id = tcao2->getId();
|
auto tcao2_id = tcao2->getId();
|
||||||
|
|
||||||
auto obj1 = caomgr.getActiveObject(tcao1->getId());
|
auto obj1 = caomgr.getActiveObject(tcao1->getId());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user