Backup:test code.

This commit is contained in:
Fancy code 2024-03-06 18:00:02 -08:00
parent 7233841a4a
commit 2b4130595b
18 changed files with 303 additions and 18 deletions

View File

@ -24,3 +24,4 @@ StatusCode HalCpp::UnInit(void)
LogInfo("HalCpp::UnInit\n"); LogInfo("HalCpp::UnInit\n");
return CreateStatusCode(STATUS_CODE_OK); return CreateStatusCode(STATUS_CODE_OK);
} }
StatusCode HalCpp::GetWifiHal(std::shared_ptr<VWifiHal> &wifi) { return CreateStatusCode(STATUS_CODE_OK); }

View File

@ -22,6 +22,7 @@ public:
virtual ~HalCpp() = default; virtual ~HalCpp() = default;
StatusCode Init(void) override; StatusCode Init(void) override;
StatusCode UnInit(void) override; StatusCode UnInit(void) override;
StatusCode GetWifiHal(std::shared_ptr<VWifiHal> &wifi) override;
private: private:
std::vector<std::shared_ptr<VLedHal>> mLedHals; std::vector<std::shared_ptr<VLedHal>> mLedHals;

View File

@ -24,7 +24,7 @@ aux_source_directory(./src/Protocol/SixFrame SRC_FILES)
set(TARGET_NAME AppManager) set(TARGET_NAME AppManager)
add_library(${TARGET_NAME} STATIC ${SRC_FILES}) add_library(${TARGET_NAME} STATIC ${SRC_FILES})
target_link_libraries(${TARGET_NAME} WebServer cjson-static StatusCode Log) target_link_libraries(${TARGET_NAME} WebServer Hal cjson-static StatusCode Log)
if ("${CLANG_TIDY_SUPPORT}" MATCHES "true") if ("${CLANG_TIDY_SUPPORT}" MATCHES "true")
add_custom_target( add_custom_target(

View File

@ -11,6 +11,7 @@ include_directories(
${MIDDLEWARE_SOURCE_PATH}/McuManager/src ${MIDDLEWARE_SOURCE_PATH}/McuManager/src
${UTILS_SOURCE_PATH}/McuProtocol/include ${UTILS_SOURCE_PATH}/McuProtocol/include
${UTILS_SOURCE_PATH}/UartDevice/include ${UTILS_SOURCE_PATH}/UartDevice/include
${UTILS_SOURCE_PATH}/LedControl/include
${TEST_SOURCE_PATH} ${TEST_SOURCE_PATH}
${TEST_SOURCE_PATH}/middleware/McuManager/tool/include ${TEST_SOURCE_PATH}/middleware/McuManager/tool/include
${TEST_SOURCE_PATH}/middleware/AppManager/tool/include ${TEST_SOURCE_PATH}/middleware/AppManager/tool/include
@ -18,6 +19,7 @@ include_directories(
${TEST_SOURCE_PATH}/utils/TestManager/include ${TEST_SOURCE_PATH}/utils/TestManager/include
${TEST_SOURCE_PATH}/utils/McuProtocol/tool/include ${TEST_SOURCE_PATH}/utils/McuProtocol/tool/include
${TEST_SOURCE_PATH}/utils/UartDevice/tool/include ${TEST_SOURCE_PATH}/utils/UartDevice/tool/include
${TEST_SOURCE_PATH}/hal/tool/include
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include ${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googlemock/include ${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googlemock/include
) )
@ -35,7 +37,7 @@ endif()
set(TARGET_NAME HunttingCameraTest) set(TARGET_NAME HunttingCameraTest)
add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES}) add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES})
target_link_libraries(${TARGET_NAME} HunttingMainLib McuManagerTestTool McuAskBaseTestTool AppManagerTestTool TestManager gtest gmock pthread) target_link_libraries(${TARGET_NAME} HunttingMainLib McuManagerTestTool McuAskBaseTestTool AppManagerTestTool HalTestTool TestManager gtest gmock pthread)
if(${TEST_COVERAGE} MATCHES "true") if(${TEST_COVERAGE} MATCHES "true")
target_link_libraries(${TARGET_NAME} gcov) target_link_libraries(${TARGET_NAME} gcov)
endif() endif()

