squid-
cache.org
Optimising Web Delivery
Docs
Download
Donate
Support
About
Contact
Shop
Blog
src
tests
testURL.cc
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2022 The Squid Software Foundation and contributors
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
9
#include "
squid.h
"
10
11
#include <cppunit/TestAssert.h>
12
13
#include "
anyp/Uri.h
"
14
#include "
debug/Stream.h
"
15
#include "
tests/testURL.h
"
16
#include "
unitTestMain.h
"
17
18
#include <sstream>
19
20
CPPUNIT_TEST_SUITE_REGISTRATION
(
testURL
);
21
22
/* init memory pools */
23
24
void
25
testURL::setUp
()
26
{
27
Mem::Init
();
28
AnyP::UriScheme::Init
();
29
}
30
31
/*
32
* we can construct a URL with a AnyP::UriScheme.
33
* This creates a URL for that scheme.
34
*/
35
void
36
testURL::testConstructScheme
()
37
{
38
AnyP::UriScheme
empty_scheme;
39
AnyP::Uri
protoless_url(
AnyP::PROTO_NONE
);
40
CPPUNIT_ASSERT_EQUAL(empty_scheme, protoless_url.
getScheme
());
41
42
AnyP::UriScheme
ftp_scheme(
AnyP::PROTO_FTP
);
43
AnyP::Uri
ftp_url(
AnyP::PROTO_FTP
);
44
CPPUNIT_ASSERT_EQUAL(ftp_scheme, ftp_url.
getScheme
());
45
}
46
47
/*
48
* a default constructed URL has scheme "NONE".
49
* Also, we should be able to use new and delete on
50
* scheme instances.
51
*/
52
void
53
testURL::testDefaultConstructor
()
54
{
55
AnyP::UriScheme
aScheme;
56
AnyP::Uri
aUrl;
57
CPPUNIT_ASSERT_EQUAL(aScheme, aUrl.
getScheme
());
58
59
auto
*urlPointer =
new
AnyP::Uri
;
60
CPPUNIT_ASSERT(urlPointer !=
NULL
);
61
delete
urlPointer;
62
}
63
AnyP::Uri
Definition:
Uri.h:31
testURL
Definition:
testURL.h:19
AnyP::PROTO_NONE
@ PROTO_NONE
Definition:
ProtocolType.h:24
AnyP::UriScheme
Definition:
UriScheme.h:25
unitTestMain.h
AnyP::Uri::getScheme
AnyP::UriScheme const & getScheme() const
Definition:
Uri.h:67
testURL.h
NULL
#define NULL
Definition:
types.h:166
testURL::testDefaultConstructor
void testDefaultConstructor()
Definition:
testURL.cc:53
AnyP::UriScheme::Init
static void Init()
initializes down-cased protocol scheme names array
Definition:
UriScheme.cc:38
testURL::setUp
void setUp()
Definition:
testURL.cc:25
CPPUNIT_TEST_SUITE_REGISTRATION
CPPUNIT_TEST_SUITE_REGISTRATION(testURL)
testURL::testConstructScheme
void testConstructScheme()
Definition:
testURL.cc:36
AnyP::PROTO_FTP
@ PROTO_FTP
Definition:
ProtocolType.h:26
Uri.h
Stream.h
Mem::Init
void Init()
Definition:
old_api.cc:425
squid.h
Introduction
About Squid
Why Squid?
Squid Developers
How to Donate
How to Help Out
Getting Squid
Squid Source Packages
Squid Deployment Case-Studies
Squid Software Foundation
Documentation
Configuration:
Reference
Examples
FAQ
and
Wiki
Guide Books:
Beginners
Definitive
Non-English
More...
Support
Security Advisories
Bugzilla Database
Mailing lists
Contacting us
Commercial services
Project Sponsors
Squid-based products
Miscellaneous
Developer Resources
Related Writings
Related Software:
Authenticators
Ecap
Icap
Ident
Log Analysis
Monitor
Proxies
Redirectors
General
Squid Artwork
Web Site Translations
Japanese
Mirrors
Website:
gr
il
jp
pl
...
full list
FTP Package Archive