Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsStringTest2.h File Reference
#include "nsString.h"
#include <time.h>
#include <string>
#include <stdio.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CStringTester

Defines

#define USE_STL
#define USE_WIDE   1
#define stringtype   nsString
#define astringtype   nsAutoString
#define chartype   PRUnichar

Functions

void nsStringTest1 ()
void nsStringTest2 ()
void nsStringTest3 ()
void nsStringTest4 ()
void nsStringTest5 ()
void nsStringTest6 ()
void nsStringTest7 ()
void nsStringTest8 ()
void nsStringTest9 ()
void nsStringTest10 ()
void nsStringTest11 ()
void nsStringTest12 ()
void nsStringTest13 ()
void nsStringTest14 ()
void nsStringTest15 ()
void nsStringTest16 ()
void nsStringTest17 ()
void nsStringTest18 ()
void nsStringTest19 ()
void nsStringTest22 ()
void nsStringTest24 ()
void nsStringTest25 ()
void nsStringTest26 ()
void nsStringTest27 ()
void nsStringTest28 ()
void nsStringTest29 ()
void nsStringTest30 ()
void nsStringTest31 ()
void nsStringTest32 ()
void nsStringTest33 ()
void nsStringTest34 ()
void nsStringTest35 ()
void nsStringTest36 ()
void nsStringTest37 ()
void nsStringTest38 ()
void nsStringTest39 ()
void nsStringTest40 ()
void nsStringTest41 ()
void nsStringTest42 ()
void nsStringTest43 ()

Variables

const double gTicks = 1.0e-7

Define Documentation

Definition at line 34 of file nsStringTest2.h.

Definition at line 35 of file nsStringTest2.h.

Definition at line 33 of file nsStringTest2.h.

Definition at line 24 of file nsStringTest2.h.

#define USE_WIDE   1

Definition at line 31 of file nsStringTest2.h.


Function Documentation

