cout << "==============================\n"; cout << "Finish nsICaseConversion Test \n"; cout << "==============================\n";
printf("==============================\n"); printf("Finish nsICaseConversion Test \n"); printf("==============================\n");
void TestCaseConversion(){   cout << "==============================\n";   cout << "Start nsICaseConversion Test \n";   cout << "==============================\n";   nsICaseConversion *t = NULL;   nsresult res;   res = nsServiceManager::GetService(kUnicharUtilCID,                                kCaseConversionIID,                                (nsISupports**) &t);              cout << "Test 1 - GetService():\n";   if(NS_FAILED(res) || ( t == NULL ) ) {     cout << "\t1st GetService failed\n";   } else {     res = nsServiceManager::ReleaseService(kUnicharUtilCID, t);   }   res = nsServiceManager::GetService(kUnicharUtilCID,                                kCaseConversionIID,                                (nsISupports**) &t);              if(NS_FAILED(res) || ( t == NULL ) ) {     cout << "\t2nd GetService failed\n";   } else {     int i;     PRUnichar ch;     PRUnichar buf[256];    cout << "Test 2 - ToUpper(PRUnichar, PRUnichar*):\n";    for(i=0;i < T2LEN ; i++)    {         res = t->ToUpper(t2data[i], &ch);         if(NS_FAILED(res)) {            cout << "\tFailed!! return value != NS_OK\n";            break;         }         if(ch != t2result[i])             cout << "\tFailed!! result unexpected " << i << "\n";     }    cout << "Test 3 - ToLower(PRUnichar, PRUnichar*):\n";    for(i=0;i < T3LEN; i++)    {         res = t->ToLower(t3data[i], &ch);         if(NS_FAILED(res)) {            cout << "\tFailed!! return value != NS_OK\n";            break;         }         if(ch != t3result[i])             cout << "\tFailed!! result unexpected " << i << "\n";     }    cout << "Test 4 - ToTitle(PRUnichar, PRUnichar*):\n";    for(i=0;i < T4LEN; i++)    {         res = t->ToTitle(t4data[i], &ch);         if(NS_FAILED(res)) {            cout << "\tFailed!! return value != NS_OK\n";            break;         }         if(ch != t4result[i])             cout << "\tFailed!! result unexpected " << i << "\n";     }    cout << "Test 5 - ToUpper(PRUnichar*, PRUnichar*, PRUint32):\n";    res = t->ToUpper(t2data, buf, T2LEN);    if(NS_FAILED(res)) {       cout << "\tFailed!! return value != NS_OK\n";    } else {       for(i = 0; i < T2LEN; i++)       {          if(buf[i] != t2result[i])          {            cout << "\tFailed!! result unexpected " << i << "\n";            break;          }       }    }    cout << "Test 6 - ToLower(PRUnichar*, PRUnichar*, PRUint32):\n";    res = t->ToLower(t3data, buf, T3LEN);    if(NS_FAILED(res)) {       cout << "\tFailed!! return value != NS_OK\n";    } else {       for(i = 0; i < T3LEN; i++)       {          if(buf[i] != t3result[i])          {            cout << "\tFailed!! result unexpected " << i << "\n";            break;          }       }    }     cout << "Test 7 - ToTitle(PRUnichar*, PRUnichar*, PRUint32):\n";     cout << "!!! To Be Implemented !!!\n";   res = nsServiceManager::ReleaseService(kUnicharUtilCID, t);   }   cout << "==============================\n";   cout << "Finish nsICaseConversion Test \n";   cout << "==============================\n";}