Browse Source

* fix tests

pull/551/head
hagen 9 years ago
parent
commit
a973630cb4
  1. 5
      tests/test-http-req.cpp

5
tests/test-http-req.cpp

@ -22,7 +22,6 @@ int main() {
assert(req->version == "HTTP/1.0"); assert(req->version == "HTTP/1.0");
assert(req->method == "GET"); assert(req->method == "GET");
assert(req->uri == "/"); assert(req->uri == "/");
assert(req->host == "inr.i2p");
assert(req->headers.size() == 3); assert(req->headers.size() == 3);
assert(req->headers.count("Host") == 1); assert(req->headers.count("Host") == 1);
assert(req->headers.count("Accept") == 1); assert(req->headers.count("Accept") == 1);
@ -42,7 +41,6 @@ int main() {
assert(req->version == "HTTP/1.0"); assert(req->version == "HTTP/1.0");
assert(req->method == "GET"); assert(req->method == "GET");
assert(req->uri == "/"); assert(req->uri == "/");
assert(req->host == "");
assert(req->headers.size() == 0); assert(req->headers.size() == 0);
delete req; delete req;
@ -52,7 +50,7 @@ int main() {
"\r\n"; "\r\n";
len = strlen(buf); len = strlen(buf);
req = new HTTPReq; req = new HTTPReq;
assert((ret = req->parse(buf, len)) == -1); /* no host header */ assert((ret = req->parse(buf, len)) > 0);
delete req; delete req;
/* test: parsing incomplete request */ /* test: parsing incomplete request */
@ -76,7 +74,6 @@ int main() {
assert((ret = req->parse(buf, len)) == len); /* no host header */ assert((ret = req->parse(buf, len)) == len); /* no host header */
assert(req->method == "GET"); assert(req->method == "GET");
assert(req->uri == "http://inr.i2p"); assert(req->uri == "http://inr.i2p");
assert(req->host == "stats.i2p");
assert(req->headers.size() == 3); assert(req->headers.size() == 3);
assert(req->headers.count("Host") == 1); assert(req->headers.count("Host") == 1);
assert(req->headers.count("Accept") == 1); assert(req->headers.count("Accept") == 1);

Loading…
Cancel
Save