View File

@ -14,6 +14,7 @@
*/ */
#include "AppManagerTestTool.h" #include "AppManagerTestTool.h"
#include "GtestUsing.h" #include "GtestUsing.h"
#include "HalTestTool.h"
#include "ILog.h" #include "ILog.h"
#include "MainThread.h" #include "MainThread.h"
#include "McuManagerTestTool.h" #include "McuManagerTestTool.h"
@ -24,7 +25,9 @@ namespace HunttingCameraTest
class HunttingCameraTest : public testing::Test, class HunttingCameraTest : public testing::Test,
public TestManager, public TestManager,
public McuManagerTestTool, public McuManagerTestTool,
public AppManagerTestTool public AppManagerTestTool,
public HalTestTool
{ {
public: public:
HunttingCameraTest() {} HunttingCameraTest() {}
@ -38,7 +41,7 @@ public:
virtual void SetUp() virtual void SetUp()
{ {
// CreateAllKeysMcok(); // CreateAllKeysMcok();
// HalTestTool::Init(); HalTestTool::Init();
// HunttingCameraTestTool::Init(); // HunttingCameraTestTool::Init();
// CreateHalCppModule(); // CreateHalCppModule();
// CreateDeviceManagerModule(); // CreateDeviceManagerModule();
@ -51,11 +54,11 @@ public:
} }
virtual void TearDown() virtual void TearDown()
{ {
// HalTestTool::UnInit();
// HunttingCameraTestTool::UnInit(); // HunttingCameraTestTool::UnInit();
// DestroyDeviceManagerModule(); // DestroyDeviceManagerModule();
// DestroyAllKeysMock(); // DestroyAllKeysMock();
TestManager::UnInit(); TestManager::UnInit();
HalTestTool::UnInit();
LinuxApiMock::GetInstance()->UnInit(); LinuxApiMock::GetInstance()->UnInit();
mLinuxTest = std::make_shared<LinuxTest>(); mLinuxTest = std::make_shared<LinuxTest>();
std::shared_ptr<LinuxApiMock> test = std::make_shared<LinuxApiMock>(); std::shared_ptr<LinuxApiMock> test = std::make_shared<LinuxApiMock>();

View File

@ -11,6 +11,7 @@ include_directories(
${APPLICATION_SOURCE_PATH}/MissionManager/src ${APPLICATION_SOURCE_PATH}/MissionManager/src
${MIDDLEWARE_SOURCE_PATH}/AppManager/include ${MIDDLEWARE_SOURCE_PATH}/AppManager/include
${MIDDLEWARE_SOURCE_PATH}/StateMachine/include ${MIDDLEWARE_SOURCE_PATH}/StateMachine/include
${MIDDLEWARE_SOURCE_PATH}/McuManager/include
${TEST_SOURCE_PATH} ${TEST_SOURCE_PATH}
${TEST_SOURCE_PATH}/middleware/AppManager/tool/include ${TEST_SOURCE_PATH}/middleware/AppManager/tool/include
${TEST_SOURCE_PATH}/middleware/AppManager/tool/src ${TEST_SOURCE_PATH}/middleware/AppManager/tool/src

View File

@ -28,8 +28,8 @@ public:
private: private:
// void MissionManagerMockInit(std::shared_ptr<IMissionManager> &vMock); // void MissionManagerMockInit(std::shared_ptr<IMissionManager> &vMock);
// private: private:
// std::shared_ptr<IMissionManager> mMissionManagerMock; std::shared_ptr<IMissionManager> mMissionManagerMock;
// std::shared_ptr<VAppMonitor> mAppMonitorMock; // std::shared_ptr<VAppMonitor> mAppMonitorMock;
// public: // public:

View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2023 Fancy Code.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "MissionManagerMakePtrTest.h"
#include "ILog.h"
#include "TestMissionStateMock.h"
void OverrideMissionManagerMakePtrObject(std::shared_ptr<MissionManagerMock> &appManagerMock)
{
std::shared_ptr<MissionManagerMakePtr> impl = std::make_shared<MissionManagerMakePtrTest>();
std::shared_ptr<MissionManagerMakePtrTest> test = std::dynamic_pointer_cast<MissionManagerMakePtrTest>(impl);
if (test) {
test->mMissionManagerMock = appManagerMock;
}
MissionManagerMakePtr::GetInstance(&impl);
}
void CancelOverrideMissionManagerMakePtrObject(void)
{
std::shared_ptr<MissionManagerMakePtr> tmp = MissionManagerMakePtr::GetInstance();
std::shared_ptr<MissionManagerMakePtrTest> test = std::dynamic_pointer_cast<MissionManagerMakePtrTest>(tmp);
if (test) {
test->mMissionManagerMock.reset();
}
tmp.reset();
test.reset();
std::shared_ptr<MissionManagerMakePtr> impl = std::make_shared<MissionManagerMakePtrTest>();
MissionManagerMakePtr::GetInstance(&impl);
}
MissionManagerMakePtrTest::MissionManagerMakePtrTest()
{
//
}
MissionManagerMakePtrTest::~MissionManagerMakePtrTest()
{
//
mMissionManagerMock.reset();
}
// const StatusCode MissionManagerMakePtrTest::CreateMissionManager(std::shared_ptr<IMissionManager> &impl)
// {
// if (mMissionManagerMock) {
// LogInfo("CreateMissionManager mMissionManagerMock\n");
// impl = mMissionManagerMock;
// }
// else {
// LogWarning("CreateMcuManager failed:mMissionManagerMock is nullptr.\n");
// }
// return CreateStatusCode(STATUS_CODE_OK);
// }
std::shared_ptr<State> MissionManagerMakePtrTest::CreateMissionState(const IpcMission &mission)
{
std::shared_ptr<State> state = std::make_shared<TestMissionStateMock>();
return state;
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (c) 2023 Fancy Code.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MISSION_MANAGER_MAKE_PTR_TEST_H
#define MISSION_MANAGER_MAKE_PTR_TEST_H
#include "MissionManagerMakePtr.h"
#include "MissionManagerMock.h"
#include "MissionManagerTestTool.h"
void OverrideMissionManagerMakePtrObject(std::shared_ptr<MissionManagerMock> &appManagerMock);
void CancelOverrideMissionManagerMakePtrObject(void);
class MissionManagerMakePtrTest : public MissionManagerMakePtr
{
public:
MissionManagerMakePtrTest();
virtual ~MissionManagerMakePtrTest();
std::shared_ptr<State> CreateMissionState(const IpcMission &mission) override;
public:
std::shared_ptr<MissionManagerMock> mMissionManagerMock;
};
#endif

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2023 Fancy Code.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "MissionManagerMock.h"
#include "ILog.h"
// const StatusCode MissionManagerTest::SetAppMonitor(std::shared_ptr<VAppMonitor> &monitor)
// {
// LogInfo("MissionManagerTest::SetAppMonitor\n");
// StatusCode code = SetAppMonitorTrace(monitor);
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
// return MissionManager::SetAppMonitor(monitor);
// }
// return code;
// }
// const StatusCode MissionManagerTest::SetAppMonitorTrace(std::shared_ptr<VAppMonitor> &monitor)
// {
// LogInfo("MissionManagerTest::SetAppMonitorTrace\n");
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
// }
// StatusCode MissionManagerTest::GetAllLedsTrace(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds)
// {
// LogInfo("MissionManagerTest::GetAllLedsTrace\n");
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
// }
// StatusCode MissionManagerTest::GetAllKeysTrace(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys)
// {
// LogInfo("MissionManagerTest::GetAllKeysTrace\n");
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
// }

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2023 Fancy Code.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MISSION_MANAGER_MOCK_H
#define MISSION_MANAGER_MOCK_H
#include "MissionManager.h"
#include "MissionManagerTestTool.h"
class MissionManagerTest : public MissionManager
{
public:
MissionManagerTest() = default;
virtual ~MissionManagerTest() = default;
// const StatusCode SetAppMonitor(std::shared_ptr<VAppMonitor> &monitor) override;
protected:
// virtual const StatusCode SetAppMonitorTrace(std::shared_ptr<VAppMonitor> &monitor);
};
class MissionManagerMock : public MissionManagerTest
{
public:
MissionManagerMock() = default;
virtual ~MissionManagerMock() = default;
// MOCK_METHOD1(SetAppMonitorTrace, const StatusCode(std::shared_ptr<VAppMonitor> &));
};
#endif

View File

@ -13,18 +13,20 @@
* limitations under the License. * limitations under the License.
*/ */
#include "MissionManagerTestTool.h" #include "MissionManagerTestTool.h"
#include "MissionManagerMakePtrTest.h"
#include "MissionManagerMock.h"
void MissionManagerTestTool::Init(void) void MissionManagerTestTool::Init(void)
{ {
// ServersMock::GetInstance()->Init(); // ServersMock::GetInstance()->Init();
// mMissionManagerMock = std::make_shared<MissionManagerMock>(); mMissionManagerMock = std::make_shared<MissionManagerMock>();
// MissionManagerMockInit(mMissionManagerMock); // MissionManagerMockInit(mMissionManagerMock);
// std::shared_ptr<MissionManagerMock> mock = std::dynamic_pointer_cast<MissionManagerMock>(mMissionManagerMock); std::shared_ptr<MissionManagerMock> mock = std::dynamic_pointer_cast<MissionManagerMock>(mMissionManagerMock);
// OverrideMissionManagerMakePtrObject(mock); OverrideMissionManagerMakePtrObject(mock);
} }
void MissionManagerTestTool::UnInit(void) void MissionManagerTestTool::UnInit(void)
{ {
// ServersMock::GetInstance()->UnInit(); // ServersMock::GetInstance()->UnInit();
// mMissionManagerMock.reset(); mMissionManagerMock.reset();
// mAppMonitorMock.reset(); // mAppMonitorMock.reset();
// CancelOverrideMissionManagerMakePtrObject(); CancelOverrideMissionManagerMakePtrObject();
} }

View File

@ -23,6 +23,11 @@ StatusCode HalCppTest::GetAllLeds(std::map<std::string, std::shared_ptr<VLedHal>
} }
return code; return code;
} }
StatusCode HalCppTest::GetAllLedsTrace(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds)
{
LogInfo("HalCppTest::GetAllLedsTrace\n");
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode HalCppTest::GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys) StatusCode HalCppTest::GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys)
{ {
LogInfo("HalCppTest::GetAllKeys\n"); LogInfo("HalCppTest::GetAllKeys\n");
@ -32,13 +37,22 @@ StatusCode HalCppTest::GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>
} }
return code; return code;
} }
StatusCode HalCppTest::GetAllLedsTrace(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds)
{
LogInfo("HalCppTest::GetAllLedsTrace\n");
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode HalCppTest::GetAllKeysTrace(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys) StatusCode HalCppTest::GetAllKeysTrace(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys)
{ {
LogInfo("HalCppTest::GetAllKeysTrace\n"); LogInfo("HalCppTest::GetAllKeysTrace\n");
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
} }
StatusCode HalCppTest::GetWifiHal(std::shared_ptr<VWifiHal> &wifi)
{
LogInfo("HalCppTest::GetAllKeys\n");
StatusCode code = GetWifiHalTrace(wifi);
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
return HalCpp::GetWifiHal(wifi);
}
return code;
}
StatusCode HalCppTest::GetWifiHalTrace(std::shared_ptr<VWifiHal> &wifi)
{
LogInfo("HalCppTest::GetWifiHalTrace\n");
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}

