-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharp.cpp
More file actions
36 lines (31 loc) · 710 Bytes
/
arp.cpp
File metadata and controls
36 lines (31 loc) · 710 Bytes
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
#include <iostream>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
using namespace std;
#include<gtest/gtest.h>
TEST(arp,ShowPlatForm1)
{
FILE *stream = NULL;
char rbuf[4096];
char cbuf[1024];
sprintf(cbuf,"show platform summary 2>&1");
stream = popen(cbuf,"r");
fread(rbuf,sizeof(char),sizeof(rbuf),stream);
char *p = strstr(rbuf,"Platform");
if(p == NULL){
ASSERT_FALSE(1==1);
return;
}
p[strlen("Platform")] = 0;
sprintf(cbuf,"Platform");
ASSERT_STREQ(p,cbuf);
}