Add:test code.
This commit is contained in:
parent
b28b337f36
commit
d7a472277d
|
@ -52,7 +52,8 @@ void MissionStateMachine::Init(void)
|
||||||
}
|
}
|
||||||
void MissionStateMachine::UnInit(void)
|
void MissionStateMachine::UnInit(void)
|
||||||
{
|
{
|
||||||
//
|
mStateMachine->StopHandlerThread();
|
||||||
|
mStateTree.clear();
|
||||||
}
|
}
|
||||||
void MissionStateMachine::SwitchState(const MissionState &state)
|
void MissionStateMachine::SwitchState(const MissionState &state)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,7 @@ include_directories(
|
||||||
${UTILS_SOURCE_PATH}/UartDevice/include
|
${UTILS_SOURCE_PATH}/UartDevice/include
|
||||||
${UTILS_SOURCE_PATH}/LedControl/include
|
${UTILS_SOURCE_PATH}/LedControl/include
|
||||||
${TEST_SOURCE_PATH}
|
${TEST_SOURCE_PATH}
|
||||||
|
${TEST_SOURCE_PATH}/application/MissionManager/tool/include
|
||||||
${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
|
||||||
${TEST_SOURCE_PATH}/utils/LinuxApiMock/include
|
${TEST_SOURCE_PATH}/utils/LinuxApiMock/include
|
||||||
|
@ -37,7 +38,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 HalTestTool TestManager gtest gmock pthread)
|
target_link_libraries(${TARGET_NAME} HunttingMainLib MissionManagerTestTool 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()
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "MainThread.h"
|
#include "MainThread.h"
|
||||||
#include "McuManagerTestTool.h"
|
#include "McuManagerTestTool.h"
|
||||||
|
#include "MissionManagerTestTool.h"
|
||||||
#include "TestManager.h"
|
#include "TestManager.h"
|
||||||
#include <thread>
|
#include <thread>
|
||||||
namespace HunttingCameraTest
|
namespace HunttingCameraTest
|
||||||
|
@ -34,6 +35,7 @@ public:
|
||||||
};
|
};
|
||||||
class HunttingCameraTest : public testing::Test,
|
class HunttingCameraTest : public testing::Test,
|
||||||
public TestManager,
|
public TestManager,
|
||||||
|
public MissionManagerTestTool,
|
||||||
public McuManagerTestTool,
|
public McuManagerTestTool,
|
||||||
public AppManagerTestTool,
|
public AppManagerTestTool,
|
||||||
public HalTestTool
|
public HalTestTool
|
||||||
|
@ -55,6 +57,7 @@ public:
|
||||||
// CreateAllKeysMcok();
|
// CreateAllKeysMcok();
|
||||||
HalTestTool::Init();
|
HalTestTool::Init();
|
||||||
AppManagerTestTool::Init();
|
AppManagerTestTool::Init();
|
||||||
|
MissionManagerTestTool::Init();
|
||||||
// HunttingCameraTestTool::Init();
|
// HunttingCameraTestTool::Init();
|
||||||
// CreateHalCppModule();
|
// CreateHalCppModule();
|
||||||
// CreateDeviceManagerModule();
|
// CreateDeviceManagerModule();
|
||||||
|
@ -71,6 +74,7 @@ public:
|
||||||
// DestroyDeviceManagerModule();
|
// DestroyDeviceManagerModule();
|
||||||
// DestroyAllKeysMock();
|
// DestroyAllKeysMock();
|
||||||
TestManager::UnInit();
|
TestManager::UnInit();
|
||||||
|
MissionManagerTestTool::UnInit();
|
||||||
AppManagerTestTool::UnInit();
|
AppManagerTestTool::UnInit();
|
||||||
HalTestTool::UnInit();
|
HalTestTool::UnInit();
|
||||||
LinuxApiMock::GetInstance()->UnInit();
|
LinuxApiMock::GetInstance()->UnInit();
|
||||||
|
@ -86,8 +90,9 @@ public:
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<LinuxTest> mLinuxTest;
|
std::shared_ptr<LinuxTest> mLinuxTest;
|
||||||
};
|
};
|
||||||
// ../output_files/test/bin/HunttingCameraTest --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_EXAMPLE_Demo
|
// ../output_files/test/bin/HunttingCameraTest
|
||||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_EXAMPLE_Demo)
|
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetProductInfo
|
||||||
|
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetProductInfo)
|
||||||
{
|
{
|
||||||
MainThread::GetInstance()->Init();
|
MainThread::GetInstance()->Init();
|
||||||
TestManager::ResetTimeOut(1000 * 3);
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
@ -95,4 +100,74 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_EXAMPLE_Demo)
|
||||||
MockGetProductInfo();
|
MockGetProductInfo();
|
||||||
MainThread::GetInstance()->Runing();
|
MainThread::GetInstance()->Runing();
|
||||||
}
|
}
|
||||||
|
// ../output_files/test/bin/HunttingCameraTest
|
||||||
|
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetDeviceAttr
|
||||||
|
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetDeviceAttr)
|
||||||
|
{
|
||||||
|
MainThread::GetInstance()->Init();
|
||||||
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
MockGetDeviceAttr();
|
||||||
|
MainThread::GetInstance()->Runing();
|
||||||
|
}
|
||||||
|
// ../output_files/test/bin/HunttingCameraTest
|
||||||
|
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetMediaInfo
|
||||||
|
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetMediaInfo)
|
||||||
|
{
|
||||||
|
MainThread::GetInstance()->Init();
|
||||||
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
MockGetMediaInfo();
|
||||||
|
MainThread::GetInstance()->Runing();
|
||||||
|
}
|
||||||
|
// ../output_files/test/bin/HunttingCameraTest
|
||||||
|
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetSdCardInfo
|
||||||
|
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetSdCardInfo)
|
||||||
|
{
|
||||||
|
MainThread::GetInstance()->Init();
|
||||||
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
MockGetSdCardInfo();
|
||||||
|
MainThread::GetInstance()->Runing();
|
||||||
|
}
|
||||||
|
// ../output_files/test/bin/HunttingCameraTest
|
||||||
|
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetBatteryInfo
|
||||||
|
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetBatteryInfo)
|
||||||
|
{
|
||||||
|
MainThread::GetInstance()->Init();
|
||||||
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
MockGetBatteryInfo();
|
||||||
|
MainThread::GetInstance()->Runing();
|
||||||
|
}
|
||||||
|
// ../output_files/test/bin/HunttingCameraTest
|
||||||
|
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_SetDateTime
|
||||||
|
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetDateTime)
|
||||||
|
{
|
||||||
|
MainThread::GetInstance()->Init();
|
||||||
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
MockSetDateTime();
|
||||||
|
MainThread::GetInstance()->Runing();
|
||||||
|
}
|
||||||
|
// ../output_files/test/bin/HunttingCameraTest
|
||||||
|
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_SetTimeZone
|
||||||
|
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetTimeZone)
|
||||||
|
{
|
||||||
|
MainThread::GetInstance()->Init();
|
||||||
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
MockSetTimeZone();
|
||||||
|
MainThread::GetInstance()->Runing();
|
||||||
|
}
|
||||||
|
// ../output_files/test/bin/HunttingCameraTest
|
||||||
|
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_MockUploadFiles
|
||||||
|
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_MockUploadFiles)
|
||||||
|
{
|
||||||
|
MainThread::GetInstance()->Init();
|
||||||
|
TestManager::ResetTimeOut(1000 * 3);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
MockUploadFiles();
|
||||||
|
MainThread::GetInstance()->Runing();
|
||||||
|
}
|
||||||
} // namespace HunttingCameraTest
|
} // namespace HunttingCameraTest
|
Loading…
Reference in New Issue
Block a user