View File

@ -23,10 +23,12 @@ public:
virtual ~HalCppTest() = default; virtual ~HalCppTest() = default;
StatusCode GetAllLeds(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds) override; StatusCode GetAllLeds(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds) override;
StatusCode GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys) override; StatusCode GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys) override;
StatusCode GetWifiHal(std::shared_ptr<VWifiHal> &wifi) override;
protected: protected:
virtual StatusCode GetAllLedsTrace(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds); virtual StatusCode GetAllLedsTrace(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds);
virtual StatusCode GetAllKeysTrace(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys); virtual StatusCode GetAllKeysTrace(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys);
virtual StatusCode GetWifiHalTrace(std::shared_ptr<VWifiHal> &wifi);
}; };
class HalCppMock : public HalCppTest class HalCppMock : public HalCppTest
{ {
@ -35,5 +37,6 @@ public:
virtual ~HalCppMock() = default; virtual ~HalCppMock() = default;
MOCK_METHOD1(GetAllLedsTrace, StatusCode(std::map<std::string, std::shared_ptr<VLedHal>> &)); MOCK_METHOD1(GetAllLedsTrace, StatusCode(std::map<std::string, std::shared_ptr<VLedHal>> &));
MOCK_METHOD1(GetAllKeysTrace, StatusCode(std::map<std::string, std::shared_ptr<VKeyHal>> &)); MOCK_METHOD1(GetAllKeysTrace, StatusCode(std::map<std::string, std::shared_ptr<VKeyHal>> &));
MOCK_METHOD1(GetWifiHalTrace, StatusCode(std::shared_ptr<VWifiHal> &));
}; };
#endif #endif

