%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 188.40.95.74 / Your IP : 216.73.216.142 Web Server : Apache System : Linux cp01.striminghost.net 3.10.0-1160.119.1.el7.tuxcare.els13.x86_64 #1 SMP Fri Nov 22 06:29:45 UTC 2024 x86_64 User : vlasotin ( 1054) PHP Version : 5.6.40 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /opt/cpanel/ea-ruby27/src/passenger-release-6.0.23/test/cxx/StrIntTools/ |
Upload File : |
#include <TestSupport.h> #include <StrIntTools/StrIntUtils.h> using namespace Passenger; using namespace std; namespace tut { struct StrIntTools_StrIntUtilsTest: public TestBase { }; void testTruncate(const char* str, const char *tokens, int maxBetweenTokens, const char* expected) { std::stringstream sstream; truncateBeforeTokens(str, tokens, maxBetweenTokens, sstream); ensure("got [" + sstream.str() + "], expected [" + expected + "]", sstream.str() == expected); } DEFINE_TEST_GROUP(StrIntTools_StrIntUtilsTest); TEST_METHOD(1) { set_test_name("no change should occur"); testTruncate("", "", 0, ""); testTruncate("testwithout/tokens", "", 2, "testwithout/tokens"); testTruncate("", "/", 2, ""); testTruncate("/", "", 2, "/"); testTruncate("/", "/", 2, "/"); testTruncate("hello", "/", 2, "hello"); testTruncate("/hello", "/", 3, "/hello"); } TEST_METHOD(2) { set_test_name("truncation must not touch begin/end token"); testTruncate("hello/", "/", 3, "hel/"); testTruncate("/hello/", "/", 3, "/hel/"); } TEST_METHOD(3) { set_test_name("exact truncation and multiple split tokens"); testTruncate("hello/world/Main.cpp", "/", 2, "he/wo/Main.cpp"); testTruncate("hello/world\\Main.cpp", "/\\", 1, "h/w\\Main.cpp"); testTruncate("hello/world\\Main.cpp", "/", 1, "h/world\\Main.cpp"); testTruncate("/he/llo/worl/", "/", 3, "/he/llo/wor/"); } TEST_METHOD(4) { set_test_name("should ignore non-UTF characters in escapeHTML"); char s[10]; snprintf(s, 10, "h\xeallo"); // hêllo string result = escapeHTML(s); ensure_equals(result, "h?llo"); } }