Browse Source

* add test for MergeChunkedResponse() (#432)

pull/509/merge
hagen 9 years ago
parent
commit
8589493581
  1. 3
      tests/Makefile
  2. 25
      tests/test-http-merge_chunked.cpp

3
tests/Makefile

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
CXXFLAGS += -Wall -Wextra -pedantic -O0 -g -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1
TESTS = test-http-url test-http-req test-http-res test-http-url_decode
TESTS = test-http-url test-http-req test-http-res test-http-url_decode \
test-http-merge_chunked
all: $(TESTS) run

25
tests/test-http-merge_chunked.cpp

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
#include <cassert>
#include "../HTTP.h"
using namespace i2p::http;
int main() {
const char *buf =
"4\r\n"
"HTTP\r\n"
"A\r\n"
" response \r\n"
"E\r\n"
"with \r\n"
"chunks.\r\n"
"0\r\n"
"\r\n"
;
std::stringstream in(buf);
std::stringstream out;
assert(MergeChunkedResponse(in, out) == true);
assert(out.str() == "HTTP response with \r\nchunks.");
return 0;
}
Loading…
Cancel
Save