hunting/test/middleware/DeviceManager/src/DeviceManager_Test.cpp
2024-02-16 04:31:40 -08:00

66 lines
2.2 KiB
C++

/*
* 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 "HalTestTool.h"
#include "IDeviceManager.h"
#include "ILog.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <thread>
namespace DeviceManagerTest
{
class DeviceManagerTest : public testing::Test, public HalTestTool
{
public:
DeviceManagerTest() {}
virtual ~DeviceManagerTest() {}
static void SetUpTestCase()
{
CreateLogModule();
ILogInit(LOG_INSTANCE_TYPE_END);
}
static void TearDownTestCase() { ILogUnInit(); }
virtual void SetUp()
{
// mLinuxTest = LinuxTest::CreateLinuxTest();
// std::shared_ptr<LinuxApiMock> test = mLinuxTest;
// LinuxApiMock::GetInstance(&test);
// LinuxApiMock::GetInstance()->Init();
HalTestTool::Init();
CreateHalCppModule();
CreateDeviceManagerModule();
// CreateMcuManager();
}
virtual void TearDown()
{
// LinuxApiMock::GetInstance()->UnInit();
// mLinuxTest = std::make_shared<LinuxTest>();
// std::shared_ptr<LinuxApiMock> test = std::make_shared<LinuxApiMock>();
// LinuxApiMock::GetInstance(&test);
HalTestTool::UnInit();
// DestroyMcuManager();
DestroyDeviceManagerModule();
}
public:
// std::shared_ptr<LinuxTest> mLinuxTest;
};
// ../output_files/test/bin/DeviceManagerTest --gtest_filter=DeviceManagerTest.INTEGRATION_DeviceManager_EXAMPLE_Demo
TEST_F(DeviceManagerTest, INTEGRATION_DeviceManager_EXAMPLE_Demo)
{
IDeviceManager::GetInstance()->Init();
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
IDeviceManager::GetInstance()->UnInit();
}
} // namespace DeviceManagerTest