-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhardcodedsettingtest.cpp
40 lines (32 loc) · 1.71 KB
/
hardcodedsettingtest.cpp
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
#include "hardcodedsettingtest.h"
#include "proxyparser.h"
#include <string>
using namespace std;
void HardcodedSettingTestCase::testProxy(void)
{
CPPUNIT_ASSERT( true );
}
void HardcodedSettingTestCase::compareHostToBypass()
{
CPPUNIT_ASSERT( ProxyParser::testHostForBypass("www.loginpeople.com", "www.loginpeople.com") );
CPPUNIT_ASSERT( ProxyParser::testHostForBypass("www.loginpeople.com", "*.loginpeople.com") );
CPPUNIT_ASSERT( !ProxyParser::testHostForBypass("www.loginpeople.com", "loginpeople.com") );
CPPUNIT_ASSERT( !ProxyParser::testHostForBypass("loginpeople", "*.loginpeople.com") );
CPPUNIT_ASSERT( !ProxyParser::testHostForBypass("www.loginpeople.com", "<local>") );
CPPUNIT_ASSERT( ProxyParser::testHostForBypass("loginpeople", "<local>") );
CPPUNIT_ASSERT( !ProxyParser::testHostForBypass("www.loginpeople.com", "172.16.0.1") );
CPPUNIT_ASSERT( ProxyParser::testHostForBypass("www.loginpeople.com", "46.105.101.154") );
//test for hosts with multiple IPs
//FIXME: find another server than www.google.com, it changes too much
//CPPUNIT_ASSERT( ProxyParser::testHostForBypass("www.google.com", "74.125.230.148") );
}
void HardcodedSettingTestCase::compareIpToBypass()
{
CPPUNIT_ASSERT( ProxyParser::testIpForBypass("172.16.0.1", "172.16.0.1") );
CPPUNIT_ASSERT( ProxyParser::testIpForBypass("172.16.0.1", "172.16.0.*") );
CPPUNIT_ASSERT( ProxyParser::testIpForBypass("172.16.0.1", "172.16.*.*") );
CPPUNIT_ASSERT( ProxyParser::testIpForBypass("172.16.0.1", "172.16.*.1") );
CPPUNIT_ASSERT( ProxyParser::testIpForBypass("172.16.0.1", "*.*.*.1" ) );
CPPUNIT_ASSERT( ProxyParser::testIpForBypass("172.16.0.1", "172.16.*" ) );
CPPUNIT_ASSERT( ProxyParser::testIpForBypass("172.16.0.1", "172.16*" ) );
}