cyphesis/tests/BaseClientTest.cpp

151 lines
3 KiB
C++
Raw Permalink Normal View History

2010-11-18 16:42:57 +00:00
// Cyphesis Online RPG Server and AI Engine
// Copyright (C) 2010 Alistair Riddoch
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2011-02-15 09:30:46 +00:00
#ifdef NDEBUG
#undef NDEBUG
#endif
#ifndef DEBUG
#define DEBUG
#endif
2010-11-18 16:42:57 +00:00
#include "client/BaseClient.h"
#include <Atlas/Objects/RootOperation.h>
#include <cassert>
using Atlas::Objects::Root;
using Atlas::Objects::Operation::RootOperation;
2010-11-19 00:59:45 +00:00
class TestBaseClient : public BaseClient
{
public:
2018-10-27 13:13:45 +02:00
TestBaseClient(boost::asio::io_service& io_service) : BaseClient(io_service) { }
2010-11-19 00:59:45 +00:00
virtual void idle() { }
};
2010-11-18 16:42:57 +00:00
int main()
{
2018-10-27 13:13:45 +02:00
boost::asio::io_service io_service;
2010-11-19 00:59:45 +00:00
{
2018-10-27 13:13:45 +02:00
BaseClient * bc = new TestBaseClient{io_service};
2010-11-19 00:59:45 +00:00
delete bc;
}
2010-11-22 18:35:11 +00:00
{
2018-10-27 13:13:45 +02:00
BaseClient * bc = new TestBaseClient{io_service};
2010-11-22 18:35:11 +00:00
bc->createAccount("8e7e4452-f666-11df-8027-00269e5444b3", "84abee0c-f666-11df-8f7e-00269e5444b3");
delete bc;
}
2010-11-19 00:59:45 +00:00
{
2018-10-27 13:13:45 +02:00
BaseClient * bc = new TestBaseClient{io_service};
2010-11-19 00:59:45 +00:00
bc->createSystemAccount();
delete bc;
}
2010-11-22 18:35:11 +00:00
{
2018-10-27 13:13:45 +02:00
BaseClient * bc = new TestBaseClient{io_service};
2010-11-22 18:35:11 +00:00
bc->createCharacter("9e7f4004-f666-11df-a327-00269e5444b3");
delete bc;
}
{
2018-10-27 13:13:45 +02:00
BaseClient * bc = new TestBaseClient{io_service};
2010-11-22 18:35:11 +00:00
bc->logout();
delete bc;
}
{
2018-10-27 13:13:45 +02:00
BaseClient * bc = new TestBaseClient{io_service};
2010-11-22 18:35:11 +00:00
bc->handleNet();
delete bc;
}
2010-11-18 16:42:57 +00:00
return 0;
}
// stubs
#include "client/CreatorClient.h"
#include "common/log.h"
#include <cstdlib>
2018-11-03 16:43:33 +01:00
#include "stubs/rules/ai/stubBaseMind.h"
2018-10-27 13:13:45 +02:00
#include "stubs/client/stubCreatorClient.h"
2015-05-23 16:47:45 +02:00
2018-10-27 13:13:45 +02:00
#define STUB_ClientConnection_pop
2010-11-18 16:42:57 +00:00
RootOperation ClientConnection::pop()
{
2013-08-12 22:05:01 +02:00
return RootOperation(nullptr);
2010-11-18 16:42:57 +00:00
}
2018-10-27 13:13:45 +02:00
#include "stubs/client/stubClientConnection.h"
#include "stubs/client/stubCharacterClient.h"
2018-11-03 16:43:33 +01:00
#include "stubs/rules/ai/stubMemMap.h"
2018-10-27 13:13:45 +02:00
#include "stubs/common/stubAtlasStreamClient.h"
2010-11-18 16:42:57 +00:00
void log(LogLevel lvl, const std::string & msg)
{
}
std::string create_session_username()
{
return "admin_test";
}
long integerId(const std::string & id)
{
long intId = strtol(id.c_str(), 0, 10);
if (intId == 0 && id != "0") {
intId = -1L;
}
return intId;
}
2013-06-03 22:08:15 +02:00
2018-11-03 16:43:33 +01:00
#include "stubs/rules/ai/stubMemEntity.h"
#include "stubs/rules/stubLocatedEntity.h"
2018-10-27 13:13:45 +02:00
#include "stubs/common/stubRouter.h"
2018-11-03 16:43:33 +01:00
#include "stubs/rules/stubLocation.h"
2010-11-18 16:42:57 +00:00
void WorldTime::initTimeInfo()
{
}
DateTime::DateTime(int t)
{
}