#include "gtest/gtest.h"
#include "Console.hpp"

#include <memory>

using namespace warbler;

class ConsoleTest
{
public:
    static void noopCommandHandler(const std::shared_ptr<const std::vector<ConsoleArg>> &args) {};
    static const std::shared_ptr<std::vector<ConsoleArgType>> args;
};

const std::shared_ptr<std::vector<ConsoleArgType>> ConsoleTest::args = std::make_shared<std::vector<ConsoleArgType>>();

TEST(constructor, default_constructor)
{
    Console c;
}

TEST(methods, registerCommand)
{
    Console c;
    c.registerCommand("test", ConsoleTest::noopCommandHandler, ConsoleTest::args);
}

TEST(methods, registerCommand_null_func_throws)
{
    Console c;
    ASSERT_ANY_THROW(c.registerCommand("test", nullptr, ConsoleTest::args));
}

TEST(methods, registerCommand_empty_name_throws)
{
    Console c;
    ASSERT_ANY_THROW(c.registerCommand("", ConsoleTest::noopCommandHandler, ConsoleTest::args));
}
#include "gtest/gtest.h"
#include "Console.hpp"

#include <memory>

using namespace warbler;

class ConsoleTest
{
public:
    static void noopCommandHandler(const std::shared_ptr<const std::vector<ConsoleArg>> &args) {};
    static const std::shared_ptr<std::vector<ConsoleArgType>> args;
};

const std::shared_ptr<std::vector<ConsoleArgType>> ConsoleTest::args = std::make_shared<std::vector<ConsoleArgType>>();

TEST(constructor, default_constructor)
{
    ASSERT_NO_THROW(Console c);
}

TEST(methods, registerCommand)
{
    Console c;
    ASSERT_NO_THROW(c.registerCommand("test", ConsoleTest::noopCommandHandler, ConsoleTest::args));
}

TEST(methods, registerCommand_null_func_throws)
{
    Console c;
    ASSERT_ANY_THROW(c.registerCommand("test", nullptr, ConsoleTest::args));
}

TEST(methods, registerCommand_empty_name_throws)
{
    Console c;
    ASSERT_ANY_THROW(c.registerCommand("", ConsoleTest::noopCommandHandler, ConsoleTest::args));
}
Modify a couple tests to use asserts.
Modify a couple tests to use asserts.


Former-commit-id: 60bee038bc7d01fa0eed5cb4f4a34a70650de97b [formerly 13be900e6fa1f86d7bd68dbcd5a408d00b432c2c]
Former-commit-id: 87eae1ec908b0a38284b4f477a38e13008c30d31