]> git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/testURL.cc
C++11: Remove GnuRegex and all -lregex related code
[thirdparty/squid.git] / src / tests / testURL.cc
1 /*
2 * Copyright (C) 1996-2016 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
20 CPPUNIT_TEST_SUITE_REGISTRATION( testURL );
21
22 /* init memory pools */
23
24 void
25 testURL::setUp()
26 {
27 Mem::Init();
28 }
29
30 /*
31 * we can construct a URL with a AnyP::UriScheme.
32 * This creates a URL for that scheme.
33 */
34 void
35 testURL::testConstructScheme()
36 {
37 AnyP::UriScheme empty_scheme;
38 URL protoless_url(AnyP::PROTO_NONE);
39 CPPUNIT_ASSERT_EQUAL(empty_scheme, protoless_url.getScheme());
40
41 AnyP::UriScheme ftp_scheme(AnyP::PROTO_FTP);
42 URL ftp_url(AnyP::PROTO_FTP);
43 CPPUNIT_ASSERT_EQUAL(ftp_scheme, ftp_url.getScheme());
44 }
45
46 /*
47 * a default constructed URL has scheme "NONE".
48 * Also, we should be able to use new and delete on
49 * scheme instances.
50 */
51 void
52 testURL::testDefaultConstructor()
53 {
54 AnyP::UriScheme aScheme;
55 URL aUrl;
56 CPPUNIT_ASSERT_EQUAL(aScheme, aUrl.getScheme());
57
58 URL *urlPointer = new URL;
59 CPPUNIT_ASSERT(urlPointer != NULL);
60 delete urlPointer;
61 }
62