Backup.
This commit is contained in:
parent
949f29fbd7
commit
081397e560
|
@ -27,8 +27,6 @@ link_directories(
|
||||||
${EXTERNAL_LIBS_OUTPUT_PATH}
|
${EXTERNAL_LIBS_OUTPUT_PATH}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (DEFINED MCU_UART_DEVICE)
|
if (DEFINED MCU_UART_DEVICE)
|
||||||
add_definitions(-DMCU_UART_DEVICE=\"${MCU_UART_DEVICE}\")
|
add_definitions(-DMCU_UART_DEVICE=\"${MCU_UART_DEVICE}\")
|
||||||
else()
|
else()
|
||||||
|
|
85
test/middleware/McuManager/src/McuManager_Test.cpp
Normal file
85
test/middleware/McuManager/src/McuManager_Test.cpp
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
/*
|
||||||
|
* 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 "ILog.h"
|
||||||
|
#include "IMcuManager.h"
|
||||||
|
#include "McuAskBase.h"
|
||||||
|
#include "McuAskBaseTestTool.h"
|
||||||
|
#include <gmock/gmock.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <thread>
|
||||||
|
namespace McuManagerTest
|
||||||
|
{
|
||||||
|
class McuManagerTest : public testing::Test
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
McuManagerTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual ~McuManagerTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
static void SetUpTestCase()
|
||||||
|
{
|
||||||
|
CreateLogModule();
|
||||||
|
ILogInit(LOG_INSTANCE_TYPE_END);
|
||||||
|
}
|
||||||
|
static void TearDownTestCase()
|
||||||
|
{
|
||||||
|
ILogUnInit();
|
||||||
|
}
|
||||||
|
virtual void SetUp()
|
||||||
|
{
|
||||||
|
CreateMcuManager();
|
||||||
|
IMcuManager::GetInstance()->Init();
|
||||||
|
}
|
||||||
|
virtual void TearDown()
|
||||||
|
{
|
||||||
|
IMcuManager::GetInstance()->UnInit();
|
||||||
|
DestroyMcuManager();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// ../output_files/test/bin/McuManagerTest
|
||||||
|
// --gtest_filter=McuManagerTest.INTEGRATION_McuManager_AUTO_GetIpcMission
|
||||||
|
TEST_F(McuManagerTest, RH_INTEGRATION_McuManager_AUTO_GetIpcMission)
|
||||||
|
{
|
||||||
|
class McuAskTest : public McuAsk<IpcMission>, public McuAskBaseTestTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
McuAskTest() : McuAskBaseTestTool(McuAskBlock::BLOCK, McuAskReply::NEED_REPLY)
|
||||||
|
{
|
||||||
|
mDataReply = IpcMission::END;
|
||||||
|
}
|
||||||
|
virtual ~McuAskTest() = default;
|
||||||
|
void ReplyFinished(const bool result) override
|
||||||
|
{
|
||||||
|
McuAskBaseTestTool::ReplyFinished(result);
|
||||||
|
if (result) {
|
||||||
|
LogInfo("Ask data succeed, mDataReply = %d.\n", static_cast<int>(mDataReply));
|
||||||
|
// Do something here.
|
||||||
|
EXPECT_GT(static_cast<int>(mDataReply), 0);
|
||||||
|
EXPECT_LT(static_cast<int>(mDataReply), static_cast<int>(IpcMission::END));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LogError("Ask data falied.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
std::shared_ptr<VMcuAsk> ask = std::make_shared<McuAskTest>();
|
||||||
|
std::shared_ptr<McuAskBaseTestTool> testTool = std::dynamic_pointer_cast<McuAskBaseTestTool>(ask);
|
||||||
|
testTool->McuAskDefaultFeatures(testTool);
|
||||||
|
IMcuManager::GetInstance()->GetIpcMission(ask);
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
}
|
||||||
|
} // namespace McuManagerTest
|
|
@ -1,3 +1,17 @@
|
||||||
|
/*
|
||||||
|
* 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 "ILog.h"
|
#include "ILog.h"
|
||||||
#include "IMcuManager.h"
|
#include "IMcuManager.h"
|
||||||
#include "LinuxApiMock.h"
|
#include "LinuxApiMock.h"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
### 1.1.2. 测试用例命名:
|
### 1.1.2. 测试用例命名:
|
||||||
|
|
||||||
1. 仿真:硬件仿真,使用hardware simulation的缩写:HS;真实接口使用real interface的缩写:RA;
|
1. 仿真:硬件仿真,使用hardware simulation的缩写:**HS**,硬件仿真只能运行在Ubuntu系统进行仿真测试;真实硬件接口使用real hardware的缩写:**RH**,真实硬件接口测试用例只能运行在开发板进行真机测试;不涉及使用NOT INVOLVED的缩写:**NI**,即可执行在Ubuntu也可以运行在开发板;
|
||||||
2. 测试用例类型:含单元测试(UNIT)和集成测试(INTEGRATION);
|
2. 测试用例类型:含单元测试(UNIT)和集成测试(INTEGRATION);
|
||||||
3. 用例所属模块:大小驼峰;
|
3. 用例所属模块:大小驼峰;
|
||||||
4. 测试用例属性:EXAMPLE/AUTO/STRESS
|
4. 测试用例属性:EXAMPLE/AUTO/STRESS
|
||||||
|
|
Loading…
Reference in New Issue
Block a user