Definition at line 69 of file nsStringTest2.h.

                    {
       PRUnichar test[]={0x0041,0x0051,0x0052,0x0000};
       nsString T(test);
       PRUnichar result[]={0x0051,0x0052,0x0000};
       nsString R(result);
       T.StripChars("ABC");
       NS_ASSERTION(T.Equals(R), "Test 1: Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 155 of file nsStringTest2.h.

                     {
       //test 10: unicode char is not matched or replaced when high-order byte == 0xFF
       
       PRUnichar test[] =  {0xFFc1,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar result[] =  {0xFFc1,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString R(result);
       T.ReplaceChar('A',0x50);
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 166 of file nsStringTest2.h.

                     {
       //test 11: unicode char is correctly replaced when parameter 1 is a string
       
       PRUnichar test[] =  {0x0041,0x0051,0x0052,0x0000};
       nsAutoString T(test);
       PRUnichar result[] = {0x0050,0x0051,0x0052,0x0000};
       nsAutoString R(result);
       T.ReplaceChar("ABC",0x50);
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 176 of file nsStringTest2.h.

                     {
       //test 12: unicode char is not replaced when high-order byte != 0x00
       
       PRUnichar test[] =  {0x4e41,0x0051,0x0052,0x0000};
       nsAutoString T(test);
       PRUnichar result[] =  {0x4e41,0x0051,0x0052,0x0000};
       nsAutoString R(result);
       T.ReplaceChar("ABC",0x50);
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");

}

Here is the caller graph for this function:

Definition at line 187 of file nsStringTest2.h.

                     {
       //test 13: unicode char is not replaced when high-order byte matches char in search string
       PRUnichar test[] =  {0x4150,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar result[] =  {0x4150,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString R(result);
       T.ReplaceChar("ABC",'T');
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");

}

Here is the caller graph for this function:

Definition at line 197 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0xFFc2,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar result[] =  {0xFFc2,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString R(result);
       T.ReplaceChar("ABC",'T');
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 205 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0xFFc2,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar result[] =  {0xFFc2,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString R(result);
       PRUnichar s = 0xc2; //compiler error on this line
       T.ReplaceChar(s,'T');
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 215 of file nsStringTest2.h.

                     {
       /* TESTS for ReplaceSubstring()*/
       
       PRUnichar test[] =  {0x0041,0x0042,0x0043,0x0044,0x0045,0x0000};
       nsAutoString T(test);
    PRUnichar result[] = {0x0044,0x0045,0x0046,0x0044,0x0045};
       nsAutoString R(result);
       T.ReplaceSubstring("ABC","DEF");
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");

}

Here is the caller graph for this function:

Definition at line 226 of file nsStringTest2.h.

                     {

       PRUnichar test[] =  {0x0041,0x4e42,0x0043,0x0044,0x0045,0x0000};
       nsAutoString T(test);
       PRUnichar result[] =  {0x0041,0x4e42,0x0043,0x0044,0x0045,0x0000};
       nsAutoString R(result);
       T.ReplaceSubstring("ABC","DEF");
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 235 of file nsStringTest2.h.

                     {
        /*TESTS for Trim()*/

       PRUnichar test[] =  {0x0041,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
    PRUnichar result[] = {0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString R (result);
       T.Trim("ABC");
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 245 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0x4e41,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar result[] =  {0x4e41,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString R(result);
       T.Trim("ABC");
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 78 of file nsStringTest2.h.

                    {
       PRUnichar test[]={0x4e41,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar result[]={0x4e41,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString R(result);
       T.StripChars("ABC");
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 253 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0x4e51,0x4e52,0x4e53,0x4e41,0x0000};
       nsAutoString T(test);
       PRUnichar result[] =  {0x4e51,0x4e52,0x4e53,0x4e41,0x0000};
       nsAutoString R(result);
       T.Trim("ABC");
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");

}

Here is the caller graph for this function:

Definition at line 271 of file nsStringTest2.h.

                     {
       /*TESTS for Find()*/
       PRUnichar test[] =  {0x0041,0x0042,0x0043,0x0051,0x0052,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.Find("ABC") == 0, "Unicode comparison error");

}

Here is the caller graph for this function:

Definition at line 278 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0x4e41,0x4e42,0x4e43,0x4e53,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.Find("ABC") == -1, "Unicode comparison error");

}

Here is the caller graph for this function:

Definition at line 284 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0xFFc1,0x0051,0x0052,0x0053,0x0000};
       nsAutoString T(test);
       PRUnichar str[] = {0xc1,0x51,0x52};
       nsAutoString S(str);
       NS_ASSERTION(T.Find(S) == -1, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 291 of file nsStringTest2.h.

                     {
    /*TESTS for FindChar()*/
  
       PRUnichar test[] =  {0x0041,0x0051,0x0052,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.FindChar('A') == 0, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 298 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0x4e41,0x4e42,0x4e43,0x4e53,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.FindChar('A') == -1, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 303 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0xFFc1,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.FindChar(0xc1) == -1, "Unicode comparison error");

}

Here is the caller graph for this function:

Definition at line 87 of file nsStringTest2.h.

                    {

       PRUnichar test[] =  {0xFF41,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar result[] =  {0xFF41,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString R(test);
       T.StripChars("ABC");
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 309 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0x4132,0x0051,0x0052,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.FindChar('A1') == -1, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 315 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0x0041,0x0051,0x0052,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.FindCharInSet("ABC") == 0, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 320 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0x4e41,0x4e42,0x4e43,0x4e53,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.FindCharInSet("ABC") == -1, "Unicode comparison error");
       
}

Here is the caller graph for this function:

Definition at line 326 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0xFFc1,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar str[] = {0xc1,0x51,0x52};
       nsAutoString s(str);
       NS_ASSERTION(T.FindCharInSet(s) == -1, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 333 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0x4132,0x5132,0x5232,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.FindCharInSet("ABC") == -1, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 339 of file nsStringTest2.h.

                     {

       PRUnichar test[] =  {0x0051,0x0052,0x0041,0x0042,0x0043,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.RFind("ABC") == 2, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 345 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0x4e41,0x4e42,0x4e43,0x4e53,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.RFind("ABC") == -1, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 350 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0xFFc1,0xFFc2,0xFFc3,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar str[] = {0xc1,0xc2,0xc3};
       nsAutoString s(str); 
       NS_ASSERTION(T.RFind(s) == -1, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 358 of file nsStringTest2.h.

                     {

       PRUnichar test[] =  {0x0041,0x0042,0x0043,0x0000};
       nsAutoString T(test);
       int res = T.RFindCharInSet("ABC");
       NS_ASSERTION(res==0, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 365 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0x4e41,0x4e42,0x4e43,0x4e53,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.RFindCharInSet("ABC") == -1, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 96 of file nsStringTest2.h.

                    {
       //test 4: unicode char is matched and stripped correctly using StripChar()
       PRUnichar test[] =  {0x0041,0x0051,0x0052,0x0000};
       nsAutoString T(test);
       PRUnichar result[] = {0x0051,0x0052,0x0000};
       nsAutoString R(result);
       T.StripChar('A');
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 370 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0xFFc1,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar str[] = {0xc1,0xc2,0xc3};
       nsAutoString s(str); 
       NS_ASSERTION(T.RFindCharInSet(s) == -1, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 377 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0x4132,0x0051,0x0052,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.RFindCharInSet("ABC") == -1, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 383 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0x0041,0x0042,0x0043,0x0000};
       nsAutoString T(test);
       NS_ASSERTION(T.Compare("ABC") == 0, "Unicode comparison error");
}                              

Here is the caller graph for this function:

Definition at line 388 of file nsStringTest2.h.

                     {
       PRUnichar test[] =  {0xc341,0xc342,0xc343};
       nsAutoString T(test);
       NS_ASSERTION(T.Compare("ABC") == 1, "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 105 of file nsStringTest2.h.

                    {
       //test 5: unicode char is not matched and stripped when high-order byte is not 0x00

       PRUnichar test[]={0x4e41,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar result[]={0x4e41,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString R(result);
       T.StripChar('A');
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 115 of file nsStringTest2.h.

                    {
       //test 6: unicode char is not matched and stripped when high-order byte is 0xFF

       PRUnichar test[] =  {0xFF41,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar result[] =  {0xFF41,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString R(result);
       T.StripChar('A');
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 125 of file nsStringTest2.h.

                    {
       //test 7: unicode char is matched and replaced correctly using ReplaceChar()
       
       PRUnichar test[] =  {0x0041,0x0051,0x0052,0x0000};
       nsAutoString T(test);
       PRUnichar result[] = {0x0050,0x0051,0x0052,0x0000};
       nsAutoString R(result);
       T.ReplaceChar('A',0x50);
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 135 of file nsStringTest2.h.

                    {
       //test 8: unicode char is not matched or replaced when high-order byte != 0x00
       
       PRUnichar test[] =  {0x4e41,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar result[] =  {0x4e41,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString R(result);
       T.ReplaceChar('A',0x50);
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:

Definition at line 145 of file nsStringTest2.h.

                    {
       //test 9: unicode char is not matched or replaced when high-order byte matches search char
       
       PRUnichar test[] =  {0x4150,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString T(test);
       PRUnichar result[] =  {0x4150,0x4e51,0x4e52,0x4e53,0x0000};
       nsAutoString R(result);
       T.ReplaceChar('A',0x50);
       NS_ASSERTION(T.Equals(R), "Unicode comparison error");
}

Here is the caller graph for this function:


Variable Documentation

const double gTicks = 1.0e-7

Definition at line 43 of file nsStringTest2.h.