#include <boost/test/unit_test.hpp>
#include <iostream>
#include <string>
#include <websocketpp/uri.hpp>
Go to the source code of this file.
◆ BOOST_TEST_MODULE
#define BOOST_TEST_MODULE uri |
◆ BOOST_AUTO_TEST_CASE() [1/20]
BOOST_AUTO_TEST_CASE |
( |
uri_http_scheme | | ) |
|
Definition at line 125 of file uri.cpp.
125 {
127
128 BOOST_CHECK( uri.get_valid() );
129 BOOST_CHECK( !uri.get_secure() );
130 BOOST_CHECK_EQUAL( uri.get_scheme(), "http");
131 BOOST_CHECK_EQUAL( uri.get_host(), "localhost");
132 BOOST_CHECK_EQUAL( uri.get_port(), 9000 );
133 BOOST_CHECK_EQUAL( uri.get_resource(), "/chat" );
134}
◆ BOOST_AUTO_TEST_CASE() [2/20]
BOOST_AUTO_TEST_CASE |
( |
uri_invalid_bad_v6_literal_1 | | ) |
|
Definition at line 182 of file uri.cpp.
182 {
184
185 BOOST_CHECK( !uri.get_valid() );
186}
◆ BOOST_AUTO_TEST_CASE() [3/20]
BOOST_AUTO_TEST_CASE |
( |
uri_invalid_bad_v6_literal_2 | | ) |
|
Definition at line 189 of file uri.cpp.
189 {
191
192 BOOST_CHECK( !uri.get_valid() );
193}
◆ BOOST_AUTO_TEST_CASE() [4/20]
BOOST_AUTO_TEST_CASE |
( |
uri_invalid_fragment | | ) |
|
Definition at line 175 of file uri.cpp.
175 {
177
178 BOOST_CHECK( !uri.get_valid() );
179}
◆ BOOST_AUTO_TEST_CASE() [5/20]
BOOST_AUTO_TEST_CASE |
( |
uri_invalid_gt_16_bit_port | | ) |
|
Definition at line 168 of file uri.cpp.
168 {
170
171 BOOST_CHECK( !uri.get_valid() );
172}
◆ BOOST_AUTO_TEST_CASE() [6/20]
BOOST_AUTO_TEST_CASE |
( |
uri_invalid_long_port | | ) |
|
Definition at line 111 of file uri.cpp.
111 {
113
114 BOOST_CHECK( !uri.get_valid() );
115}
◆ BOOST_AUTO_TEST_CASE() [7/20]
BOOST_AUTO_TEST_CASE |
( |
uri_invalid_method_separator | | ) |
|
Definition at line 161 of file uri.cpp.
161 {
163
164 BOOST_CHECK( !uri.get_valid() );
165}
◆ BOOST_AUTO_TEST_CASE() [8/20]
BOOST_AUTO_TEST_CASE |
( |
uri_invalid_no_scheme | | ) |
|
Definition at line 233 of file uri.cpp.
233 {
235
236 BOOST_CHECK( !uri.get_valid() );
237}
◆ BOOST_AUTO_TEST_CASE() [9/20]
BOOST_AUTO_TEST_CASE |
( |
uri_invalid_scheme | | ) |
|
Definition at line 118 of file uri.cpp.
118 {
120
121 BOOST_CHECK( !uri.get_valid() );
122}
◆ BOOST_AUTO_TEST_CASE() [10/20]
BOOST_AUTO_TEST_CASE |
( |
uri_valid | | ) |
|
Definition at line 37 of file uri.cpp.
37 {
39
40 BOOST_CHECK( uri.get_valid() );
41 BOOST_CHECK( !uri.get_secure() );
42 BOOST_CHECK_EQUAL( uri.get_scheme(), "ws");
43 BOOST_CHECK_EQUAL( uri.get_host(), "localhost");
44 BOOST_CHECK_EQUAL( uri.get_port(), 9000 );
45 BOOST_CHECK_EQUAL( uri.get_resource(), "/chat" );
46 BOOST_CHECK_EQUAL( uri.get_query(), "" );
47}
◆ BOOST_AUTO_TEST_CASE() [11/20]
BOOST_AUTO_TEST_CASE |
( |
uri_valid_2 | | ) |
|
Definition at line 98 of file uri.cpp.
98 {
100
101 BOOST_CHECK( uri.get_valid() );
102 BOOST_CHECK( uri.get_secure() );
103 BOOST_CHECK_EQUAL( uri.get_scheme(), "wss");
104 BOOST_CHECK_EQUAL( uri.get_host(), "thor-websocket.zaphoyd.net");
105 BOOST_CHECK_EQUAL( uri.get_port(), 88 );
106 BOOST_CHECK_EQUAL( uri.get_resource(), "/" );
107}
◆ BOOST_AUTO_TEST_CASE() [12/20]
BOOST_AUTO_TEST_CASE |
( |
uri_valid_3 | | ) |
|
Definition at line 149 of file uri.cpp.
149 {
151
152 BOOST_CHECK( uri.get_valid() );
153 BOOST_CHECK( uri.get_secure() );
154 BOOST_CHECK_EQUAL( uri.get_scheme(), "wss");
155 BOOST_CHECK_EQUAL( uri.get_host(), "localhost");
156 BOOST_CHECK_EQUAL( uri.get_port(), 9000 );
157 BOOST_CHECK_EQUAL( uri.get_resource(), "/chat/foo/bar" );
158}
◆ BOOST_AUTO_TEST_CASE() [13/20]
BOOST_AUTO_TEST_CASE |
( |
uri_valid_4 | | ) |
|
Definition at line 196 of file uri.cpp.
196 {
198
199 BOOST_CHECK( uri.get_valid() );
200 BOOST_CHECK( uri.get_secure() );
201 BOOST_CHECK_EQUAL( uri.get_scheme(), "wss" );
202 BOOST_CHECK_EQUAL( uri.get_host(), "localhost");
203 BOOST_CHECK_EQUAL( uri.get_port(), 9000 );
204 BOOST_CHECK_EQUAL( uri.get_resource(), "/chat/foo/bar?foo=bar" );
205 BOOST_CHECK_EQUAL( uri.get_query(), "foo=bar" );
206}
◆ BOOST_AUTO_TEST_CASE() [14/20]
BOOST_AUTO_TEST_CASE |
( |
uri_valid_ipv4_literal | | ) |
|
Definition at line 137 of file uri.cpp.
137 {
139
140 BOOST_CHECK( uri.get_valid() );
141 BOOST_CHECK( uri.get_secure() );
142 BOOST_CHECK_EQUAL( uri.get_scheme(), "wss");
143 BOOST_CHECK_EQUAL( uri.get_host(), "127.0.0.1");
144 BOOST_CHECK_EQUAL( uri.get_port(), 9000 );
145 BOOST_CHECK_EQUAL( uri.get_resource(), "/chat" );
146}
◆ BOOST_AUTO_TEST_CASE() [15/20]
BOOST_AUTO_TEST_CASE |
( |
uri_valid_ipv6_literal | | ) |
|
Definition at line 86 of file uri.cpp.
86 {
88
89 BOOST_CHECK( uri.get_valid() );
90 BOOST_CHECK( uri.get_secure() );
91 BOOST_CHECK_EQUAL( uri.get_scheme(), "wss");
92 BOOST_CHECK_EQUAL( uri.get_host(), "::1");
93 BOOST_CHECK_EQUAL( uri.get_port(), 9000 );
94 BOOST_CHECK_EQUAL( uri.get_resource(), "/chat" );
95}
◆ BOOST_AUTO_TEST_CASE() [16/20]
BOOST_AUTO_TEST_CASE |
( |
uri_valid_no_port_secure | | ) |
|
Definition at line 62 of file uri.cpp.
62 {
64
65 BOOST_CHECK( uri.get_valid() );
66 BOOST_CHECK( uri.get_secure() );
67 BOOST_CHECK_EQUAL( uri.get_scheme(), "wss");
68 BOOST_CHECK_EQUAL( uri.get_host(), "localhost");
69 BOOST_CHECK_EQUAL( uri.get_port(), 443 );
70 BOOST_CHECK_EQUAL( uri.get_resource(), "/chat" );
71}
◆ BOOST_AUTO_TEST_CASE() [17/20]
BOOST_AUTO_TEST_CASE |
( |
uri_valid_no_port_unsecure | | ) |
|
Definition at line 50 of file uri.cpp.
50 {
52
53 BOOST_CHECK( uri.get_valid() );
54 BOOST_CHECK( !uri.get_secure() );
55 BOOST_CHECK_EQUAL( uri.get_scheme(), "ws");
56 BOOST_CHECK_EQUAL( uri.get_host(), "localhost");
57 BOOST_CHECK_EQUAL( uri.get_port(), 80 );
58 BOOST_CHECK_EQUAL( uri.get_resource(), "/chat" );
59}
◆ BOOST_AUTO_TEST_CASE() [18/20]
BOOST_AUTO_TEST_CASE |
( |
uri_valid_no_resource | | ) |
|
Definition at line 74 of file uri.cpp.
74 {
76
77 BOOST_CHECK( uri.get_valid() );
78 BOOST_CHECK( uri.get_secure() );
79 BOOST_CHECK_EQUAL( uri.get_scheme(), "wss");
80 BOOST_CHECK_EQUAL( uri.get_host(), "localhost");
81 BOOST_CHECK_EQUAL( uri.get_port(), 9000 );
82 BOOST_CHECK_EQUAL( uri.get_resource(), "/" );
83}
◆ BOOST_AUTO_TEST_CASE() [19/20]
BOOST_AUTO_TEST_CASE |
( |
uri_valid_v4_mapped | | ) |
|
Definition at line 209 of file uri.cpp.
209 {
210 websocketpp::uri uri(
"wss://[0000:0000:0000:0000:0000:0000:192.168.1.1]:9000/");
211
212 BOOST_CHECK( uri.get_valid() );
213 BOOST_CHECK( uri.get_secure() );
214 BOOST_CHECK_EQUAL( uri.get_scheme(), "wss" );
215 BOOST_CHECK_EQUAL( uri.get_host(), "0000:0000:0000:0000:0000:0000:192.168.1.1");
216 BOOST_CHECK_EQUAL( uri.get_port(), 9000 );
217 BOOST_CHECK_EQUAL( uri.get_resource(), "/" );
218}
◆ BOOST_AUTO_TEST_CASE() [20/20]
BOOST_AUTO_TEST_CASE |
( |
uri_valid_v6_mixed_case | | ) |
|
Definition at line 221 of file uri.cpp.
221 {
223
224 BOOST_CHECK( uri.get_valid() == true );
225 BOOST_CHECK( uri.get_secure() == true );
226 BOOST_CHECK_EQUAL( uri.get_scheme(), "wss" );
227 BOOST_CHECK_EQUAL( uri.get_host(), "::10aB");
228 BOOST_CHECK_EQUAL( uri.get_port(), 9000 );
229 BOOST_CHECK_EQUAL( uri.get_resource(), "/" );
230}