void TestUnescapeHelper(const char* in, const char* expected)
{
  nsCString out, strIn(in), strExp(expected);
  nsUrlClassifierUtils utils;
  
  NS_UnescapeURL(strIn.get(), strIn.Length(), esc_AlwaysCopy, out);
  CheckEquals(strExp, out);
}
void TestCanonicalizeHelper(const char* in, const char* expected)
{
  nsCString out, strIn(in), strExp(expected);
  nsUrlClassifierUtils utils;

  utils.CanonicalizePath(strIn, out);
  CheckEquals(strExp, out);
}
void TestEncodeHelper(const char* in, const char* expected)
{
  nsCString out, strIn(in), strExp(expected);
  nsUrlClassifierUtils utils;

  utils.SpecialEncode(strIn, true, out);
  CheckEquals(strExp, out);
}
void TestParseIPAddressHelper(const char *in, const char *expected)
{
  nsCString out, strIn(in), strExp(expected);
  nsUrlClassifierUtils utils;
  utils.Init();

  utils.ParseIPAddress(strIn, out);
  CheckEquals(strExp, out);
}
void TestCanonicalNumHelper(const char *in, PRUint32 bytes,
                            bool allowOctal, const char *expected)
{
  nsCString out, strIn(in), strExp(expected);
  nsUrlClassifierUtils utils;
  utils.Init();

  utils.CanonicalNum(strIn, bytes, allowOctal, out);
  CheckEquals(strExp, out);
}
Esempio n. 6
0
//--> check ip is not null and in the right format (xxx.xxx.xxx.xxx)
//--> no idea how it check whether ip is telecom or not 
bool IpParser::isTelcome(const char *pIp)
{
    if(!pIp)
    {
        return false;
    }
    CStrExplode strExp((char*)pIp,'.');
    if(strExp.GetItemCnt() != 4)
    {
        return false;
    }
    return true;
}