testURL.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 "Debug.h"
14 #include "testURL.h"
15 #include "unitTestMain.h"
16 #include "URL.h"
17 
18 #include <sstream>
19 
21 
22 /* init memory pools */
23 
24 void
26 {
27  Mem::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
37 {
38  AnyP::UriScheme empty_scheme;
39  URL protoless_url(AnyP::PROTO_NONE);
40  CPPUNIT_ASSERT_EQUAL(empty_scheme, protoless_url.getScheme());
41 
42  AnyP::UriScheme ftp_scheme(AnyP::PROTO_FTP);
43  URL 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
54 {
55  AnyP::UriScheme aScheme;
56  URL aUrl;
57  CPPUNIT_ASSERT_EQUAL(aScheme, aUrl.getScheme());
58 
59  URL *urlPointer = new URL;
60  CPPUNIT_ASSERT(urlPointer != NULL);
61  delete urlPointer;
62 }
63 
Definition: URL.h:24
void Init()
Definition: old_api.cc:412
AnyP::UriScheme const & getScheme() const
Definition: URL.h:58
void setUp()
Definition: testURL.cc:25
void testConstructScheme()
Definition: testURL.cc:36
CPPUNIT_TEST_SUITE_REGISTRATION(testURL)
void testDefaultConstructor()
Definition: testURL.cc:53
static void Init()
initializes down-cased protocol scheme names array
Definition: UriScheme.cc:38
#define NULL
Definition: types.h:166

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors