A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
pcap-test.h
Go to the documentation of this file.
1 #ifndef PCAP_TEST_H
2 #define PCAP_TEST_H
3 
4 #include <sstream>
5 #include <string>
6 #include <stdint.h>
7 #include "pcap-file.h"
8 #include "ns3/test.h"
9 
18 #define NS_PCAP_TEST_EXPECT_EQ(filename) \
19  do { \
20  std::ostringstream oss; \
21  oss << filename; \
22  std::string expected = CreateDataDirFilename (oss.str()); \
23  std::string got = CreateTempDirFilename (oss.str()); \
24  uint32_t sec(0), usec(0); \
25  \
26  bool diff = PcapFile::Diff (got, expected, sec, usec); \
27  NS_TEST_EXPECT_MSG_EQ (diff, false, \
28  "PCAP traces " << got << " and " << expected \
29  << " differ starting from " << sec << " s " \
30  << usec << " us"); \
31  } while (false)
32 
33 
34 #endif /* PCAP_TEST_H */