add tests

This commit is contained in:
2024-10-16 12:35:45 +02:00
parent fc405eeba1
commit a0fcd8b985
14 changed files with 515 additions and 67 deletions

View File

@@ -0,0 +1,26 @@
#include <td/protocol/command/CommandFactory.h>
#include <array>
#include <cassert>
#include <functional>
namespace td {
namespace protocol {
namespace CommandFactory {
using CommandCreator = std::function<std::unique_ptr<Command>()>;
#define DeclareCommand(CommandName, ...) std::make_unique<commands::CommandName>(),
static std::array<std::unique_ptr<Command>, static_cast<std::size_t>(CommandType::COMMAND_COUNT)> Commands = {
DeclareAllCommand()
};
const std::unique_ptr<Command>& CreateReadOnlyCommand(CommandType a_Type) {
assert(a_Type < CommandType::COMMAND_COUNT);
return Commands[static_cast<std::size_t>(a_Type)];
}
} // namespace CommandFactory
} // namespace protocol
} // namespace td