test-http-url_decode.cpp 428 B

1234567891011121314151617181920
  1. #include <cassert>
  2. #include "../HTTP.h"
  3. using namespace i2p::http;
  4. int main() {
  5. std::string in("/%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0/");
  6. std::string out = UrlDecode(in);
  7. assert(strcmp(out.c_str(), "/страница/") == 0);
  8. in = "/%00/";
  9. out = UrlDecode(in, false);
  10. assert(strcmp(out.c_str(), "/%00/") == 0);
  11. out = UrlDecode(in, true);
  12. assert(strcmp(out.c_str(), "/\0/") == 0);
  13. return 0;
  14. }