-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev_info_get_unittest.cpp
More file actions
115 lines (93 loc) · 2.57 KB
/
dev_info_get_unittest.cpp
File metadata and controls
115 lines (93 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//#include "base/test/taf_adapter.h"
//#include "base/test/sys_init.h"
#include "tc_device.h"
#include "util/tc_common.h"
//#include "gtest/gtest.h"
//class DevInfoTest :public testing::Test {
//protected:
// virtual void SetUp() {
// }
// virtual void TearDown() {}
//protected:
//};
using namespace taf;
using namespace std;
int main(int argc, char** argv)
{
//TEST_F(DevInfoTest, DevInfoget){
// SysInit sys;
// sys.InitConsoleLog(L"test");
{
// std::cout << "dev info:" << std::endl;
auto lip = TC_Device::getLIP();
std::cout << "lip:" << lip << std::endl;
// EXPECT_TRUE(!lip.empty());
}
{
// 本地IP列表
auto vec = TC_Device::getLocalHosts();
int i = 0;
for(auto &ip : vec)
{
i++;
cout << i << ":" << ip<< endl;
}
// EXPECT_TRUE(!hosts.empty());
}
{
// 第一激活网卡MAC
auto first_act_mac = TC_Device::getFirstActiveNetCard();
std::cout << "first_act_mac:" << first_act_mac.str_mac_ << std::endl;
// 第一个以太网MAC
auto first_eth_mac = TC_Device::getFristEthernetNetCard();
std::cout << "first_eth_mac:" << first_eth_mac.str_mac_ << std::endl;
// 所有MAC
auto all_mac = TC_Device::getAllNetCard();
cout << "all_net_card:" << endl;
for (auto& item : all_mac)
{
cout << item.first << "| " << item.second.str_ip_ << "| " << item.second.str_mac_ << endl;
}
auto all_physical_mac = TC_Device::getAllPhysicalNetCard();
cout << "all_physical_net_card:" << endl;
for (auto& item: all_physical_mac)
{
cout << item.first << "| " << item.second.str_ip_ << "| " << item.second.str_mac_ << endl;
}
// std::cout << "all_mac:" << taf::TC_Common::tostr(all_mac_str) << std::endl;
}
{
// CPU
auto cpu = TC_Device::getCPU();
std::cout << "cpu:" << cpu << std::endl;
}
// PCN
auto pcn = TC_Device::getPCN();
std::cout << "pcn:" << pcn << std::endl;
// OSV
auto osv = TC_Device::getOSV();
std::cout << "osv:" << osv << std::endl;
// PI
auto pi = TC_Device::getPI();
std::cout << "pi:" << pi << std::endl;
{
// 硬盘序列
auto hd = TC_Device::getHD();
std::cout << "hd.model:" << get<0>(hd) << std::endl;
std::cout << "hd.serial_no:" << get<1>(hd) << std::endl;
}
{
// IMEI:内部是硬盘序列, IMEI是移动端概念
auto imei = TC_Device::getIMEI();
std::cout << "imei:" << imei << std::endl;
}
{
// VOL
auto vol = TC_Device::getVOL();
std::cout << "vol:" << vol << std::endl;
}
auto vendor = TC_Device::getVendor();
std::cout << "vendor:" << vendor << std::endl;
auto model = TC_Device::getModel();
std::cout << "model:" << model << std::endl;
}