Improve:include cleaner.
This commit is contained in:
parent
519af895ef
commit
0c84cdce63
|
@ -47,5 +47,6 @@ using ::testing::Unused;
|
||||||
using ::testing::WithArgs;
|
using ::testing::WithArgs;
|
||||||
using ::testing::internal::BuiltInDefaultValue;
|
using ::testing::internal::BuiltInDefaultValue;
|
||||||
// using ::testing::Mock::VerifyAndClearExpectations;
|
// using ::testing::Mock::VerifyAndClearExpectations;
|
||||||
|
using ::testing::Between;
|
||||||
using ::testing::Mock;
|
using ::testing::Mock;
|
||||||
#endif
|
#endif
|
|
@ -13,7 +13,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "AppManagerMakePtrTest.h"
|
#include "AppManagerMakePtrTest.h"
|
||||||
|
#include "AppManagerMock.h"
|
||||||
|
#include "IAppManager.h"
|
||||||
|
#include "AppManagerMakePtr.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
|
#include "StatusCode.h"
|
||||||
|
#include <memory>
|
||||||
void OverrideAppManagerMakePtrObject(std::shared_ptr<AppManagerMock> &appManagerMock)
|
void OverrideAppManagerMakePtrObject(std::shared_ptr<AppManagerMock> &appManagerMock)
|
||||||
{
|
{
|
||||||
std::shared_ptr<AppManagerMakePtr> impl = std::make_shared<AppManagerMakePtrTest>();
|
std::shared_ptr<AppManagerMakePtr> impl = std::make_shared<AppManagerMakePtrTest>();
|
||||||
|
|
|
@ -13,7 +13,11 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "AppManagerMock.h"
|
#include "AppManagerMock.h"
|
||||||
|
#include "AppManager.h"
|
||||||
|
#include "IAppManager.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
|
#include "StatusCode.h"
|
||||||
|
#include <memory>
|
||||||
const StatusCode AppManagerTest::SetAppMonitor(std::shared_ptr<VAppMonitor> &monitor)
|
const StatusCode AppManagerTest::SetAppMonitor(std::shared_ptr<VAppMonitor> &monitor)
|
||||||
{
|
{
|
||||||
LogInfo("AppManagerTest::SetAppMonitor\n");
|
LogInfo("AppManagerTest::SetAppMonitor\n");
|
||||||
|
|
|
@ -16,9 +16,17 @@
|
||||||
#include "AppManagerMakePtrTest.h"
|
#include "AppManagerMakePtrTest.h"
|
||||||
#include "AppManagerMock.h"
|
#include "AppManagerMock.h"
|
||||||
#include "AppMonitorMock.h"
|
#include "AppMonitorMock.h"
|
||||||
|
#include "GtestUsing.h"
|
||||||
|
#include "IAppManager.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "ServersMock.h"
|
#include "ServersMock.h"
|
||||||
|
#include "StatusCode.h"
|
||||||
#include "TcpModule.h"
|
#include "TcpModule.h"
|
||||||
|
#include <gmock/gmock-spec-builders.h>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <vector>
|
||||||
constexpr int ONLY_BE_CALLED_ONCE = 1;
|
constexpr int ONLY_BE_CALLED_ONCE = 1;
|
||||||
AppManagerTestTool::AppManagerTestTool()
|
AppManagerTestTool::AppManagerTestTool()
|
||||||
{
|
{
|
||||||
|
@ -314,7 +322,7 @@ void AppManagerTestTool::AppManagerMockInit(std::shared_ptr<IAppManager> &vMock)
|
||||||
AppManagerTestTool::AppMonitorInit(mAppMonitorMock);
|
AppManagerTestTool::AppMonitorInit(mAppMonitorMock);
|
||||||
};
|
};
|
||||||
EXPECT_CALL(*mock.get(), SetAppMonitorTrace(_))
|
EXPECT_CALL(*mock.get(), SetAppMonitorTrace(_))
|
||||||
.Times(testing::Between(0, 1))
|
.Times(Between(0, 1))
|
||||||
.WillOnce(DoAll(WithArgs<0>(Invoke(getAppMonitor)), Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
.WillOnce(DoAll(WithArgs<0>(Invoke(getAppMonitor)), Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
}
|
}
|
||||||
std::shared_ptr<VAppMonitor> AppManagerTestTool::MakeMonitorMock(void)
|
std::shared_ptr<VAppMonitor> AppManagerTestTool::MakeMonitorMock(void)
|
||||||
|
|
|
@ -13,7 +13,11 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "AppMonitorMock.h"
|
#include "AppMonitorMock.h"
|
||||||
|
#include "IAppManager.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
|
#include "StatusCode.h"
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
StatusCode AppMonitorTest::GetProductInfo(AppGetProductInfo ¶m)
|
StatusCode AppMonitorTest::GetProductInfo(AppGetProductInfo ¶m)
|
||||||
{
|
{
|
||||||
LogInfo("AppMonitorTest::GetProductInfo\n");
|
LogInfo("AppMonitorTest::GetProductInfo\n");
|
||||||
|
|
|
@ -15,7 +15,11 @@
|
||||||
#include "ServersMock.h"
|
#include "ServersMock.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "servers.h"
|
#include "servers.h"
|
||||||
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <memory>
|
||||||
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
extern const char *APP_GET_PRODUCT_INFO;
|
extern const char *APP_GET_PRODUCT_INFO;
|
||||||
extern const char *APP_GET_DEVICE_ATTR;
|
extern const char *APP_GET_DEVICE_ATTR;
|
||||||
extern const char *APP_GET_MEDIA_INFO;
|
extern const char *APP_GET_MEDIA_INFO;
|
||||||
|
|
|
@ -13,9 +13,16 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "LinuxApiMock.h"
|
#include "LinuxApiMock.h"
|
||||||
#include "ILog.h"
|
|
||||||
#include "LinuxTestImpl.h"
|
#include "LinuxTestImpl.h"
|
||||||
#include "WrapApi.h"
|
#include "WrapApi.h"
|
||||||
|
#include <bits/types/struct_timeval.h>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <memory>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <termios.h>
|
||||||
std::shared_ptr<LinuxApiMock> &LinuxApiMock::GetInstance(std::shared_ptr<LinuxApiMock> *impl)
|
std::shared_ptr<LinuxApiMock> &LinuxApiMock::GetInstance(std::shared_ptr<LinuxApiMock> *impl)
|
||||||
{
|
{
|
||||||
static auto instance = std::make_shared<LinuxApiMock>();
|
static auto instance = std::make_shared<LinuxApiMock>();
|
||||||
|
|
|
@ -13,7 +13,17 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "LinuxTestImpl.h"
|
#include "LinuxTestImpl.h"
|
||||||
|
#include "GtestUsing.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
|
#include "LinuxApiMock.h"
|
||||||
|
#include "WrapApi.h"
|
||||||
|
#include <bits/types/struct_timeval.h>
|
||||||
|
#include <gmock/gmock-spec-builders.h>
|
||||||
|
#include <memory>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <termios.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
/**
|
/**
|
||||||
* @brief The simulated interface has been subjected to lock serial processing to ensure that the return value can be
|
* @brief The simulated interface has been subjected to lock serial processing to ensure that the return value can be
|
||||||
|
|
|
@ -14,7 +14,10 @@
|
||||||
*/
|
*/
|
||||||
#include "WrapApi.h"
|
#include "WrapApi.h"
|
||||||
#include "LinuxApiMock.h"
|
#include "LinuxApiMock.h"
|
||||||
|
#include <bits/types/struct_timeval.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,14 +13,30 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "McuProtocolTestTool.h"
|
#include "McuProtocolTestTool.h"
|
||||||
|
#include "GtestUsing.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
|
#include "LinuxApiMock.h"
|
||||||
#include "ModBusCRC16.h"
|
#include "ModBusCRC16.h"
|
||||||
#include "ProtocolHandle.h"
|
#include "ProtocolHandle.h"
|
||||||
#include "ProtocolMonitor.h"
|
#include "ProtocolMonitor.h"
|
||||||
|
#include "UartDevice.h"
|
||||||
|
#include "UartDeviceTestTool.h"
|
||||||
|
#include <bits/types/struct_timeval.h>
|
||||||
|
#include <chrono>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <functional>
|
||||||
|
#include <gmock/gmock-spec-builders.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <memory>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
using std::placeholders::_2;
|
using std::placeholders::_2;
|
||||||
using std::placeholders::_3;
|
using std::placeholders::_3;
|
||||||
|
|
|
@ -13,7 +13,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "ProtocolMonitor.h"
|
#include "ProtocolMonitor.h"
|
||||||
|
#include "GtestUsing.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <gmock/gmock-spec-builders.h>
|
||||||
|
#include <memory>
|
||||||
static void PrintHexadecimalData(const void *buf, const size_t &bufLength, const char *log)
|
static void PrintHexadecimalData(const void *buf, const size_t &bufLength, const char *log)
|
||||||
{
|
{
|
||||||
printf("%s { 0x%02X", log, *(unsigned char *)buf);
|
printf("%s { 0x%02X", log, *(unsigned char *)buf);
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
#include "TestManager.h"
|
#include "TestManager.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "MainThread.h"
|
#include "MainThread.h"
|
||||||
|
#include <chrono>
|
||||||
|
#include <mutex>
|
||||||
|
#include <thread>
|
||||||
constexpr int TIMER_SLEEP_MS = 100;
|
constexpr int TIMER_SLEEP_MS = 100;
|
||||||
void TestManager::Init(void)
|
void TestManager::Init(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,8 +13,21 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "UartDeviceTestTool.h"
|
#include "UartDeviceTestTool.h"
|
||||||
|
#include "GtestUsing.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
|
#include "LinuxApiMock.h"
|
||||||
|
#include "UartDevice.h"
|
||||||
|
#include <bits/types/struct_timeval.h>
|
||||||
|
#include <chrono>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <gmock/gmock-spec-builders.h>
|
||||||
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
static size_t WRITE_COUNT = -1;
|
static size_t WRITE_COUNT = -1;
|
||||||
constexpr int INVALID_FD = -1;
|
constexpr int INVALID_FD = -1;
|
||||||
int UartDeviceTestTool::RegisterUartDevice(std::shared_ptr<LinuxTest> &mock, const UartInfo &uart)
|
int UartDeviceTestTool::RegisterUartDevice(std::shared_ptr<LinuxTest> &mock, const UartInfo &uart)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user