]>
Commit | Line | Data |
---|---|---|
bbc27441 | 1 | /* |
bde978a6 | 2 | * Copyright (C) 1996-2015 The Squid Software Foundation and contributors |
bbc27441 AJ |
3 | * |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
cc192b50 | 9 | #ifndef SQUID_SRC_TEST_URL_H |
10 | #define SQUID_SRC_TEST_URL_H | |
11 | ||
b826ffb5 | 12 | #include "Icmp.h" |
4064ce8f | 13 | #include <cppunit/extensions/HelperMacros.h> |
cc192b50 | 14 | |
15 | #if USE_ICMP | |
16 | ||
b826ffb5 | 17 | class stubIcmp : public Icmp |
cc192b50 | 18 | { |
19 | public: | |
b826ffb5 AJ |
20 | stubIcmp() {}; |
21 | virtual ~stubIcmp() {}; | |
cc192b50 | 22 | virtual int Open() { return 0; }; |
23 | virtual void Close() {}; | |
24 | ||
25 | /// Construct ECHO request | |
b7ac5457 | 26 | virtual void SendEcho(Ip::Address &to, int opcode, const char *payload, int len) {}; |
cc192b50 | 27 | |
28 | /// Handle ICMP responses. | |
29 | virtual void Recv(void) {}; | |
30 | ||
26ac0430 | 31 | /* methods to relay test data from tester to private methods being tested */ |
cc192b50 | 32 | int testChecksum(unsigned short *ptr, int size) { return CheckSum(ptr,size); }; |
33 | int testHops(int ttl) { return ipHops(ttl); }; | |
34 | }; | |
35 | ||
36 | #endif /* USE_ICMP */ | |
37 | ||
38 | /** | |
39 | * test the ICMP base class. | |
40 | */ | |
b826ffb5 | 41 | class testIcmp : public CPPUNIT_NS::TestFixture |
cc192b50 | 42 | { |
b826ffb5 | 43 | CPPUNIT_TEST_SUITE( testIcmp ); |
cc192b50 | 44 | #if USE_ICMP |
45 | CPPUNIT_TEST( testChecksum ); | |
46 | CPPUNIT_TEST( testHops ); | |
47 | #endif /* USE_ICMP */ | |
48 | CPPUNIT_TEST_SUITE_END(); | |
49 | ||
50 | protected: | |
51 | #if USE_ICMP | |
52 | void testChecksum(); | |
53 | void testHops(); | |
54 | #endif /* USE_ICMP */ | |
55 | }; | |
56 | ||
57 | #endif | |
f53969cc | 58 |