Back to index

lightning-sunbird  0.9+nobinonly
UnicharSelfTest.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Pierre Phaneuf <pp@ludusdesign.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 #include <stdio.h>
00039 #include "nsISupports.h"
00040 #include "nsXPCOM.h"
00041 #include "nsIServiceManager.h"
00042 #include "nsIComponentManager.h"
00043 #include "nsICaseConversion.h"
00044 #include "nsIEntityConverter.h"
00045 #include "nsISaveAsCharset.h"
00046 #include "nsIUnicodeEncoder.h"
00047 #include "nsUnicharUtilCIID.h"
00048 #include "nsIPersistentProperties2.h"
00049 #include "nsIURL.h"
00050 #include "nsNetUtil.h"
00051 #include "nsCOMPtr.h"
00052 #include "nsReadableUtils.h"
00053 #include "nsCRT.h"
00054 #include "nsIUnicodeNormalizer.h"
00055 #include "nsString.h"
00056 
00057 NS_DEFINE_CID(kUnicharUtilCID, NS_UNICHARUTIL_CID);
00058 NS_DEFINE_CID(kEntityConverterCID, NS_ENTITYCONVERTER_CID);
00059 NS_DEFINE_CID(kSaveAsCharsetCID, NS_SAVEASCHARSET_CID);
00060 NS_DEFINE_CID(kUnicodeNormalizerCID, NS_UNICODE_NORMALIZER_CID);
00061 
00062 #define TESTLEN 29
00063 #define T2LEN TESTLEN
00064 #define T3LEN TESTLEN
00065 #define T4LEN TESTLEN
00066 
00067 // test data for ToUpper 
00068 static PRUnichar t2data  [T2LEN+1] = {
00069   0x0031 ,  //  0
00070   0x0019 ,  //  1
00071   0x0043 ,  //  2
00072   0x0067 ,  //  3
00073   0x00C8 ,  //  4
00074   0x00E9 ,  //  5
00075   0x0147 ,  //  6
00076   0x01C4 ,  //  7
00077   0x01C6 ,  //  8
00078   0x01C5 ,  //  9
00079   0x03C0 ,  // 10
00080   0x03B2 ,  // 11
00081   0x0438 ,  // 12
00082   0x04A5 ,  // 13
00083   0x05D0 ,  // 14
00084   0x0A20 ,  // 15
00085   0x30B0 ,  // 16
00086   0x5185 ,  // 17
00087   0xC021 ,  // 18
00088   0xFF48 ,  // 19
00089   0x01C7 ,  // 20
00090   0x01C8 ,  // 21
00091   0x01C9 ,  // 22
00092   0x01CA ,  // 23
00093   0x01CB ,  // 24
00094   0x01CC ,  // 25
00095   0x01F1 ,  // 26
00096   0x01F2 ,  // 27
00097   0x01F3 ,  // 28
00098   0x00  
00099 };
00100 // expected result for ToUpper 
00101 static PRUnichar t2result[T2LEN+1] =  {
00102   0x0031 ,  //  0
00103   0x0019 ,  //  1
00104   0x0043 ,  //  2
00105   0x0047 ,  //  3
00106   0x00C8 ,  //  4
00107   0x00C9 ,  //  5
00108   0x0147 ,  //  6
00109   0x01C4 ,  //  7
00110   0x01C4 ,  //  8
00111   0x01C4 ,  //  9
00112   0x03A0 ,  // 10
00113   0x0392 ,  // 11
00114   0x0418 ,  // 12
00115   0x04A4 ,  // 13
00116   0x05D0 ,  // 14
00117   0x0A20 ,  // 15
00118   0x30B0 ,  // 16
00119   0x5185 ,  // 17
00120   0xC021 ,  // 18
00121   0xFF28 ,  // 19
00122   0x01C7 ,  // 20
00123   0x01C7 ,  // 21
00124   0x01C7 ,  // 22
00125   0x01CA ,  // 23
00126   0x01CA ,  // 24
00127   0x01CA ,  // 25
00128   0x01F1 ,  // 26
00129   0x01F1 ,  // 27
00130   0x01F1 ,  // 28
00131   0x00  
00132 };
00133 // test data for ToLower 
00134 static PRUnichar t3data  [T3LEN+1] =  {
00135   0x0031 ,  //  0
00136   0x0019 ,  //  1
00137   0x0043 ,  //  2
00138   0x0067 ,  //  3
00139   0x00C8 ,  //  4
00140   0x00E9 ,  //  5
00141   0x0147 ,  //  6
00142   0x01C4 ,  //  7
00143   0x01C6 ,  //  8
00144   0x01C5 ,  //  9
00145   0x03A0 ,  // 10
00146   0x0392 ,  // 11
00147   0x0418 ,  // 12
00148   0x04A4 ,  // 13
00149   0x05D0 ,  // 14
00150   0x0A20 ,  // 15
00151   0x30B0 ,  // 16
00152   0x5187 ,  // 17
00153   0xC023 ,  // 18
00154   0xFF28 ,  // 19
00155   0x01C7 ,  // 20
00156   0x01C8 ,  // 21
00157   0x01C9 ,  // 22
00158   0x01CA ,  // 23
00159   0x01CB ,  // 24
00160   0x01CC ,  // 25
00161   0x01F1 ,  // 26
00162   0x01F2 ,  // 27
00163   0x01F3 ,  // 28
00164   0x00  
00165 };
00166 // expected result for ToLower 
00167 static PRUnichar t3result[T3LEN+1] =  {
00168   0x0031 ,  //  0
00169   0x0019 ,  //  1
00170   0x0063 ,  //  2
00171   0x0067 ,  //  3
00172   0x00E8 ,  //  4
00173   0x00E9 ,  //  5
00174   0x0148 ,  //  6
00175   0x01C6 ,  //  7
00176   0x01C6 ,  //  8
00177   0x01C6 ,  //  9
00178   0x03C0 ,  // 10
00179   0x03B2 ,  // 11
00180   0x0438 ,  // 12
00181   0x04A5 ,  // 13
00182   0x05D0 ,  // 14
00183   0x0A20 ,  // 15
00184   0x30B0 ,  // 16
00185   0x5187 ,  // 17
00186   0xC023 ,  // 18
00187   0xFF48 ,  // 19
00188   0x01C9 ,  // 20
00189   0x01C9 ,  // 21
00190   0x01C9 ,  // 22
00191   0x01CC ,  // 23
00192   0x01CC ,  // 24
00193   0x01CC ,  // 25
00194   0x01F3 ,  // 26
00195   0x01F3 ,  // 27
00196   0x01F3 ,  // 28
00197   0x00  
00198 };
00199 // test data for ToTitle 
00200 static PRUnichar t4data  [T4LEN+2] =  {
00201   0x0031 ,  //  0
00202   0x0019 ,  //  1
00203   0x0043 ,  //  2
00204   0x0067 ,  //  3
00205   0x00C8 ,  //  4
00206   0x00E9 ,  //  5
00207   0x0147 ,  //  6
00208   0x01C4 ,  //  7
00209   0x01C6 ,  //  8
00210   0x01C5 ,  //  9
00211   0x03C0 ,  // 10
00212   0x03B2 ,  // 11
00213   0x0438 ,  // 12
00214   0x04A5 ,  // 13
00215   0x05D0 ,  // 14
00216   0x0A20 ,  // 15
00217   0x30B0 ,  // 16
00218   0x5189 ,  // 17
00219   0xC013 ,  // 18
00220   0xFF52 ,  // 19
00221   0x01C7 ,  // 20
00222   0x01C8 ,  // 21
00223   0x01C9 ,  // 22
00224   0x01CA ,  // 23
00225   0x01CB ,  // 24
00226   0x01CC ,  // 25
00227   0x01F1 ,  // 26
00228   0x01F2 ,  // 27
00229   0x01F3 ,  // 28
00230   0x0041 ,  // Dummy entry to prevent overflow
00231   0x00  
00232 };
00233 // expected result for ToTitle 
00234 static PRUnichar t4result[T4LEN+2] =  {
00235   0x0031 ,  //  0
00236   0x0019 ,  //  1
00237   0x0043 ,  //  2
00238   0x0047 ,  //  3
00239   0x00C8 ,  //  4
00240   0x00C9 ,  //  5
00241   0x0147 ,  //  6
00242   0x01C4 ,  //  7
00243   0x01C5 ,  //  8
00244   0x01C5 ,  //  9
00245   0x03A0 ,  // 10
00246   0x0392 ,  // 11
00247   0x0418 ,  // 12
00248   0x04A4 ,  // 13
00249   0x05D0 ,  // 14
00250   0x0A20 ,  // 15
00251   0x30B0 ,  // 16
00252   0x5189 ,  // 17
00253   0xC013 ,  // 18
00254   0xFF32 ,  // 19
00255   0x01C7 ,  // 20
00256   0x01C8 ,  // 21
00257   0x01C8 ,  // 22
00258   0x01CA ,  // 23
00259   0x01CB ,  // 24
00260   0x01CB ,  // 25
00261   0x01F1 ,  // 26
00262   0x01F2 ,  // 27
00263   0x01F2 ,  // 28
00264   0x0041 ,  // Dummy entry to prevent overflow
00265   0x00  
00266 };
00267 
00268 void TestCaseConversion()
00269 {
00270    printf("==============================\n");
00271    printf("Start nsICaseConversion Test \n");
00272    printf("==============================\n");
00273    nsICaseConversion *t = NULL;
00274    nsresult res;
00275    res = CallGetService(kUnicharUtilCID, &t);
00276            
00277    printf("Test 1 - GetService():\n");
00278    if(NS_FAILED(res) || ( t == NULL ) ) {
00279      printf("\t1st GetService failed\n");
00280    } else {
00281      NS_RELEASE(t);
00282    }
00283 
00284    res = CallGetService(kUnicharUtilCID, &t);
00285            
00286    if(NS_FAILED(res) || ( t == NULL ) ) {
00287      printf("\t2nd GetService failed\n");
00288    } else {
00289      int i;
00290      PRUnichar ch;
00291      PRUnichar buf[256];
00292 
00293     printf("Test 2 - ToUpper(PRUnichar, PRUnichar*):\n");
00294     for(i=0;i < T2LEN ; i++)
00295     {
00296          res = t->ToUpper(t2data[i], &ch);
00297          if(NS_FAILED(res)) {
00298             printf("\tFailed!! return value != NS_OK\n");
00299             break;
00300          }
00301          if(ch != t2result[i]) 
00302             printf("\tFailed!! result unexpected %d\n", i);
00303      }
00304 
00305 
00306     printf("Test 3 - ToLower(PRUnichar, PRUnichar*):\n");
00307     for(i=0;i < T3LEN; i++)
00308     {
00309          res = t->ToLower(t3data[i], &ch);
00310          if(NS_FAILED(res)) {
00311             printf("\tFailed!! return value != NS_OK\n");
00312             break;
00313          }
00314          if(ch != t3result[i]) 
00315             printf("\tFailed!! result unexpected %d\n", i);
00316      }
00317 
00318 
00319     printf("Test 4 - ToTitle(PRUnichar, PRUnichar*):\n");
00320     for(i=0;i < T4LEN; i++)
00321     {
00322          res = t->ToTitle(t4data[i], &ch);
00323          if(NS_FAILED(res)) {
00324             printf("\tFailed!! return value != NS_OK\n");
00325             break;
00326          }
00327          if(ch != t4result[i]) 
00328             printf("\tFailed!! result unexpected %d\n", i);
00329      }
00330 
00331 
00332     printf("Test 5 - ToUpper(PRUnichar*, PRUnichar*, PRUint32):\n");
00333     res = t->ToUpper(t2data, buf, T2LEN);
00334     if(NS_FAILED(res)) {
00335        printf("\tFailed!! return value != NS_OK\n");
00336     } else {
00337        for(i = 0; i < T2LEN; i++)
00338        {
00339           if(buf[i] != t2result[i])
00340           {
00341             printf("\tFailed!! result unexpected %d\n", i);
00342             break;
00343           }
00344        }
00345     }
00346 
00347     printf("Test 6 - ToLower(PRUnichar*, PRUnichar*, PRUint32):\n");
00348     res = t->ToLower(t3data, buf, T3LEN);
00349     if(NS_FAILED(res)) {
00350        printf("\tFailed!! return value != NS_OK\n");
00351     } else {
00352        for(i = 0; i < T3LEN; i++)
00353        {
00354           if(buf[i] != t3result[i])
00355           {
00356             printf("\tFailed!! result unexpected %d\n", i);
00357             break;
00358           }
00359        }
00360     }
00361 
00362     /* 
00363      * It would be pointless to test ToTitle() with the whole buffer, since
00364      *  the expected result would be that only the first character would be
00365      *  transformed. Instead, pass a series of 2-character buffers starting
00366      *  with each character of the test cases, and check that the first
00367      *  character is transformed as expected and the second remains unchanged
00368      */
00369      printf("Test 7 - ToTitle(PRUnichar*, PRUnichar*, PRUint32):\n");
00370      for (i = 0; i < T4LEN; i++)
00371      {
00372        PRUnichar* titleTest = t4data + i;
00373        res = t->ToTitle(titleTest, buf, 2);
00374        if(NS_FAILED(res)) {
00375          printf("\tFailed!! return value != NS_OK\n");
00376        } else {
00377          if (buf[0] != t4result[i] || buf[1] != t4data[i + 1])
00378          {
00379            printf("\tFailed!! result unexpected %d\n", i);
00380            break;
00381          }
00382        }
00383      }
00384 
00385    NS_RELEASE(t);
00386    }
00387    printf("==============================\n");
00388    printf("Finish nsICaseConversion Test \n");
00389    printf("==============================\n");
00390 
00391 }
00392 
00393 static void TestEntityConversion(PRUint32 version)
00394 {
00395   printf("==============================\n");
00396   printf("Start nsIEntityConverter Test \n");
00397   printf("==============================\n");
00398 
00399   PRUint32 i;
00400   nsString inString;
00401   PRUnichar uChar;
00402   nsresult res;
00403 
00404 
00405   inString.Assign(NS_ConvertASCIItoUCS2("\xA0\xA1\xA2\xA3"));
00406   uChar = (PRUnichar) 8364; //euro
00407   inString.Append(&uChar, 1);
00408   uChar = (PRUnichar) 9830; //
00409   inString.Append(&uChar, 1);
00410 
00411   nsCOMPtr <nsIEntityConverter> entityConv = do_CreateInstance(kEntityConverterCID, &res);;
00412   if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n"); return;}
00413 
00414   // convert char by char
00415   for (i = 0; i < inString.Length(); i++) {
00416     char *entity = NULL;
00417     res = entityConv->ConvertToEntity(inString[i], version, &entity);
00418     if (NS_SUCCEEDED(res) && NULL != entity) {
00419       printf("%c %s\n", inString[i], entity);
00420       nsMemory::Free(entity);
00421     }
00422   }
00423 
00424   // convert at once as a string
00425   PRUnichar *entities;
00426   res = entityConv->ConvertToEntities(inString.get(), version, &entities);
00427   if (NS_SUCCEEDED(res) && NULL != entities) {
00428     for (i = 0; i < nsCRT::strlen(entities); i++) {
00429       printf("%c", (char) entities[i]);
00430       if (';' == (char) entities[i])
00431         printf("\n");
00432     }
00433     nsMemory::Free(entities);
00434   }
00435 
00436   printf("==============================\n");
00437   printf("Finish nsIEntityConverter Test \n");
00438   printf("==============================\n\n");
00439 }
00440 
00441 static void TestSaveAsCharset()
00442 {
00443   printf("==============================\n");
00444   printf("Start nsISaveAsCharset Test \n");
00445   printf("==============================\n");
00446 
00447   nsresult res;
00448 
00449   nsString inString;
00450   inString.Assign(NS_ConvertASCIItoUCS2("\x61\x62\x80\xA0\x63"));
00451   char *outString;
00452   
00453   // first, dump input string
00454   for (PRUint32 i = 0; i < inString.Length(); i++) {
00455     printf("%c ", inString[i]);
00456   }
00457   printf("\n");
00458 
00459   nsCOMPtr <nsISaveAsCharset> saveAsCharset = do_CreateInstance(kSaveAsCharsetCID, &res);
00460   if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00461   
00462   printf("ISO-8859-1 attr_plainTextDefault entityNone\n");
00463   res = saveAsCharset->Init("ISO-8859-1", 
00464                                  nsISaveAsCharset::attr_plainTextDefault, 
00465                                  nsIEntityConverter::entityNone);
00466   if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00467   res = saveAsCharset->Convert(inString.get(), &outString);
00468   if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00469   if (NULL == outString) {printf("\tFailed!! output null\n");}
00470   else {printf("%s\n", outString); nsMemory::Free(outString);}
00471 
00472   printf("ISO-2022-JP attr_plainTextDefault entityNone\n");
00473   res = saveAsCharset->Init("ISO-2022-JP", 
00474                                  nsISaveAsCharset::attr_plainTextDefault,
00475                                  nsIEntityConverter::entityNone);
00476   if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00477   res = saveAsCharset->Convert(inString.get(), &outString);
00478   if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00479   if (NULL == outString) {printf("\tFailed!! output null\n");}
00480   else {printf("%s\n", outString); nsMemory::Free(outString);}
00481   if (NS_ERROR_UENC_NOMAPPING == res) {
00482     outString = ToNewUTF8String(inString);
00483     if (NULL == outString) {printf("\tFailed!! output null\n");}
00484     else {printf("Fall back to UTF-8: %s\n", outString); nsMemory::Free(outString);}
00485   }
00486 
00487   printf("ISO-2022-JP attr_FallbackQuestionMark entityNone\n");
00488   res = saveAsCharset->Init("ISO-2022-JP", 
00489                                  nsISaveAsCharset::attr_FallbackQuestionMark,
00490                                  nsIEntityConverter::entityNone);
00491   if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00492   res = saveAsCharset->Convert(inString.get(), &outString);
00493   if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00494   if (NULL == outString) {printf("\tFailed!! output null\n");}
00495   else {printf("%s\n", outString); nsMemory::Free(outString);}
00496 
00497   printf("ISO-2022-JP attr_FallbackEscapeU entityNone\n");
00498   res = saveAsCharset->Init("ISO-2022-JP", 
00499                                  nsISaveAsCharset::attr_FallbackEscapeU,
00500                                  nsIEntityConverter::entityNone);
00501   if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00502   res = saveAsCharset->Convert(inString.get(), &outString);
00503   if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00504   if (NULL == outString) {printf("\tFailed!! output null\n");}
00505   else {printf("%s\n", outString); nsMemory::Free(outString);}
00506 
00507   printf("ISO-8859-1 attr_htmlTextDefault html40Latin1\n");
00508   res = saveAsCharset->Init("ISO-8859-1", 
00509                                  nsISaveAsCharset::attr_htmlTextDefault, 
00510                                  nsIEntityConverter::html40Latin1);
00511   if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00512   res = saveAsCharset->Convert(inString.get(), &outString);
00513   if (NS_ERROR_UENC_NOMAPPING != res && NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00514   if (NULL == outString) {printf("\tFailed!! output null\n");}
00515   else {printf("%s\n", outString); nsMemory::Free(outString);}
00516 
00517   printf("ISO-8859-1 attr_FallbackHexNCR+attr_EntityAfterCharsetConv html40Latin1 \n");
00518   res = saveAsCharset->Init("ISO-8859-1", 
00519                                  nsISaveAsCharset::attr_FallbackHexNCR + 
00520                                  nsISaveAsCharset::attr_EntityAfterCharsetConv, 
00521                                  nsIEntityConverter::html40Latin1);
00522   if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00523   res = saveAsCharset->Convert(inString.get(), &outString);
00524   if (NS_ERROR_UENC_NOMAPPING != res && NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");}
00525   if (NULL == outString) {printf("\tFailed!! output null\n");}
00526   else {printf("%s\n", outString); nsMemory::Free(outString);}
00527 
00528 
00529   printf("==============================\n");
00530   printf("Finish nsISaveAsCharset Test \n");
00531   printf("==============================\n\n");
00532 }
00533 
00534 static PRUnichar normStr[] = 
00535 {
00536   0x00E1,   
00537   0x0061,
00538   0x0301,
00539   0x0107,
00540   0x0063,
00541   0x0301,
00542   0x0000
00543 };
00544 
00545 static PRUnichar nfdForm[] = 
00546 {
00547   0x0061,
00548   0x0301,
00549   0x0061,
00550   0x0301,
00551   0x0063,
00552   0x0301,
00553   0x0063,
00554   0x0301,
00555   0x0000
00556 };
00557 
00558 void TestNormalization()
00559 {
00560    printf("==============================\n");
00561    printf("Start nsIUnicodeNormalizer Test \n");
00562    printf("==============================\n");
00563    nsIUnicodeNormalizer *t = NULL;
00564    nsresult res;
00565    res = CallGetService(kUnicodeNormalizerCID, &t);
00566            
00567    printf("Test 1 - GetService():\n");
00568    if(NS_FAILED(res) || ( t == NULL ) ) {
00569      printf("\t1st Norm GetService failed\n");
00570    } else {
00571      NS_RELEASE(t);
00572    }
00573 
00574    res = CallGetService(kUnicodeNormalizerCID, &t);
00575            
00576    if(NS_FAILED(res) || ( t == NULL ) ) {
00577      printf("\t2nd GetService failed\n");
00578    } else {
00579     printf("Test 2 - NormalizeUnicode(PRUint32, const nsAString&, nsAString&):\n");
00580     nsAutoString resultStr;
00581     res =  t->NormalizeUnicodeNFD(nsDependentString(normStr), resultStr);
00582     if (resultStr.Equals(nfdForm)) {
00583       printf(" Succeeded in NFD UnicodeNormalizer test. \n");
00584     } else {
00585       printf(" Failed in NFD UnicodeNormalizer test. \n");
00586     }
00587 
00588     NS_RELEASE(t);
00589    }
00590    printf("==============================\n");
00591    printf("Finish nsIUnicodeNormalizer Test \n");
00592    printf("==============================\n");
00593 
00594 }
00595 
00596 
00597 int main(int argc, char** argv) {
00598    
00599    nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
00600    if (NS_FAILED(rv)) {
00601       printf("NS_InitXPCOM2 failed\n");
00602       return 1;
00603    }
00604 
00605    // --------------------------------------------
00606 
00607    TestCaseConversion();
00608 
00609    // --------------------------------------------
00610 
00611    TestEntityConversion(nsIEntityConverter::html40);
00612 
00613    // --------------------------------------------
00614 
00615    TestSaveAsCharset();
00616 
00617    // --------------------------------------------
00618 
00619    TestNormalization();
00620 
00621    // --------------------------------------------
00622    printf("Finish All The Test Cases\n");
00623 
00624    return 0;
00625 }