View File

@ -19,6 +19,7 @@
#include "KeyControl.h" #include "KeyControl.h"
#include "KeyControlMock.h" #include "KeyControlMock.h"
#include "LedControlMock.h" #include "LedControlMock.h"
#include "WifiHalMock.h"
#include <thread> #include <thread>
void HalTestTool::Init(void) void HalTestTool::Init(void)
{ {
@ -158,6 +159,9 @@ void HalTestTool::HalMockInit(std::shared_ptr<IHalCpp> &vMock)
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION)))); .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
EXPECT_CALL(*mock.get(), GetAllKeysTrace(_)) EXPECT_CALL(*mock.get(), GetAllKeysTrace(_))
.WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION)))); .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
std::shared_ptr<VWifiHal> wifiHal = std::make_shared<WifiHalMock>();
EXPECT_CALL(*mock.get(), GetWifiHalTrace(_))
.WillRepeatedly(DoAll(SetArgReferee<0>(wifiHal), Return(CreateStatusCode(STATUS_CODE_OK))));
} }
void HalTestTool::SetAllKeysResult(std::shared_ptr<IHalCpp> &vMock, void HalTestTool::SetAllKeysResult(std::shared_ptr<IHalCpp> &vMock,
std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys) std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys)

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2023 Fancy Code.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "HalCppMock.h"
#include "ILog.h"
// StatusCode WifiHalTest::GetAllLeds(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds)
// {
// LogInfo("WifiHalTest::GetAllLeds\n");
// StatusCode code = GetAllLedsTrace(allLeds);
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
// return HalCpp::GetAllLeds(allLeds);
// }
// return code;
// }
// StatusCode WifiHalTest::GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys)
// {
// LogInfo("WifiHalTest::GetAllKeys\n");
// StatusCode code = GetAllKeysTrace(allKeys);
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
// return HalCpp::GetAllKeys(allKeys);
// }
// return code;
// }
// StatusCode WifiHalTest::GetAllLedsTrace(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds)
// {
// LogInfo("WifiHalTest::GetAllLedsTrace\n");
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
// }
// StatusCode WifiHalTest::GetAllKeysTrace(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys)
// {
// LogInfo("WifiHalTest::GetAllKeysTrace\n");
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
// }

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2023 Fancy Code.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WIFI_HAL_MOCK_H
#define WIFI_HAL_MOCK_H
#include "HalCpp.h"
#include "HalTestTool.h"
class WifiHalTest : public VWifiHal
{
public:
WifiHalTest() = default;
virtual ~WifiHalTest() = default;
// StatusCode GetAllLeds(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds) override;
// StatusCode GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys) override;
protected:
// virtual StatusCode GetAllLedsTrace(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds);
// virtual StatusCode GetAllKeysTrace(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys);
};
class WifiHalMock : public WifiHalTest
{
public:
WifiHalMock() = default;
virtual ~WifiHalMock() = default;
// MOCK_METHOD1(GetAllLedsTrace, StatusCode(std::map<std::string, std::shared_ptr<VLedHal>> &));
// MOCK_METHOD1(GetAllKeysTrace, StatusCode(std::map<std::string, std::shared_ptr<VKeyHal>> &));
};
#endif