File: accessor_tests.cpp

package info (click to toggle)
cpprest 2.10.19-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,916 kB
  • sloc: cpp: 71,086; sh: 275; makefile: 170; javascript: 147
file content (55 lines) | stat: -rw-r--r-- 1,475 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/***
 * Copyright (C) Microsoft. All rights reserved.
 * Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 *
 * =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
 *
 * constructor_string_tests.cpp
 *
 * Tests for constructors of the uri class
 *
 * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 ****/

#include "stdafx.h"

using namespace web;
using namespace utility;

namespace tests
{
namespace functional
{
namespace uri_tests
{
SUITE(accessor_tests)
{
    TEST(authority_string)
    {
        uri u(U("http://testname.com:81/path?baz"));
        uri a = u.authority();

        VERIFY_ARE_EQUAL(U("/path"), u.path());
        VERIFY_ARE_EQUAL(U("http"), a.scheme());
        VERIFY_ARE_EQUAL(U("testname.com"), a.host());
        VERIFY_ARE_EQUAL(81, a.port());
        VERIFY_ARE_EQUAL(uri(U("http://testname.com:81")), a);
    }

    TEST(authority_wstring)
    {
        uri u(U("http://testname.com:81/path?baz"));
        uri a = u.authority();

        VERIFY_ARE_EQUAL(U("/path"), u.path());
        VERIFY_ARE_EQUAL(U("http"), a.scheme());
        VERIFY_ARE_EQUAL(U("testname.com"), a.host());
        VERIFY_ARE_EQUAL(81, a.port());
        VERIFY_ARE_EQUAL(uri(U("http://testname.com:81")), a);
    }

} // SUITE(accessor_tests)

} // namespace uri_tests
} // namespace functional
} // namespace tests