mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
* unit-tests
This commit is contained in:
parent
06a1a8690d
commit
a15aad9f9c
5 changed files with 262 additions and 0 deletions
19
tests/test-http-url_decode.cpp
Normal file
19
tests/test-http-url_decode.cpp
Normal file
|
@ -0,0 +1,19 @@
|
|||
#include <cassert>
|
||||
#include "../HTTP.h"
|
||||
|
||||
using namespace i2p::http;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
std::string in("/%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0/");
|
||||
std::string out = UrlDecode(in);
|
||||
|
||||
assert(strcmp(out.c_str(), "/страница/") == 0);
|
||||
|
||||
in = "/%00/";
|
||||
out = UrlDecode(in, false);
|
||||
assert(strcmp(out.c_str(), "/%00/") == 0);
|
||||
out = UrlDecode(in, true);
|
||||
assert(strcmp(out.c_str(), "/\0/") == 0);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue