1
0
mirror of https://github.com/falk-werner/webfused synced 2024-10-27 20:44:08 +00:00
falk-werner_webfused/test/mock_logger.hpp
2020-03-08 20:29:08 +01:00

48 lines
798 B
C++

#ifndef WFD_MOCK_LOGGER_HPP
#define WFD_MOCK_LOGGER_HPP
#include <gmock/gmock.h>
#include <cstdarg>
namespace webfused_test
{
class ILogger
{
public:
virtual ~ILogger() = default;
virtual void log(int level, char const * format, va_list args) = 0;
virtual void onclose() = 0;
};
class MockLogger: public ILogger
{
public:
explicit MockLogger(bool omit_init = false);
~MockLogger() override;
MOCK_METHOD3(log, void(int level, char const * format, va_list args));
MOCK_METHOD0(onclose, void(void));
void * getUserData();
private:
bool close_on_destruct;
};
}
extern "C"
{
extern void wfd_MockLogger_log(
void * user_data,
int level,
char const * format,
va_list args);
extern void wfd_MockLogger_onclose(
void * user_data);
}
#endif