Fixed:compile error.

This commit is contained in:
Fancy code 2024-03-05 01:51:23 -08:00
parent 402baf38f9
commit 1b22cd3f63
6 changed files with 139 additions and 72 deletions

View File

@ -0,0 +1,28 @@
/*
* 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 "TestMissionState.h"
#include "ILog.h"
TestMissionState::TestMissionState() : State("TestMissionState") {}
void TestMissionState::GoInState()
{
//
LogInfo(" ========== TestMissionState::GoInState.\n");
}
void TestMissionState::GoOutState()
{
//
LogInfo(" ========== TestMissionState::GoOutState.\n");
}
bool TestMissionState::ExecuteStateMsg(VStateMachineData *msg) { return DataProcessing::EventHandle(msg); }

View File

@ -0,0 +1,28 @@
/*
* 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 TEST_MISSION_STATE_H
#define TEST_MISSION_STATE_H
#include "DataProcessing.h"
#include "IStateMachine.h"
class TestMissionState : public State, public DataProcessing
{
public:
TestMissionState();
virtual ~TestMissionState() = default;
void GoInState() override;
void GoOutState() override;
bool ExecuteStateMsg(VStateMachineData *msg) override;
};
#endif

View File

@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TOPSTATE_H
#define TOPSTATE_H
#ifndef TOP_STATE_H
#define TOP_STATE_H
#include "DataProcessing.h"
#include "IStateMachine.h"
class TopState : public State, public DataProcessing

View File

@ -14,38 +14,26 @@
*/
#include "IAppManager.h"
#include "ILog.h"
StatusCode inline VAppMonitor::GetProductInfo(AppGetProductInfo &param)
StatusCode VAppMonitor::GetProductInfo(AppGetProductInfo &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode inline VAppMonitor::GetDeviceAttr(AppGetDeviceAttr &param)
StatusCode VAppMonitor::GetDeviceAttr(AppGetDeviceAttr &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode inline VAppMonitor::GetMediaInfo(AppGetMeidaInfo &param)
StatusCode VAppMonitor::GetMediaInfo(AppGetMeidaInfo &param) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); }
StatusCode VAppMonitor::GetSdCardInfo(AppGetSdCardInfo &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode inline VAppMonitor::GetSdCardInfo(AppGetSdCardInfo &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode inline VAppMonitor::GetBatteryInfo(AppGetBatteryInfo &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode inline VAppMonitor::SetDateTime(AppSetDateTime &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode inline VAppMonitor::SetTimeZone(const unsigned int &zone)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode inline VAppMonitor::UploadFile(AppUploadFile &param)
StatusCode VAppMonitor::GetBatteryInfo(AppGetBatteryInfo &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::SetDateTime(AppSetDateTime &param) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); }
StatusCode VAppMonitor::SetTimeZone(const unsigned int &zone) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); }
StatusCode VAppMonitor::UploadFile(AppUploadFile &param) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); }
std::shared_ptr<IAppManager> &IAppManager::GetInstance(std::shared_ptr<IAppManager> *impl)
{
static auto instance = std::make_shared<IAppManager>();

View File

@ -20,54 +20,4 @@
#include <thread>
namespace HunttingCameraTest
{
class HunttingCameraTest : public testing::Test, public TestManager, public McuManagerTestTool
{
public:
HunttingCameraTest() {}
virtual ~HunttingCameraTest() {}
static void SetUpTestCase()
{
CreateLogModule();
ILogInit(LOG_INSTANCE_TYPE_END);
}
static void TearDownTestCase() { ILogUnInit(); }
virtual void SetUp()
{
// CreateAllKeysMcok();
// HalTestTool::Init();
// HunttingCameraTestTool::Init();
// CreateHalCppModule();
// CreateDeviceManagerModule();
mLinuxTest = LinuxTest::CreateLinuxTest();
std::shared_ptr<LinuxApiMock> test = mLinuxTest;
LinuxApiMock::GetInstance(&test);
LinuxApiMock::GetInstance()->Init();
McuManagerTestTool::Init(mLinuxTest);
TestManager::Init();
}
virtual void TearDown()
{
// HalTestTool::UnInit();
// HunttingCameraTestTool::UnInit();
// DestroyDeviceManagerModule();
// DestroyAllKeysMock();
TestManager::UnInit();
LinuxApiMock::GetInstance()->UnInit();
mLinuxTest = std::make_shared<LinuxTest>();
std::shared_ptr<LinuxApiMock> test = std::make_shared<LinuxApiMock>();
LinuxApiMock::GetInstance(&test);
McuManagerTestTool::UnInit();
MainThread::GetInstance()->UnInit();
}
public:
std::shared_ptr<LinuxTest> mLinuxTest;
};
// ../output_files/test/bin/HunttingCameraTest --gtest_filter=HunttingCameraTest.INTEGRATION_DeviceManager_EXAMPLE_Demo
TEST_F(HunttingCameraTest, INTEGRATION_DeviceManager_EXAMPLE_Demo)
{
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 3);
MainThread::GetInstance()->Runing();
}
} // namespace HunttingCameraTest

View File

@ -0,0 +1,73 @@
/*
* 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 "GtestUsing.h"
#include "ILog.h"
#include "MainThread.h"
#include "McuManagerTestTool.h"
#include "TestManager.h"
#include <thread>
namespace HunttingCameraTest
{
class HunttingCameraTest : public testing::Test, public TestManager, public McuManagerTestTool
{
public:
HunttingCameraTest() {}
virtual ~HunttingCameraTest() {}
static void SetUpTestCase()
{
CreateLogModule();
ILogInit(LOG_INSTANCE_TYPE_END);
}
static void TearDownTestCase() { ILogUnInit(); }
virtual void SetUp()
{
// CreateAllKeysMcok();
// HalTestTool::Init();
// HunttingCameraTestTool::Init();
// CreateHalCppModule();
// CreateDeviceManagerModule();
mLinuxTest = LinuxTest::CreateLinuxTest();
std::shared_ptr<LinuxApiMock> test = mLinuxTest;
LinuxApiMock::GetInstance(&test);
LinuxApiMock::GetInstance()->Init();
McuManagerTestTool::Init(mLinuxTest);
TestManager::Init();
}
virtual void TearDown()
{
// HalTestTool::UnInit();
// HunttingCameraTestTool::UnInit();
// DestroyDeviceManagerModule();
// DestroyAllKeysMock();
TestManager::UnInit();
LinuxApiMock::GetInstance()->UnInit();
mLinuxTest = std::make_shared<LinuxTest>();
std::shared_ptr<LinuxApiMock> test = std::make_shared<LinuxApiMock>();
LinuxApiMock::GetInstance(&test);
McuManagerTestTool::UnInit();
MainThread::GetInstance()->UnInit();
}
public:
std::shared_ptr<LinuxTest> mLinuxTest;
};
// ../output_files/test/bin/HunttingCameraTest --gtest_filter=HunttingCameraTest.INTEGRATION_DeviceManager_EXAMPLE_Demo
TEST_F(HunttingCameraTest, INTEGRATION_DeviceManager_EXAMPLE_Demo)
{
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 3);
MainThread::GetInstance()->Runing();
}
} // namespace HunttingCameraTest