[zhoulongyu]: 使用格式化工具编译后的代码

This commit is contained in:
jas 2023-12-12 11:46:09 +08:00
parent b94f6ac956
commit c5691b1b95
7 changed files with 88 additions and 141 deletions

View File

@ -15,9 +15,9 @@
#ifndef IIPCCONFIG_H #ifndef IIPCCONFIG_H
#define IIPCCONFIG_H #define IIPCCONFIG_H
#include "StatusCode.h" #include "StatusCode.h"
#include <iostream>
#include <memory> #include <memory>
#include <string_view> #include <string_view>
#include <iostream>
enum class IpcConfigKey enum class IpcConfigKey
{ {
@ -31,7 +31,7 @@ class IIpcConfig
public: public:
IIpcConfig() = default; IIpcConfig() = default;
virtual ~IIpcConfig() = default; virtual ~IIpcConfig() = default;
virtual const StatusCode ConfigFileSave(void) {return CreateStatusCode(STATUS_CODE_OK); } virtual const StatusCode ConfigFileSave(void) { return CreateStatusCode(STATUS_CODE_OK); }
static std::shared_ptr<IIpcConfig> &GetInstance(std::shared_ptr<IIpcConfig> *impl = nullptr); static std::shared_ptr<IIpcConfig> &GetInstance(std::shared_ptr<IIpcConfig> *impl = nullptr);
virtual const StatusCode Init(void) { return CreateStatusCode(STATUS_CODE_OK); } virtual const StatusCode Init(void) { return CreateStatusCode(STATUS_CODE_OK); }
virtual const StatusCode UnInit(void) { return CreateStatusCode(STATUS_CODE_OK); } virtual const StatusCode UnInit(void) { return CreateStatusCode(STATUS_CODE_OK); }

View File

@ -17,15 +17,12 @@
std::shared_ptr<IIpcConfig> &IIpcConfig::GetInstance(std::shared_ptr<IIpcConfig> *impl) std::shared_ptr<IIpcConfig> &IIpcConfig::GetInstance(std::shared_ptr<IIpcConfig> *impl)
{ {
static auto instance = std::make_shared<IIpcConfig>(); static auto instance = std::make_shared<IIpcConfig>();
if (impl) if (impl) {
{ if (instance.use_count() == 1) {
if (instance.use_count() == 1)
{
LogInfo("Instance changed succeed.\n"); LogInfo("Instance changed succeed.\n");
instance = *impl; instance = *impl;
} }
else else {
{
LogError("Can't changing the instance becase of using by some one.\n"); LogError("Can't changing the instance becase of using by some one.\n");
} }
} }

View File

@ -16,32 +16,23 @@
#include "ILog.h" #include "ILog.h"
#include <string.h> #include <string.h>
#define CHECK_MAP(map) (map.size()==1? true:false) #define CHECK_MAP(map) (map.size() == 1 ? true : false)
IpcConfig::IpcConfig() IpcConfig::IpcConfig()
{ {
mCfgChanged = CONFIG_HAS_NOT_CHANGED; mCfgChanged = CONFIG_HAS_NOT_CHANGED;
mCfgMapInt.insert( mCfgMapInt.insert(std::make_pair<IpcConfigKey, std::reference_wrapper<int>>(
std::make_pair< IpcConfigKey::TEST_NUM, std::reference_wrapper<int>(mAllData.testNum)));
IpcConfigKey,
std::reference_wrapper<int>>(
IpcConfigKey::TEST_NUM,
std::reference_wrapper<int>(mAllData.testNum)));
std::map<std::string, std::reference_wrapper<CHAR_STRING>> innerMap; std::map<std::string, std::reference_wrapper<CHAR_STRING>> innerMap;
innerMap.insert( innerMap.insert(std::make_pair("test_string", std::reference_wrapper<CHAR_STRING>(mAllData.testString)));
std::make_pair(
"test_string",
std::reference_wrapper<CHAR_STRING>(mAllData.testString)));
mCfgMapString.insert(std::make_pair(IpcConfigKey::TEST_STRING, innerMap)); mCfgMapString.insert(std::make_pair(IpcConfigKey::TEST_STRING, innerMap));
} }
const StatusCode IpcConfig::Init(void) const StatusCode IpcConfig::Init(void)
{ {
memset(&mAllData, 0, sizeof(Config_s)); memset(&mAllData, 0, sizeof(Config_s));
mCfg = OpenConfigFile(IPC_CONFIG_FILE_PATH); mCfg = OpenConfigFile(IPC_CONFIG_FILE_PATH);
if (nullptr == mCfg) if (nullptr == mCfg) {
{
LogError("Open config file failed.\n"); LogError("Open config file failed.\n");
return CreateStatusCode(STATUS_CODE_NOT_OK); return CreateStatusCode(STATUS_CODE_NOT_OK);
} }
@ -50,25 +41,20 @@ const StatusCode IpcConfig::Init(void)
} }
const StatusCode IpcConfig::UnInit(void) const StatusCode IpcConfig::UnInit(void)
{ {
if (CONFIG_HAS_CHANGED == mCfgChanged) if (CONFIG_HAS_CHANGED == mCfgChanged) {
{
LogInfo("Save config files.\n"); LogInfo("Save config files.\n");
ConfigSaveFile(mCfg); ConfigSaveFile(mCfg);
} }
CloseConfigFile(mCfg); CloseConfigFile(mCfg);
return CreateStatusCode(STATUS_CODE_OK); return CreateStatusCode(STATUS_CODE_OK);
} }
const StatusCode IpcConfig::ConfigFileSave(void) const StatusCode IpcConfig::ConfigFileSave(void) { return ConfigSaveFile(mCfg); }
{
return ConfigSaveFile(mCfg);
}
const int IpcConfig::GetInt(const IpcConfigKey &key) const int IpcConfig::GetInt(const IpcConfigKey &key)
{ {
std::map<IpcConfigKey, std::reference_wrapper<int>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<int>>::iterator iter;
iter = mCfgMapInt.find(key); iter = mCfgMapInt.find(key);
if (iter != mCfgMapInt.end()) if (iter != mCfgMapInt.end()) {
{
return iter->second; return iter->second;
} }
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
@ -79,13 +65,11 @@ void IpcConfig::SetInt(const IpcConfigKey &key, const int &value)
{ {
std::map<IpcConfigKey, std::reference_wrapper<int>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<int>>::iterator iter;
iter = mCfgMapInt.find(key); iter = mCfgMapInt.find(key);
if (iter != mCfgMapInt.end()) if (iter != mCfgMapInt.end()) {
{
iter->second.get() = value; iter->second.get() = value;
mCfgChanged = CONFIG_HAS_CHANGED; mCfgChanged = CONFIG_HAS_CHANGED;
} }
else else {
{
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
} }
} }
@ -93,8 +77,7 @@ const short IpcConfig::GetShort(const IpcConfigKey &key)
{ {
std::map<IpcConfigKey, std::reference_wrapper<short>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<short>>::iterator iter;
iter = mCfgMapShort.find(key); iter = mCfgMapShort.find(key);
if (iter != mCfgMapShort.end()) if (iter != mCfgMapShort.end()) {
{
return iter->second; return iter->second;
} }
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
@ -105,13 +88,11 @@ void IpcConfig::SetShort(const IpcConfigKey &key, const short &value)
{ {
std::map<IpcConfigKey, std::reference_wrapper<short>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<short>>::iterator iter;
iter = mCfgMapShort.find(key); iter = mCfgMapShort.find(key);
if (iter != mCfgMapShort.end()) if (iter != mCfgMapShort.end()) {
{
iter->second.get() = value; iter->second.get() = value;
mCfgChanged = CONFIG_HAS_CHANGED; mCfgChanged = CONFIG_HAS_CHANGED;
} }
else else {
{
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
} }
} }
@ -119,8 +100,7 @@ const long IpcConfig::GetLong(const IpcConfigKey &key)
{ {
std::map<IpcConfigKey, std::reference_wrapper<long>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<long>>::iterator iter;
iter = mCfgMapLong.find(key); iter = mCfgMapLong.find(key);
if (iter != mCfgMapLong.end()) if (iter != mCfgMapLong.end()) {
{
return iter->second; return iter->second;
} }
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
@ -131,13 +111,11 @@ void IpcConfig::SetLong(const IpcConfigKey &key, const long &value)
{ {
std::map<IpcConfigKey, std::reference_wrapper<long>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<long>>::iterator iter;
iter = mCfgMapLong.find(key); iter = mCfgMapLong.find(key);
if (iter != mCfgMapLong.end()) if (iter != mCfgMapLong.end()) {
{
iter->second.get() = value; iter->second.get() = value;
mCfgChanged = CONFIG_HAS_CHANGED; mCfgChanged = CONFIG_HAS_CHANGED;
} }
else else {
{
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
} }
} }
@ -145,8 +123,7 @@ const long long IpcConfig::GetLongLong(const IpcConfigKey &key)
{ {
std::map<IpcConfigKey, std::reference_wrapper<long long>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<long long>>::iterator iter;
iter = mCfgMapLongLong.find(key); iter = mCfgMapLongLong.find(key);
if (iter != mCfgMapLongLong.end()) if (iter != mCfgMapLongLong.end()) {
{
return iter->second; return iter->second;
} }
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
@ -157,13 +134,11 @@ void IpcConfig::SetLongLong(const IpcConfigKey &key, const long long &value)
{ {
std::map<IpcConfigKey, std::reference_wrapper<long long>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<long long>>::iterator iter;
iter = mCfgMapLongLong.find(key); iter = mCfgMapLongLong.find(key);
if (iter != mCfgMapLongLong.end()) if (iter != mCfgMapLongLong.end()) {
{
iter->second.get() = value; iter->second.get() = value;
mCfgChanged = CONFIG_HAS_CHANGED; mCfgChanged = CONFIG_HAS_CHANGED;
} }
else else {
{
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
} }
} }
@ -171,8 +146,7 @@ const char IpcConfig::GetChar(const IpcConfigKey &key)
{ {
std::map<IpcConfigKey, std::reference_wrapper<char>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<char>>::iterator iter;
iter = mCfgMapChar.find(key); iter = mCfgMapChar.find(key);
if (iter != mCfgMapChar.end()) if (iter != mCfgMapChar.end()) {
{
return iter->second; return iter->second;
} }
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
@ -183,13 +157,11 @@ void IpcConfig::SetChar(const IpcConfigKey &key, const char &character)
{ {
std::map<IpcConfigKey, std::reference_wrapper<char>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<char>>::iterator iter;
iter = mCfgMapChar.find(key); iter = mCfgMapChar.find(key);
if (iter != mCfgMapChar.end()) if (iter != mCfgMapChar.end()) {
{
iter->second.get() = character; iter->second.get() = character;
mCfgChanged = CONFIG_HAS_CHANGED; mCfgChanged = CONFIG_HAS_CHANGED;
} }
else else {
{
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
} }
} }
@ -197,8 +169,7 @@ const float IpcConfig::GetFloat(const IpcConfigKey &key)
{ {
std::map<IpcConfigKey, std::reference_wrapper<float>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<float>>::iterator iter;
iter = mCfgMapFloat.find(key); iter = mCfgMapFloat.find(key);
if (iter != mCfgMapFloat.end()) if (iter != mCfgMapFloat.end()) {
{
return iter->second; return iter->second;
} }
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
@ -209,13 +180,11 @@ void IpcConfig::SetFloat(const IpcConfigKey &key, const float &value)
{ {
std::map<IpcConfigKey, std::reference_wrapper<float>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<float>>::iterator iter;
iter = mCfgMapFloat.find(key); iter = mCfgMapFloat.find(key);
if (iter != mCfgMapFloat.end()) if (iter != mCfgMapFloat.end()) {
{
iter->second.get() = value; iter->second.get() = value;
mCfgChanged = CONFIG_HAS_CHANGED; mCfgChanged = CONFIG_HAS_CHANGED;
} }
else else {
{
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
} }
} }
@ -223,8 +192,7 @@ const double IpcConfig::GetDouble(const IpcConfigKey &key)
{ {
std::map<IpcConfigKey, std::reference_wrapper<double>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<double>>::iterator iter;
iter = mCfgMapDouble.find(key); iter = mCfgMapDouble.find(key);
if (iter != mCfgMapDouble.end()) if (iter != mCfgMapDouble.end()) {
{
return iter->second; return iter->second;
} }
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
@ -235,13 +203,11 @@ void IpcConfig::SetDouble(const IpcConfigKey &key, const double &value)
{ {
std::map<IpcConfigKey, std::reference_wrapper<double>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<double>>::iterator iter;
iter = mCfgMapDouble.find(key); iter = mCfgMapDouble.find(key);
if (iter != mCfgMapDouble.end()) if (iter != mCfgMapDouble.end()) {
{
iter->second.get() = value; iter->second.get() = value;
mCfgChanged = CONFIG_HAS_CHANGED; mCfgChanged = CONFIG_HAS_CHANGED;
} }
else else {
{
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
} }
} }
@ -249,8 +215,7 @@ const long double IpcConfig::GetLongDouble(const IpcConfigKey &key)
{ {
std::map<IpcConfigKey, std::reference_wrapper<long double>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<long double>>::iterator iter;
iter = mCfgMapLongDouble.find(key); iter = mCfgMapLongDouble.find(key);
if (iter != mCfgMapLongDouble.end()) if (iter != mCfgMapLongDouble.end()) {
{
return iter->second; return iter->second;
} }
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
@ -261,13 +226,11 @@ void IpcConfig::SetLongDouble(const IpcConfigKey &key, const long double &value)
{ {
std::map<IpcConfigKey, std::reference_wrapper<long double>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<long double>>::iterator iter;
iter = mCfgMapLongDouble.find(key); iter = mCfgMapLongDouble.find(key);
if (iter != mCfgMapLongDouble.end()) if (iter != mCfgMapLongDouble.end()) {
{
iter->second.get() = value; iter->second.get() = value;
mCfgChanged = CONFIG_HAS_CHANGED; mCfgChanged = CONFIG_HAS_CHANGED;
} }
else else {
{
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
} }
} }
@ -275,8 +238,7 @@ const bool IpcConfig::GetBool(const IpcConfigKey &key)
{ {
std::map<IpcConfigKey, std::reference_wrapper<bool>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<bool>>::iterator iter;
iter = mCfgMapBool.find(key); iter = mCfgMapBool.find(key);
if (iter != mCfgMapBool.end()) if (iter != mCfgMapBool.end()) {
{
return iter->second; return iter->second;
} }
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
@ -287,13 +249,11 @@ void IpcConfig::SetBool(const IpcConfigKey &key, const bool &value)
{ {
std::map<IpcConfigKey, std::reference_wrapper<bool>>::iterator iter; std::map<IpcConfigKey, std::reference_wrapper<bool>>::iterator iter;
iter = mCfgMapBool.find(key); iter = mCfgMapBool.find(key);
if (iter != mCfgMapBool.end()) if (iter != mCfgMapBool.end()) {
{
iter->second.get() = value; iter->second.get() = value;
mCfgChanged = CONFIG_HAS_CHANGED; mCfgChanged = CONFIG_HAS_CHANGED;
} }
else else {
{
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
} }
} }
@ -301,8 +261,7 @@ const std::string IpcConfig::GetString(const IpcConfigKey &key)
{ {
std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<CHAR_STRING>>>::iterator iter; std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<CHAR_STRING>>>::iterator iter;
iter = mCfgMapString.find(key); iter = mCfgMapString.find(key);
if (iter != mCfgMapString.end() && CHECK_MAP(iter->second)) if (iter != mCfgMapString.end() && CHECK_MAP(iter->second)) {
{
const std::string sv(iter->second.begin()->second); // char[] --> const std::strinbg const std::string sv(iter->second.begin()->second); // char[] --> const std::strinbg
return sv; return sv;
} }
@ -314,15 +273,13 @@ void IpcConfig::SetString(const IpcConfigKey &key, const std::string string)
{ {
std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<CHAR_STRING>>>::iterator iter; std::map<IpcConfigKey, std::map<std::string, std::reference_wrapper<CHAR_STRING>>>::iterator iter;
iter = mCfgMapString.find(key); iter = mCfgMapString.find(key);
if (iter != mCfgMapString.end() && CHECK_MAP(iter->second)) if (iter != mCfgMapString.end() && CHECK_MAP(iter->second)) {
{
strncpy(iter->second.begin()->second, string.c_str(), sizeof(CHAR_STRING)); // const std::strinbg --> char[] strncpy(iter->second.begin()->second, string.c_str(), sizeof(CHAR_STRING)); // const std::strinbg --> char[]
const char * name = iter->second.begin()->first.c_str(); // const std::strinbg --> const char * const char *name = iter->second.begin()->first.c_str(); // const std::strinbg --> const char *
ConfigSetString(mCfg, name, iter->second.begin()->second); ConfigSetString(mCfg, name, iter->second.begin()->second);
mCfgChanged = CONFIG_HAS_CHANGED; mCfgChanged = CONFIG_HAS_CHANGED;
} }
else else {
{
LogError("Can't find the key.\n"); LogError("Can't find the key.\n");
} }
} }
@ -330,8 +287,7 @@ void IpcConfig::SetString(const IpcConfigKey &key, const std::string string)
void IpcConfig::ReadAllConfigParameters(void) void IpcConfig::ReadAllConfigParameters(void)
{ {
StatusCode code = ConfigGetInt(mCfg, "test_num", &(mAllData.testNum)); StatusCode code = ConfigGetInt(mCfg, "test_num", &(mAllData.testNum));
if (StatusCodeEqual(code, "CONFIG_CODE_PARAM_NOT_EXIST")) if (StatusCodeEqual(code, "CONFIG_CODE_PARAM_NOT_EXIST")) {
{
LogWarning("test_num doesn't exist, will make it as default.\n"); LogWarning("test_num doesn't exist, will make it as default.\n");
mCfgChanged = CONFIG_HAS_CHANGED; mCfgChanged = CONFIG_HAS_CHANGED;
constexpr int DEFAULT_TEST_NUM = 10; constexpr int DEFAULT_TEST_NUM = 10;
@ -340,21 +296,18 @@ void IpcConfig::ReadAllConfigParameters(void)
} }
const char *testString = NULL; const char *testString = NULL;
StatusCode string_code = ConfigGetString(mCfg, "test_string", &(testString)); StatusCode string_code = ConfigGetString(mCfg, "test_string", &(testString));
if (StatusCodeEqual(string_code, "CONFIG_CODE_PARAM_NOT_EXIST")) if (StatusCodeEqual(string_code, "CONFIG_CODE_PARAM_NOT_EXIST")) {
{
LogWarning("test_string doesn't exist, will make it as default.\n"); LogWarning("test_string doesn't exist, will make it as default.\n");
mCfgChanged = CONFIG_HAS_CHANGED; mCfgChanged = CONFIG_HAS_CHANGED;
char DEFAULT_TEST_STRING[] = "undefine"; char DEFAULT_TEST_STRING[] = "undefine";
strncpy(mAllData.testString, DEFAULT_TEST_STRING, sizeof(mAllData.testString)); strncpy(mAllData.testString, DEFAULT_TEST_STRING, sizeof(mAllData.testString));
ConfigSetString(mCfg, "test_string", mAllData.testString); ConfigSetString(mCfg, "test_string", mAllData.testString);
} }
else else {
{
strncpy(mAllData.testString, testString, sizeof(mAllData.testString)); strncpy(mAllData.testString, testString, sizeof(mAllData.testString));
} }
if (CONFIG_HAS_CHANGED == mCfgChanged) if (CONFIG_HAS_CHANGED == mCfgChanged) {
{
LogInfo("Save the config file.\n"); LogInfo("Save the config file.\n");
mCfgChanged = CONFIG_HAS_NOT_CHANGED; mCfgChanged = CONFIG_HAS_NOT_CHANGED;
ConfigSaveFile(mCfg); ConfigSaveFile(mCfg);

View File

@ -14,11 +14,11 @@
*/ */
#ifndef IPCCONFIG_H #ifndef IPCCONFIG_H
#define IPCCONFIG_H #define IPCCONFIG_H
#include "StatusCode.h"
#include "IIpcConfig.h"
#include "Config.h" #include "Config.h"
#include <memory> #include "IIpcConfig.h"
#include "StatusCode.h"
#include <map> #include <map>
#include <memory>
constexpr bool CONFIG_HAS_CHANGED = true; constexpr bool CONFIG_HAS_CHANGED = true;
constexpr bool CONFIG_HAS_NOT_CHANGED = false; constexpr bool CONFIG_HAS_NOT_CHANGED = false;
@ -63,7 +63,6 @@ public:
const std::string GetString(const IpcConfigKey &key) override; const std::string GetString(const IpcConfigKey &key) override;
void SetString(const IpcConfigKey &key, const std::string string) override; void SetString(const IpcConfigKey &key, const std::string string) override;
private: private:
void ReadAllConfigParameters(void); void ReadAllConfigParameters(void);

View File

@ -19,8 +19,7 @@ bool CreateIpcConfig(void)
{ {
auto instance = std::make_shared<IIpcConfig>(); auto instance = std::make_shared<IIpcConfig>();
StatusCode code = IpcConfigMakePtr::GetInstance()->CreateIpcConfig(instance); StatusCode code = IpcConfigMakePtr::GetInstance()->CreateIpcConfig(instance);
if (IsCodeOK(code)) if (IsCodeOK(code)) {
{
LogInfo("CreateIpcConfig is ok.\n"); LogInfo("CreateIpcConfig is ok.\n");
IIpcConfig::GetInstance(&instance); IIpcConfig::GetInstance(&instance);
return true; return true;
@ -30,8 +29,7 @@ bool CreateIpcConfig(void)
std::shared_ptr<IpcConfigMakePtr> &IpcConfigMakePtr::GetInstance(std::shared_ptr<IpcConfigMakePtr> *impl) std::shared_ptr<IpcConfigMakePtr> &IpcConfigMakePtr::GetInstance(std::shared_ptr<IpcConfigMakePtr> *impl)
{ {
static auto instance = std::make_shared<IpcConfigMakePtr>(); static auto instance = std::make_shared<IpcConfigMakePtr>();
if (impl) if (impl) {
{
instance = *impl; instance = *impl;
} }
return instance; return instance;

View File

@ -1,12 +1,12 @@
#include "ILog.h"
#include "IIpcConfig.h" #include "IIpcConfig.h"
#include "ILog.h"
// #include <gmock/gmock.h> // #include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
namespace IpcConfigTest namespace IpcConfigTest
{ {
// ../output_files/test/bin/IpcConfigTest --gtest_filter=IpcConfigTest.Demo // ../output_files/test/bin/IpcConfigTest --gtest_filter=IpcConfigTest.Demo
TEST(IpcConfigTest, Demo) TEST(IpcConfigTest, Demo)
{ {
CreateLogModule(); CreateLogModule();
CreateIpcConfig(); CreateIpcConfig();
ILogInit(LOG_INSTANCE_TYPE_END); ILogInit(LOG_INSTANCE_TYPE_END);
@ -25,5 +25,5 @@ namespace IpcConfigTest
IIpcConfig::GetInstance()->UnInit(); IIpcConfig::GetInstance()->UnInit();
ILogUnInit(); ILogUnInit();
DestroyLogModule(); DestroyLogModule();
} }
} // namespace IpcConfigTest } // namespace IpcConfigTest