]> git.ipfire.org Git - thirdparty/squid.git/blame - src/tests/testURL.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / tests / testURL.cc
CommitLineData
4e0938ef 1/*
4ac4a490 2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
4e0938ef
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
f7f3304a 9#include "squid.h"
e1f7507e 10
985c86bc 11#include <cppunit/TestAssert.h>
12
5c51bffb 13#include "Debug.h"
985c86bc 14#include "testURL.h"
7f861c77 15#include "unitTestMain.h"
8dd8e707 16#include "URL.h"
985c86bc 17
27e059d4 18#include <sstream>
27e059d4 19
985c86bc 20CPPUNIT_TEST_SUITE_REGISTRATION( testURL );
21
985c86bc 22/* init memory pools */
23
16555581 24void
25testURL::setUp()
985c86bc 26{
16555581 27 Mem::Init();
28}
985c86bc 29
30/*
1ca54a54 31 * we can construct a URL with a AnyP::UriScheme.
985c86bc 32 * This creates a URL for that scheme.
33 */
34void
35testURL::testConstructScheme()
36{
1ca54a54 37 AnyP::UriScheme empty_scheme;
0c3d3f65 38 URL protoless_url(AnyP::PROTO_NONE);
41030a36 39 CPPUNIT_ASSERT_EQUAL(empty_scheme, protoless_url.getScheme());
40
1ca54a54 41 AnyP::UriScheme ftp_scheme(AnyP::PROTO_FTP);
0c3d3f65 42 URL ftp_url(AnyP::PROTO_FTP);
41030a36 43 CPPUNIT_ASSERT_EQUAL(ftp_scheme, ftp_url.getScheme());
985c86bc 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 */
51void
52testURL::testDefaultConstructor()
53{
1ca54a54 54 AnyP::UriScheme aScheme;
985c86bc 55 URL aUrl;
41030a36 56 CPPUNIT_ASSERT_EQUAL(aScheme, aUrl.getScheme());
985c86bc 57
58 URL *urlPointer = new URL;
59 CPPUNIT_ASSERT(urlPointer != NULL);
60 delete urlPointer;
61}
f53969cc 62