fixed windows upnp test. added test for is_space
This commit is contained in:
parent
ce4c1ab01b
commit
64d52b26ca
|
@ -50,12 +50,6 @@ namespace libtorrent
|
|||
xml_parse_error
|
||||
};
|
||||
|
||||
inline bool isspace(char c)
|
||||
{
|
||||
const static char* ws = " \t\n\r\f\v";
|
||||
return std::strchr(ws, c);
|
||||
}
|
||||
|
||||
// callback(int type, char const* name, char const* val)
|
||||
// str2 is only used for attributes. name is element or attribute
|
||||
// name and val is attribute value
|
||||
|
|
|
@ -99,7 +99,8 @@ namespace libtorrent
|
|||
|
||||
bool is_space(char c)
|
||||
{
|
||||
return c == ' ' || c == '\t';
|
||||
const static char* ws = " \t\n\r\f\v";
|
||||
return bool(std::strchr(ws, c));
|
||||
}
|
||||
|
||||
char to_lower(char c)
|
||||
|
|
|
@ -68,7 +68,7 @@ upnp::upnp(io_service& ios, connection_queue& cc
|
|||
, m_retry_count(0)
|
||||
, m_io_service(ios)
|
||||
, m_socket(ios, udp::endpoint(address_v4::from_string("239.255.255.250", ec), 1900)
|
||||
, bind(&upnp::on_reply, self(), _1, _2, _3), false)
|
||||
, bind(&upnp::on_reply, self(), _1, _2, _3))
|
||||
, m_broadcast_timer(ios)
|
||||
, m_refresh_timer(ios)
|
||||
, m_disabled(false)
|
||||
|
|
|
@ -638,6 +638,17 @@ int test_main()
|
|||
to_hex(bin, 20, hex);
|
||||
TEST_CHECK(strcmp(hex, str) == 0);
|
||||
|
||||
// test is_space
|
||||
|
||||
TEST_CHECK(!is_space('C'));
|
||||
TEST_CHECK(!is_space('\b'));
|
||||
TEST_CHECK(!is_space('8'));
|
||||
TEST_CHECK(!is_space('='));
|
||||
TEST_CHECK(is_space(' '));
|
||||
TEST_CHECK(is_space('\t'));
|
||||
TEST_CHECK(is_space('\n'));
|
||||
TEST_CHECK(is_space('\r'));
|
||||
|
||||
// test to_lower
|
||||
|
||||
TEST_CHECK(to_lower('C') == 'c');
|
||||
|
|
Loading…
Reference in New Issue