]> git.ipfire.org Git - thirdparty/squid.git/blame - src/tests/testURL.cc
Parser-NG: Transfer-Encoding:chunked Parser
[thirdparty/squid.git] / src / tests / testURL.cc
CommitLineData
4e0938ef 1/*
bde978a6 2 * Copyright (C) 1996-2015 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
985c86bc 13#include "testURL.h"
7f861c77 14#include "unitTestMain.h"
8dd8e707 15#include "URL.h"
985c86bc 16
27e059d4 17#include <sstream>
27e059d4 18
985c86bc 19CPPUNIT_TEST_SUITE_REGISTRATION( testURL );
20
985c86bc 21/* init memory pools */
22
16555581 23void
24testURL::setUp()
985c86bc 25{
16555581 26 Mem::Init();
27}
985c86bc 28
29/*
1ca54a54 30 * we can construct a URL with a AnyP::UriScheme.
985c86bc 31 * This creates a URL for that scheme.
32 */
33void
34testURL::testConstructScheme()
35{
1ca54a54 36 AnyP::UriScheme empty_scheme;
0c3d3f65 37 URL protoless_url(AnyP::PROTO_NONE);
41030a36 38 CPPUNIT_ASSERT_EQUAL(empty_scheme, protoless_url.getScheme());
39
1ca54a54 40 AnyP::UriScheme ftp_scheme(AnyP::PROTO_FTP);
0c3d3f65 41 URL ftp_url(AnyP::PROTO_FTP);
41030a36 42 CPPUNIT_ASSERT_EQUAL(ftp_scheme, ftp_url.getScheme());
985c86bc 43}
44
45/*
46 * a default constructed URL has scheme "NONE".
47 * Also, we should be able to use new and delete on
48 * scheme instances.
49 */
50void
51testURL::testDefaultConstructor()
52{
1ca54a54 53 AnyP::UriScheme aScheme;
985c86bc 54 URL aUrl;
41030a36 55 CPPUNIT_ASSERT_EQUAL(aScheme, aUrl.getScheme());
985c86bc 56
57 URL *urlPointer = new URL;
58 CPPUNIT_ASSERT(urlPointer != NULL);
59 delete urlPointer;
60}
f53969cc 61