]>
Commit | Line | Data |
---|---|---|
cc192b50 | 1 | #ifndef SQUID_SRC_TEST_URL_H |
2 | #define SQUID_SRC_TEST_URL_H | |
3 | ||
4 | #include <cppunit/extensions/HelperMacros.h> | |
5 | ||
6 | #include "ICMP.h" | |
7 | ||
8 | #if USE_ICMP | |
9 | ||
10 | class stubICMP : public ICMP | |
11 | { | |
12 | public: | |
13 | stubICMP() {}; | |
14 | virtual ~stubICMP() {}; | |
15 | virtual int Open() { return 0; }; | |
16 | virtual void Close() {}; | |
17 | ||
18 | /// Construct ECHO request | |
19 | virtual void SendEcho(IPAddress &to, int opcode, const char *payload, int len) {}; | |
20 | ||
21 | /// Handle ICMP responses. | |
22 | virtual void Recv(void) {}; | |
23 | ||
24 | /* methods to relay test data from tester to private methods being tested */ | |
25 | int testChecksum(unsigned short *ptr, int size) { return CheckSum(ptr,size); }; | |
26 | int testHops(int ttl) { return ipHops(ttl); }; | |
27 | }; | |
28 | ||
29 | #endif /* USE_ICMP */ | |
30 | ||
31 | /** | |
32 | * test the ICMP base class. | |
33 | */ | |
34 | class testICMP : public CPPUNIT_NS::TestFixture | |
35 | { | |
36 | CPPUNIT_TEST_SUITE( testICMP ); | |
37 | #if USE_ICMP | |
38 | CPPUNIT_TEST( testChecksum ); | |
39 | CPPUNIT_TEST( testHops ); | |
40 | #endif /* USE_ICMP */ | |
41 | CPPUNIT_TEST_SUITE_END(); | |
42 | ||
43 | protected: | |
44 | #if USE_ICMP | |
45 | void testChecksum(); | |
46 | void testHops(); | |
47 | #endif /* USE_ICMP */ | |
48 | }; | |
49 | ||
50 | #endif |