mirror of
https://gitee.com/jiuyilian/embedded-framework.git
synced 2025-01-06 10:16:51 -05:00
Add:test code.
This commit is contained in:
parent
b28b337f36
commit
d7a472277d
|
@ -52,7 +52,8 @@ void MissionStateMachine::Init(void)
|
|||
}
|
||||
void MissionStateMachine::UnInit(void)
|
||||
{
|
||||
//
|
||||
mStateMachine->StopHandlerThread();
|
||||
mStateTree.clear();
|
||||
}
|
||||
void MissionStateMachine::SwitchState(const MissionState &state)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ include_directories(
|
|||
${UTILS_SOURCE_PATH}/UartDevice/include
|
||||
${UTILS_SOURCE_PATH}/LedControl/include
|
||||
${TEST_SOURCE_PATH}
|
||||
${TEST_SOURCE_PATH}/application/MissionManager/tool/include
|
||||
${TEST_SOURCE_PATH}/middleware/McuManager/tool/include
|
||||
${TEST_SOURCE_PATH}/middleware/AppManager/tool/include
|
||||
${TEST_SOURCE_PATH}/utils/LinuxApiMock/include
|
||||
|
@ -37,7 +38,7 @@ endif()
|
|||
|
||||
set(TARGET_NAME HunttingCameraTest)
|
||||
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")
|
||||
target_link_libraries(${TARGET_NAME} gcov)
|
||||
endif()
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "ILog.h"
|
||||
#include "MainThread.h"
|
||||
#include "McuManagerTestTool.h"
|
||||
#include "MissionManagerTestTool.h"
|
||||
#include "TestManager.h"
|
||||
#include <thread>
|
||||
namespace HunttingCameraTest
|
||||
|
@ -34,6 +35,7 @@ public:
|
|||
};
|
||||
class HunttingCameraTest : public testing::Test,
|
||||
public TestManager,
|
||||
public MissionManagerTestTool,
|
||||
public McuManagerTestTool,
|
||||
public AppManagerTestTool,
|
||||
public HalTestTool
|
||||
|
@ -55,6 +57,7 @@ public:
|
|||
// CreateAllKeysMcok();
|
||||
HalTestTool::Init();
|
||||
AppManagerTestTool::Init();
|
||||
MissionManagerTestTool::Init();
|
||||
// HunttingCameraTestTool::Init();
|
||||
// CreateHalCppModule();
|
||||
// CreateDeviceManagerModule();
|
||||
|
@ -71,6 +74,7 @@ public:
|
|||
// DestroyDeviceManagerModule();
|
||||
// DestroyAllKeysMock();
|
||||
TestManager::UnInit();
|
||||
MissionManagerTestTool::UnInit();
|
||||
AppManagerTestTool::UnInit();
|
||||
HalTestTool::UnInit();
|
||||
LinuxApiMock::GetInstance()->UnInit();
|
||||
|
@ -86,8 +90,9 @@ public:
|
|||
public:
|
||||
std::shared_ptr<LinuxTest> mLinuxTest;
|
||||
};
|
||||
// ../output_files/test/bin/HunttingCameraTest --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_EXAMPLE_Demo
|
||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_EXAMPLE_Demo)
|
||||
// ../output_files/test/bin/HunttingCameraTest
|
||||
// --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetProductInfo
|
||||
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetProductInfo)
|
||||
{
|
||||
MainThread::GetInstance()->Init();
|
||||
TestManager::ResetTimeOut(1000 * 3);
|
||||
|
@ -95,4 +100,74 @@ TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_EXAMPLE_Demo)
|
|||
MockGetProductInfo();
|
||||
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
|
Loading…
Reference in New Issue
Block a user