diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-02 21:01:38 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-02 21:01:38 +0100 |
commit | f7d30133221896638f7bf4f66c504255c4b14f48 (patch) | |
tree | 5f3e07a049f388a3a309a615b8884318f6668a98 /nsprpub/lib/tests/string.c | |
parent | 26b297510a11758727438df4669357a2a2bc42ce (diff) | |
download | UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.gz UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.lz UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.xz UXP-f7d30133221896638f7bf4f66c504255c4b14f48.zip |
Issue #1338 - Part 1: Update NSPR to 4.24
Diffstat (limited to 'nsprpub/lib/tests/string.c')
-rw-r--r-- | nsprpub/lib/tests/string.c | 2734 |
1 files changed, 1389 insertions, 1345 deletions
diff --git a/nsprpub/lib/tests/string.c b/nsprpub/lib/tests/string.c index 7e15d3991..7765d12dc 100644 --- a/nsprpub/lib/tests/string.c +++ b/nsprpub/lib/tests/string.c @@ -16,13 +16,13 @@ PRBool test_001(void) const char *str; PRUint32 len; } array[] = - { - { (const char *)0, 0 }, - { "", 0 }, - { "a", 1 }, - { "abcdefg", 7 }, - { "abcdefg\0hijk", 7 } - }; + { + { (const char *)0, 0 }, + { "", 0 }, + { "a", 1 }, + { "abcdefg", 7 }, + { "abcdefg\0hijk", 7 } + }; int i; @@ -32,7 +32,7 @@ PRBool test_001(void) { if( PL_strlen(array[i].str) != array[i].len ) { - printf("FAIL (%d: %s->%d, %d)\n", i, + printf("FAIL (%d: %s->%d, %d)\n", i, array[i].str ? array[i].str : "(null)", PL_strlen(array[i].str), array[i].len); return PR_FALSE; @@ -52,23 +52,23 @@ PRBool test_002(void) PRUint32 max; PRUint32 len; } array[] = - { - { (const char *)0, 0, 0 }, - { (const char *)0, 12, 0 }, - { "", 0, 0 }, - { "", 12, 0 }, - { "a", 0, 0 }, - { "a", 1, 1 }, - { "a", 12, 1 }, - { "abcdefg", 0, 0 }, - { "abcdefg", 1, 1 }, - { "abcdefg", 7, 7 }, - { "abcdefg", 12, 7 }, - { "abcdefg\0hijk", 0, 0 }, - { "abcdefg\0hijk", 1, 1 }, - { "abcdefg\0hijk", 7, 7 }, - { "abcdefg\0hijk", 12, 7 }, - }; + { + { (const char *)0, 0, 0 }, + { (const char *)0, 12, 0 }, + { "", 0, 0 }, + { "", 12, 0 }, + { "a", 0, 0 }, + { "a", 1, 1 }, + { "a", 12, 1 }, + { "abcdefg", 0, 0 }, + { "abcdefg", 1, 1 }, + { "abcdefg", 7, 7 }, + { "abcdefg", 12, 7 }, + { "abcdefg\0hijk", 0, 0 }, + { "abcdefg\0hijk", 1, 1 }, + { "abcdefg\0hijk", 7, 7 }, + { "abcdefg\0hijk", 12, 7 }, + }; int i; @@ -101,18 +101,18 @@ PRBool test_003(void) char *rv; PRBool comp; } array[] = - { - { (const char *)0, (char *)0, (char *)0, PR_FALSE }, - { (const char *)0, buffer, (char *)0, PR_FALSE }, - { "", (char *)0, (char *)0, PR_FALSE }, - { "", buffer, buffer, PR_TRUE }, - { "a", (char *)0, (char *)0, PR_FALSE }, - { "a", buffer, buffer, PR_TRUE }, - { "abcdefg", (char *)0, (char *)0, PR_FALSE }, - { "abcdefg", buffer, buffer, PR_TRUE }, - { "wxyz\0abcdefg", (char *)0, (char *)0, PR_FALSE }, - { "wxyz\0abcdefg", buffer, buffer, PR_TRUE } - }; + { + { (const char *)0, (char *)0, (char *)0, PR_FALSE }, + { (const char *)0, buffer, (char *)0, PR_FALSE }, + { "", (char *)0, (char *)0, PR_FALSE }, + { "", buffer, buffer, PR_TRUE }, + { "a", (char *)0, (char *)0, PR_FALSE }, + { "a", buffer, buffer, PR_TRUE }, + { "abcdefg", (char *)0, (char *)0, PR_FALSE }, + { "abcdefg", buffer, buffer, PR_TRUE }, + { "wxyz\0abcdefg", (char *)0, (char *)0, PR_FALSE }, + { "wxyz\0abcdefg", buffer, buffer, PR_TRUE } + }; int i; @@ -138,13 +138,15 @@ PRBool test_003(void) { if( *a != *b ) { - printf("FAIL %d: %s->%.32s\n", i, - array[i].str ? array[i].str : "(null)", + printf("FAIL %d: %s->%.32s\n", i, + array[i].str ? array[i].str : "(null)", array[i].dest ? array[i].dest : "(null)"); return PR_FALSE; } - if( (char)0 == *a ) break; + if( (char)0 == *a ) { + break; + } a++; b++; @@ -171,56 +173,56 @@ PRBool test_004(void) const char *result; PRBool nulled; } array[] = - { - { (const char *)0, 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { (const char *)0, 0, buffer, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { (const char *)0, 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { (const char *)0, 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { (const char *)0, 1, buffer, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { (const char *)0, 7, buffer, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, - { "", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "", 1, buffer, buffer, PR_TRUE, "", PR_TRUE }, - { "", 7, buffer, buffer, PR_TRUE, "", PR_TRUE }, - { "a", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "a", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, - { "a", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "a", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "b", 1, buffer, buffer, PR_TRUE, "b", PR_FALSE }, - { "c", 7, buffer, buffer, PR_TRUE, "c", PR_TRUE }, - { "de", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "de", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, - { "de", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "de", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "fg", 1, buffer, buffer, PR_TRUE, "f", PR_FALSE }, - { "hi", 7, buffer, buffer, PR_TRUE, "hi", PR_TRUE }, - { "jklmnopq", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "jklmnopq", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, - { "jklmnopq", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "jklmnopq", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "rstuvwxy", 1, buffer, buffer, PR_TRUE, "r", PR_FALSE }, - { "zABCDEFG", 7, buffer, buffer, PR_TRUE, "zABCDEF", PR_FALSE }, - { "a\0XXX", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "a\0XXX", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, - { "a\0XXX", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "a\0XXX", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "b\0XXX", 1, buffer, buffer, PR_TRUE, "b", PR_FALSE }, - { "c\0XXX", 7, buffer, buffer, PR_TRUE, "c", PR_TRUE }, - { "de\0XXX", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "de\0XXX", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, - { "de\0XXX", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "de\0XXX", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "fg\0XXX", 1, buffer, buffer, PR_TRUE, "f", PR_FALSE }, - { "hi\0XXX", 7, buffer, buffer, PR_TRUE, "hi", PR_TRUE }, - { "jklmnopq\0XXX", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "jklmnopq\0XXX", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, - { "jklmnopq\0XXX", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "jklmnopq\0XXX", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, - { "rstuvwxy\0XXX", 1, buffer, buffer, PR_TRUE, "r", PR_FALSE }, - { "zABCDEFG\0XXX", 7, buffer, buffer, PR_TRUE, "zABCDEF", PR_FALSE }, - }; + { + { (const char *)0, 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { (const char *)0, 0, buffer, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { (const char *)0, 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { (const char *)0, 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { (const char *)0, 1, buffer, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { (const char *)0, 7, buffer, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, + { "", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "", 1, buffer, buffer, PR_TRUE, "", PR_TRUE }, + { "", 7, buffer, buffer, PR_TRUE, "", PR_TRUE }, + { "a", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "a", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, + { "a", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "a", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "b", 1, buffer, buffer, PR_TRUE, "b", PR_FALSE }, + { "c", 7, buffer, buffer, PR_TRUE, "c", PR_TRUE }, + { "de", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "de", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, + { "de", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "de", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "fg", 1, buffer, buffer, PR_TRUE, "f", PR_FALSE }, + { "hi", 7, buffer, buffer, PR_TRUE, "hi", PR_TRUE }, + { "jklmnopq", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "jklmnopq", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, + { "jklmnopq", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "jklmnopq", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "rstuvwxy", 1, buffer, buffer, PR_TRUE, "r", PR_FALSE }, + { "zABCDEFG", 7, buffer, buffer, PR_TRUE, "zABCDEF", PR_FALSE }, + { "a\0XXX", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "a\0XXX", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, + { "a\0XXX", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "a\0XXX", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "b\0XXX", 1, buffer, buffer, PR_TRUE, "b", PR_FALSE }, + { "c\0XXX", 7, buffer, buffer, PR_TRUE, "c", PR_TRUE }, + { "de\0XXX", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "de\0XXX", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, + { "de\0XXX", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "de\0XXX", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "fg\0XXX", 1, buffer, buffer, PR_TRUE, "f", PR_FALSE }, + { "hi\0XXX", 7, buffer, buffer, PR_TRUE, "hi", PR_TRUE }, + { "jklmnopq\0XXX", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "jklmnopq\0XXX", 0, buffer, buffer, PR_FALSE, (const char *)0, PR_FALSE }, + { "jklmnopq\0XXX", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "jklmnopq\0XXX", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0, PR_FALSE }, + { "rstuvwxy\0XXX", 1, buffer, buffer, PR_TRUE, "r", PR_FALSE }, + { "zABCDEFG\0XXX", 7, buffer, buffer, PR_TRUE, "zABCDEF", PR_FALSE }, + }; int i; @@ -231,8 +233,9 @@ PRBool test_004(void) char *rv; int j; - for( j = 0; j < sizeof(buffer); j++ ) + for( j = 0; j < sizeof(buffer); j++ ) { buffer[j] = '-'; + } rv = PL_strncpy(array[i].dest, array[i].str, array[i].len); if( array[i].rv != rv ) @@ -251,7 +254,7 @@ PRBool test_004(void) { if( *a != *b ) { - printf("FAIL %d: %s != %.32s\n", i, + printf("FAIL %d: %s != %.32s\n", i, array[i].result, array[i].dest); return PR_FALSE; } @@ -278,7 +281,7 @@ PRBool test_004(void) } } } - + printf("PASS\n"); return PR_TRUE; } @@ -297,56 +300,56 @@ PRBool test_005(void) PRBool comp; const char *result; } array[] = - { - { (const char *)0, 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { (const char *)0, 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, - { (const char *)0, 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { (const char *)0, 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { (const char *)0, 1, buffer, (char *)0, PR_FALSE, (const char *)0 }, - { (const char *)0, 7, buffer, (char *)0, PR_FALSE, (const char *)0 }, - { "", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, - { "", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "", 1, buffer, buffer, PR_TRUE, "" }, - { "", 7, buffer, buffer, PR_TRUE, "" }, - { "a", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "a", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, - { "a", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "a", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "b", 1, buffer, buffer, PR_TRUE, "" }, - { "c", 7, buffer, buffer, PR_TRUE, "c" }, - { "de", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "de", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, - { "de", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "de", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "fg", 1, buffer, buffer, PR_TRUE, "" }, - { "hi", 7, buffer, buffer, PR_TRUE, "hi" }, - { "jklmnopq", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "jklmnopq", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, - { "jklmnopq", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "jklmnopq", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "rstuvwxy", 1, buffer, buffer, PR_TRUE, "" }, - { "zABCDEFG", 7, buffer, buffer, PR_TRUE, "zABCDE" }, - { "a\0XXX", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "a\0XXX", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, - { "a\0XXX", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "a\0XXX", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "b\0XXX", 1, buffer, buffer, PR_TRUE, "" }, - { "c\0XXX", 7, buffer, buffer, PR_TRUE, "c" }, - { "de\0XXX", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "de\0XXX", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, - { "de\0XXX", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "de\0XXX", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "fg\0XXX", 1, buffer, buffer, PR_TRUE, "" }, - { "hi\0XXX", 7, buffer, buffer, PR_TRUE, "hi" }, - { "jklmnopq\0XXX", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "jklmnopq\0XXX", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, - { "jklmnopq\0XXX", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "jklmnopq\0XXX", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, - { "rstuvwxy\0XXX", 1, buffer, buffer, PR_TRUE, "" }, - { "zABCDEFG\0XXX", 7, buffer, buffer, PR_TRUE, "zABCDE" }, - }; + { + { (const char *)0, 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { (const char *)0, 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, + { (const char *)0, 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { (const char *)0, 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { (const char *)0, 1, buffer, (char *)0, PR_FALSE, (const char *)0 }, + { (const char *)0, 7, buffer, (char *)0, PR_FALSE, (const char *)0 }, + { "", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, + { "", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "", 1, buffer, buffer, PR_TRUE, "" }, + { "", 7, buffer, buffer, PR_TRUE, "" }, + { "a", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "a", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, + { "a", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "a", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "b", 1, buffer, buffer, PR_TRUE, "" }, + { "c", 7, buffer, buffer, PR_TRUE, "c" }, + { "de", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "de", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, + { "de", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "de", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "fg", 1, buffer, buffer, PR_TRUE, "" }, + { "hi", 7, buffer, buffer, PR_TRUE, "hi" }, + { "jklmnopq", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "jklmnopq", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, + { "jklmnopq", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "jklmnopq", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "rstuvwxy", 1, buffer, buffer, PR_TRUE, "" }, + { "zABCDEFG", 7, buffer, buffer, PR_TRUE, "zABCDE" }, + { "a\0XXX", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "a\0XXX", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, + { "a\0XXX", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "a\0XXX", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "b\0XXX", 1, buffer, buffer, PR_TRUE, "" }, + { "c\0XXX", 7, buffer, buffer, PR_TRUE, "c" }, + { "de\0XXX", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "de\0XXX", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, + { "de\0XXX", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "de\0XXX", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "fg\0XXX", 1, buffer, buffer, PR_TRUE, "" }, + { "hi\0XXX", 7, buffer, buffer, PR_TRUE, "hi" }, + { "jklmnopq\0XXX", 0, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "jklmnopq\0XXX", 0, buffer, (char *)0, PR_FALSE, (const char *)0 }, + { "jklmnopq\0XXX", 1, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "jklmnopq\0XXX", 7, (char *)0, (char *)0, PR_FALSE, (const char *)0 }, + { "rstuvwxy\0XXX", 1, buffer, buffer, PR_TRUE, "" }, + { "zABCDEFG\0XXX", 7, buffer, buffer, PR_TRUE, "zABCDE" }, + }; int i; @@ -357,8 +360,9 @@ PRBool test_005(void) char *rv; int j; - for( j = 0; j < sizeof(buffer); j++ ) + for( j = 0; j < sizeof(buffer); j++ ) { buffer[j] = '-'; + } rv = PL_strncpyz(array[i].dest, array[i].str, array[i].len); if( array[i].rv != rv ) @@ -377,19 +381,21 @@ PRBool test_005(void) { if( *a != *b ) { - printf("FAIL %d: %s != %.32s\n", i, + printf("FAIL %d: %s != %.32s\n", i, array[i].result, array[i].dest); return PR_FALSE; } - if( (char)0 == *a ) break; + if( (char)0 == *a ) { + break; + } a++; b++; } } } - + printf("PASS\n"); return PR_TRUE; } @@ -440,7 +446,9 @@ PRBool test_006(void) return PR_FALSE; } - if( (char)0 == *a ) break; + if( (char)0 == *a ) { + break; + } a++; b++; @@ -463,29 +471,29 @@ PRBool test_007(void) PRUint32 len; const char *result; } array[] = - { - { (const char *)0, 0, "" }, - { (const char *)0, 1, "" }, - { (const char *)0, 7, "" }, - { "", 0, "" }, - { "", 1, "" }, - { "", 7, "" }, - { "a", 0, "" }, - { "a", 1, "a" }, - { "a", 7, "a" }, - { "ab", 0, "" }, - { "ab", 1, "a" }, - { "ab", 7, "ab" }, - { "abcdefg", 0, "" }, - { "abcdefg", 1, "a" }, - { "abcdefg", 7, "abcdefg" }, - { "abcdefghijk", 0, "" }, - { "abcdefghijk", 1, "a" }, - { "abcdefghijk", 7, "abcdefg" }, - { "abcdef\0ghijk", 0, "" }, - { "abcdef\0ghijk", 1, "a" }, - { "abcdef\0ghijk", 7, "abcdef" } - }; + { + { (const char *)0, 0, "" }, + { (const char *)0, 1, "" }, + { (const char *)0, 7, "" }, + { "", 0, "" }, + { "", 1, "" }, + { "", 7, "" }, + { "a", 0, "" }, + { "a", 1, "a" }, + { "a", 7, "a" }, + { "ab", 0, "" }, + { "ab", 1, "a" }, + { "ab", 7, "ab" }, + { "abcdefg", 0, "" }, + { "abcdefg", 1, "a" }, + { "abcdefg", 7, "abcdefg" }, + { "abcdefghijk", 0, "" }, + { "abcdefghijk", 1, "a" }, + { "abcdefghijk", 7, "abcdefg" }, + { "abcdef\0ghijk", 0, "" }, + { "abcdef\0ghijk", 1, "a" }, + { "abcdef\0ghijk", 7, "abcdef" } + }; int i; @@ -499,7 +507,7 @@ PRBool test_007(void) if( (char *)0 == rv ) { - printf("FAIL %d: %s,%lu -> 0\n", i, + printf("FAIL %d: %s,%lu -> 0\n", i, array[i].str ? array[i].str : "(null)", array[i].len); return PR_FALSE; } @@ -515,7 +523,9 @@ PRBool test_007(void) return PR_FALSE; } - if( (char)0 == *a ) break; + if( (char)0 == *a ) { + break; + } a++; b++; @@ -537,19 +547,19 @@ PRBool test_008(void) const char *second; const char *result; } array[] = - { - { (const char *)0, (const char *)0, (const char *)0 }, - { (const char *)0, "xyz", (const char *)0 }, - { "", (const char *)0, "" }, - { "", "", "" }, - { "ab", "", "ab" }, - { "cd", "ef", "cdef" }, - { "gh\0X", "", "gh" }, - { "ij\0X", "kl", "ijkl" }, - { "mn\0X", "op\0X", "mnop" }, - { "qr", "st\0X", "qrst" }, - { "uv\0X", "wx\0X", "uvwx" } - }; + { + { (const char *)0, (const char *)0, (const char *)0 }, + { (const char *)0, "xyz", (const char *)0 }, + { "", (const char *)0, "" }, + { "", "", "" }, + { "ab", "", "ab" }, + { "cd", "ef", "cdef" }, + { "gh\0X", "", "gh" }, + { "ij\0X", "kl", "ijkl" }, + { "mn\0X", "op\0X", "mnop" }, + { "qr", "st\0X", "qrst" }, + { "uv\0X", "wx\0X", "uvwx" } + }; int i; @@ -561,11 +571,13 @@ PRBool test_008(void) int j; char *rv; - for( j = 0; j < sizeof(buffer); j++ ) + for( j = 0; j < sizeof(buffer); j++ ) { buffer[j] = '-'; + } - if( (const char *)0 != array[i].first ) + if( (const char *)0 != array[i].first ) { (void)PL_strcpy(buffer, array[i].first); + } rv = PL_strcat(((const char *)0 == array[i].first) ? (char *)0 : buffer, array[i].second); @@ -607,7 +619,9 @@ PRBool test_008(void) return PR_FALSE; } - if( (char)0 == *a ) break; + if( (char)0 == *a ) { + break; + } a++; b++; @@ -630,36 +644,36 @@ PRBool test_009(void) PRUint32 length; PRBool nulled; const char *result; - } array[] = - { - { (const char *)0, (const char *)0, 0, PR_FALSE, (const char *)0 }, - { (const char *)0, (const char *)0, 1, PR_FALSE, (const char *)0 }, - { (const char *)0, (const char *)0, 7, PR_FALSE, (const char *)0 }, - { (const char *)0, "", 0, PR_FALSE, (const char *)0 }, - { (const char *)0, "", 1, PR_FALSE, (const char *)0 }, - { (const char *)0, "", 7, PR_FALSE, (const char *)0 }, - { (const char *)0, "stuff", 0, PR_FALSE, (const char *)0 }, - { (const char *)0, "stuff", 1, PR_FALSE, (const char *)0 }, - { (const char *)0, "stuff", 7, PR_FALSE, (const char *)0 }, - { "", (const char *)0, 0, PR_TRUE, "" }, - { "", (const char *)0, 1, PR_TRUE, "" }, - { "", (const char *)0, 7, PR_TRUE, "" }, - { "", "", 0, PR_TRUE, "" }, - { "", "", 1, PR_TRUE, "" }, - { "", "", 7, PR_TRUE, "" }, - { "", "abcdefgh", 0, PR_TRUE, "" }, - { "", "abcdefgh", 1, PR_FALSE, "a" }, - { "", "abcdefgh", 7, PR_FALSE, "abcdefg" }, - { "xyz", (const char *)0, 0, PR_TRUE, "xyz" }, - { "xyz", (const char *)0, 1, PR_TRUE, "xyz" }, - { "xyz", (const char *)0, 7, PR_TRUE, "xyz" }, - { "xyz", "", 0, PR_TRUE, "xyz" }, - { "xyz", "", 1, PR_TRUE, "xyz" }, - { "xyz", "", 7, PR_TRUE, "xyz" }, - { "xyz", "abcdefgh", 0, PR_TRUE, "xyz" }, - { "xyz", "abcdefgh", 1, PR_FALSE, "xyza" }, - { "xyz", "abcdefgh", 7, PR_FALSE, "xyzabcdefg" } - }; + } array[] = + { + { (const char *)0, (const char *)0, 0, PR_FALSE, (const char *)0 }, + { (const char *)0, (const char *)0, 1, PR_FALSE, (const char *)0 }, + { (const char *)0, (const char *)0, 7, PR_FALSE, (const char *)0 }, + { (const char *)0, "", 0, PR_FALSE, (const char *)0 }, + { (const char *)0, "", 1, PR_FALSE, (const char *)0 }, + { (const char *)0, "", 7, PR_FALSE, (const char *)0 }, + { (const char *)0, "stuff", 0, PR_FALSE, (const char *)0 }, + { (const char *)0, "stuff", 1, PR_FALSE, (const char *)0 }, + { (const char *)0, "stuff", 7, PR_FALSE, (const char *)0 }, + { "", (const char *)0, 0, PR_TRUE, "" }, + { "", (const char *)0, 1, PR_TRUE, "" }, + { "", (const char *)0, 7, PR_TRUE, "" }, + { "", "", 0, PR_TRUE, "" }, + { "", "", 1, PR_TRUE, "" }, + { "", "", 7, PR_TRUE, "" }, + { "", "abcdefgh", 0, PR_TRUE, "" }, + { "", "abcdefgh", 1, PR_FALSE, "a" }, + { "", "abcdefgh", 7, PR_FALSE, "abcdefg" }, + { "xyz", (const char *)0, 0, PR_TRUE, "xyz" }, + { "xyz", (const char *)0, 1, PR_TRUE, "xyz" }, + { "xyz", (const char *)0, 7, PR_TRUE, "xyz" }, + { "xyz", "", 0, PR_TRUE, "xyz" }, + { "xyz", "", 1, PR_TRUE, "xyz" }, + { "xyz", "", 7, PR_TRUE, "xyz" }, + { "xyz", "abcdefgh", 0, PR_TRUE, "xyz" }, + { "xyz", "abcdefgh", 1, PR_FALSE, "xyza" }, + { "xyz", "abcdefgh", 7, PR_FALSE, "xyzabcdefg" } + }; int i; @@ -671,14 +685,16 @@ PRBool test_009(void) int j; char *rv; - for( j = 0; j < sizeof(buffer); j++ ) + for( j = 0; j < sizeof(buffer); j++ ) { buffer[j] = '-'; + } - if( (const char *)0 != array[i].first ) + if( (const char *)0 != array[i].first ) { (void)PL_strcpy(buffer, array[i].first); + } rv = PL_strncat(((const char *)0 == array[i].first) ? (char *)0 : buffer, - array[i].second, array[i].length); + array[i].second, array[i].length); if( (const char *)0 == array[i].result ) { @@ -760,36 +776,36 @@ PRBool test_010(void) const char *second; PRUint32 length; const char *result; - } array[] = - { - { (const char *)0, (const char *)0, 0, (const char *)0 }, - { (const char *)0, (const char *)0, 1, (const char *)0 }, - { (const char *)0, (const char *)0, 7, (const char *)0 }, - { (const char *)0, "", 0, (const char *)0 }, - { (const char *)0, "", 1, (const char *)0 }, - { (const char *)0, "", 7, (const char *)0 }, - { (const char *)0, "stuff", 0, (const char *)0 }, - { (const char *)0, "stuff", 1, (const char *)0 }, - { (const char *)0, "stuff", 7, (const char *)0 }, - { "", (const char *)0, 0, "" }, - { "", (const char *)0, 1, "" }, - { "", (const char *)0, 7, "" }, - { "", "", 0, "" }, - { "", "", 1, "" }, - { "", "", 7, "" }, - { "", "abcdefgh", 0, "" }, - { "", "abcdefgh", 1, "" }, - { "", "abcdefgh", 7, "abcdef" }, - { "xyz", (const char *)0, 0, "xyz" }, - { "xyz", (const char *)0, 1, "xyz" }, - { "xyz", (const char *)0, 7, "xyz" }, - { "xyz", "", 0, "xyz" }, - { "xyz", "", 1, "xyz" }, - { "xyz", "", 7, "xyz" }, - { "xyz", "abcdefgh", 0, "xyz" }, - { "xyz", "abcdefgh", 1, "xyz" }, - { "xyz", "abcdefgh", 7, "xyzabc" } - }; + } array[] = + { + { (const char *)0, (const char *)0, 0, (const char *)0 }, + { (const char *)0, (const char *)0, 1, (const char *)0 }, + { (const char *)0, (const char *)0, 7, (const char *)0 }, + { (const char *)0, "", 0, (const char *)0 }, + { (const char *)0, "", 1, (const char *)0 }, + { (const char *)0, "", 7, (const char *)0 }, + { (const char *)0, "stuff", 0, (const char *)0 }, + { (const char *)0, "stuff", 1, (const char *)0 }, + { (const char *)0, "stuff", 7, (const char *)0 }, + { "", (const char *)0, 0, "" }, + { "", (const char *)0, 1, "" }, + { "", (const char *)0, 7, "" }, + { "", "", 0, "" }, + { "", "", 1, "" }, + { "", "", 7, "" }, + { "", "abcdefgh", 0, "" }, + { "", "abcdefgh", 1, "" }, + { "", "abcdefgh", 7, "abcdef" }, + { "xyz", (const char *)0, 0, "xyz" }, + { "xyz", (const char *)0, 1, "xyz" }, + { "xyz", (const char *)0, 7, "xyz" }, + { "xyz", "", 0, "xyz" }, + { "xyz", "", 1, "xyz" }, + { "xyz", "", 7, "xyz" }, + { "xyz", "abcdefgh", 0, "xyz" }, + { "xyz", "abcdefgh", 1, "xyz" }, + { "xyz", "abcdefgh", 7, "xyzabc" } + }; int i; @@ -801,11 +817,13 @@ PRBool test_010(void) int j; char *rv; - for( j = 0; j < sizeof(buffer); j++ ) + for( j = 0; j < sizeof(buffer); j++ ) { buffer[j] = '-'; + } - if( (const char *)0 != array[i].first ) + if( (const char *)0 != array[i].first ) { (void)PL_strcpy(buffer, array[i].first); + } rv = PL_strcatn(((const char *)0 == array[i].first) ? (char *)0 : buffer, array[i].length, array[i].second); @@ -847,7 +865,9 @@ PRBool test_010(void) return PR_FALSE; } - if( (char)0 == *a ) break; + if( (char)0 == *a ) { + break; + } a++; b++; @@ -869,39 +889,39 @@ PRBool test_011(void) const char *two; PRIntn sign; } array[] = - { - { (const char *)0, (const char *)0, 0 }, - { (const char *)0, "word", -1 }, - { "word", (const char *)0, 1 }, - { "word", "word", 0 }, - { "aZYXVUT", "bZYXVUT", -1 }, - { "aZYXVUT", "bAAAAAA", -1 }, - { "a", "aa", -1 }, - { "a", "a", 0 }, - { "a", "A", 1 }, - { "aaaaa", "baaaa", -1 }, - { "aaaaa", "abaaa", -1 }, - { "aaaaa", "aabaa", -1 }, - { "aaaaa", "aaaba", -1 }, - { "aaaaa", "aaaab", -1 }, - { "bZYXVUT", "aZYXVUT", 1 }, - { "bAAAAAA", "aZYXVUT", 1 }, - { "aa", "a", 1 }, - { "A", "a", -1 }, - { "baaaa", "aaaaa", 1 }, - { "abaaa", "aaaaa", 1 }, - { "aabaa", "aaaaa", 1 }, - { "aaaba", "aaaaa", 1 }, - { "aaaab", "aaaaa", 1 }, - { "word", "Word", 1 }, - { "word", "wOrd", 1 }, - { "word", "woRd", 1 }, - { "word", "worD", 1 }, - { "WORD", "wORD", -1 }, - { "WORD", "WoRD", -1 }, - { "WORD", "WOrD", -1 }, - { "WORD", "WORd", -1 } - }; + { + { (const char *)0, (const char *)0, 0 }, + { (const char *)0, "word", -1 }, + { "word", (const char *)0, 1 }, + { "word", "word", 0 }, + { "aZYXVUT", "bZYXVUT", -1 }, + { "aZYXVUT", "bAAAAAA", -1 }, + { "a", "aa", -1 }, + { "a", "a", 0 }, + { "a", "A", 1 }, + { "aaaaa", "baaaa", -1 }, + { "aaaaa", "abaaa", -1 }, + { "aaaaa", "aabaa", -1 }, + { "aaaaa", "aaaba", -1 }, + { "aaaaa", "aaaab", -1 }, + { "bZYXVUT", "aZYXVUT", 1 }, + { "bAAAAAA", "aZYXVUT", 1 }, + { "aa", "a", 1 }, + { "A", "a", -1 }, + { "baaaa", "aaaaa", 1 }, + { "abaaa", "aaaaa", 1 }, + { "aabaa", "aaaaa", 1 }, + { "aaaba", "aaaaa", 1 }, + { "aaaab", "aaaaa", 1 }, + { "word", "Word", 1 }, + { "word", "wOrd", 1 }, + { "word", "woRd", 1 }, + { "word", "worD", 1 }, + { "WORD", "wORD", -1 }, + { "WORD", "WoRD", -1 }, + { "WORD", "WOrD", -1 }, + { "WORD", "WORd", -1 } + }; int i; @@ -914,13 +934,19 @@ PRBool test_011(void) switch( array[i].sign ) { case -1: - if( rv < 0 ) continue; + if( rv < 0 ) { + continue; + } break; case 1: - if( rv > 0 ) continue; + if( rv > 0 ) { + continue; + } break; case 0: - if( 0 == rv ) continue; + if( 0 == rv ) { + continue; + } break; default: PR_NOT_REACHED("static data inconsistancy"); @@ -948,105 +974,105 @@ PRBool test_012(void) PRUint32 max; PRIntn sign; } array[] = - { - { (const char *)0, (const char *)0, 0, 0 }, - { (const char *)0, (const char *)0, 1, 0 }, - { (const char *)0, (const char *)0, 4, 0 }, - { (const char *)0, "word", 0, -1 }, - { (const char *)0, "word", 1, -1 }, - { (const char *)0, "word", 4, -1 }, - { "word", (const char *)0, 0, 1 }, - { "word", (const char *)0, 1, 1 }, - { "word", (const char *)0, 4, 1 }, - { "word", "word", 0, 0 }, - { "word", "word", 1, 0 }, - { "word", "word", 3, 0 }, - { "word", "word", 5, 0 }, - { "aZYXVUT", "bZYXVUT", 0, 0 }, - { "aZYXVUT", "bZYXVUT", 1, -1 }, - { "aZYXVUT", "bZYXVUT", 4, -1 }, - { "aZYXVUT", "bZYXVUT", 9, -1 }, - { "aZYXVUT", "bAAAAAA", 0, 0 }, - { "aZYXVUT", "bAAAAAA", 1, -1 }, - { "aZYXVUT", "bAAAAAA", 4, -1 }, - { "aZYXVUT", "bAAAAAA", 5, -1 }, - { "a", "aa", 0, 0 }, - { "a", "aa", 1, 0 }, - { "a", "aa", 4, -1 }, - { "a", "a", 0, 0 }, - { "a", "a", 1, 0 }, - { "a", "a", 4, 0 }, - { "a", "A", 0, 0 }, - { "a", "A", 1, 1 }, - { "a", "A", 4, 1 }, - { "aaaaa", "baaaa", 0, 0 }, - { "aaaaa", "baaaa", 1, -1 }, - { "aaaaa", "baaaa", 4, -1 }, - { "aaaaa", "abaaa", 0, 0 }, - { "aaaaa", "abaaa", 1, 0 }, - { "aaaaa", "abaaa", 4, -1 }, - { "aaaaa", "aabaa", 0, 0 }, - { "aaaaa", "aabaa", 1, 0 }, - { "aaaaa", "aabaa", 4, -1 }, - { "aaaaa", "aaaba", 0, 0 }, - { "aaaaa", "aaaba", 1, 0 }, - { "aaaaa", "aaaba", 4, -1 }, - { "aaaaa", "aaaab", 0, 0 }, - { "aaaaa", "aaaab", 1, 0 }, - { "aaaaa", "aaaab", 4, 0 }, - { "bZYXVUT", "aZYXVUT", 0, 0 }, - { "bZYXVUT", "aZYXVUT", 1, 1 }, - { "bZYXVUT", "aZYXVUT", 4, 1 }, - { "bAAAAAA", "aZYXVUT", 0, 0 }, - { "bAAAAAA", "aZYXVUT", 1, 1 }, - { "bAAAAAA", "aZYXVUT", 4, 1 }, - { "aa", "a", 0, 0 }, - { "aa", "a", 1, 0 }, - { "aa", "a", 4, 1 }, - { "A", "a", 0, 0 }, - { "A", "a", 1, -1 }, - { "A", "a", 4, -1 }, - { "baaaa", "aaaaa", 0, 0 }, - { "baaaa", "aaaaa", 1, 1 }, - { "baaaa", "aaaaa", 4, 1 }, - { "abaaa", "aaaaa", 0, 0 }, - { "abaaa", "aaaaa", 1, 0 }, - { "abaaa", "aaaaa", 4, 1 }, - { "aabaa", "aaaaa", 0, 0 }, - { "aabaa", "aaaaa", 1, 0 }, - { "aabaa", "aaaaa", 4, 1 }, - { "aaaba", "aaaaa", 0, 0 }, - { "aaaba", "aaaaa", 1, 0 }, - { "aaaba", "aaaaa", 4, 1 }, - { "aaaab", "aaaaa", 0, 0 }, - { "aaaab", "aaaaa", 1, 0 }, - { "aaaab", "aaaaa", 4, 0 }, - { "word", "Word", 0, 0 }, - { "word", "Word", 1, 1 }, - { "word", "Word", 3, 1 }, - { "word", "wOrd", 0, 0 }, - { "word", "wOrd", 1, 0 }, - { "word", "wOrd", 3, 1 }, - { "word", "woRd", 0, 0 }, - { "word", "woRd", 1, 0 }, - { "word", "woRd", 3, 1 }, - { "word", "worD", 0, 0 }, - { "word", "worD", 1, 0 }, - { "word", "worD", 3, 0 }, - { "WORD", "wORD", 0, 0 }, - { "WORD", "wORD", 1, -1 }, - { "WORD", "wORD", 3, -1 }, - { "WORD", "WoRD", 0, 0 }, - { "WORD", "WoRD", 1, 0 }, - { "WORD", "WoRD", 3, -1 }, - { "WORD", "WOrD", 0, 0 }, - { "WORD", "WOrD", 1, 0 }, - { "WORD", "WOrD", 3, -1 }, - { "WORD", "WORd", 0, 0 }, - { "WORD", "WORd", 1, 0 }, - { "WORD", "WORd", 3, 0 } - - }; + { + { (const char *)0, (const char *)0, 0, 0 }, + { (const char *)0, (const char *)0, 1, 0 }, + { (const char *)0, (const char *)0, 4, 0 }, + { (const char *)0, "word", 0, -1 }, + { (const char *)0, "word", 1, -1 }, + { (const char *)0, "word", 4, -1 }, + { "word", (const char *)0, 0, 1 }, + { "word", (const char *)0, 1, 1 }, + { "word", (const char *)0, 4, 1 }, + { "word", "word", 0, 0 }, + { "word", "word", 1, 0 }, + { "word", "word", 3, 0 }, + { "word", "word", 5, 0 }, + { "aZYXVUT", "bZYXVUT", 0, 0 }, + { "aZYXVUT", "bZYXVUT", 1, -1 }, + { "aZYXVUT", "bZYXVUT", 4, -1 }, + { "aZYXVUT", "bZYXVUT", 9, -1 }, + { "aZYXVUT", "bAAAAAA", 0, 0 }, + { "aZYXVUT", "bAAAAAA", 1, -1 }, + { "aZYXVUT", "bAAAAAA", 4, -1 }, + { "aZYXVUT", "bAAAAAA", 5, -1 }, + { "a", "aa", 0, 0 }, + { "a", "aa", 1, 0 }, + { "a", "aa", 4, -1 }, + { "a", "a", 0, 0 }, + { "a", "a", 1, 0 }, + { "a", "a", 4, 0 }, + { "a", "A", 0, 0 }, + { "a", "A", 1, 1 }, + { "a", "A", 4, 1 }, + { "aaaaa", "baaaa", 0, 0 }, + { "aaaaa", "baaaa", 1, -1 }, + { "aaaaa", "baaaa", 4, -1 }, + { "aaaaa", "abaaa", 0, 0 }, + { "aaaaa", "abaaa", 1, 0 }, + { "aaaaa", "abaaa", 4, -1 }, + { "aaaaa", "aabaa", 0, 0 }, + { "aaaaa", "aabaa", 1, 0 }, + { "aaaaa", "aabaa", 4, -1 }, + { "aaaaa", "aaaba", 0, 0 }, + { "aaaaa", "aaaba", 1, 0 }, + { "aaaaa", "aaaba", 4, -1 }, + { "aaaaa", "aaaab", 0, 0 }, + { "aaaaa", "aaaab", 1, 0 }, + { "aaaaa", "aaaab", 4, 0 }, + { "bZYXVUT", "aZYXVUT", 0, 0 }, + { "bZYXVUT", "aZYXVUT", 1, 1 }, + { "bZYXVUT", "aZYXVUT", 4, 1 }, + { "bAAAAAA", "aZYXVUT", 0, 0 }, + { "bAAAAAA", "aZYXVUT", 1, 1 }, + { "bAAAAAA", "aZYXVUT", 4, 1 }, + { "aa", "a", 0, 0 }, + { "aa", "a", 1, 0 }, + { "aa", "a", 4, 1 }, + { "A", "a", 0, 0 }, + { "A", "a", 1, -1 }, + { "A", "a", 4, -1 }, + { "baaaa", "aaaaa", 0, 0 }, + { "baaaa", "aaaaa", 1, 1 }, + { "baaaa", "aaaaa", 4, 1 }, + { "abaaa", "aaaaa", 0, 0 }, + { "abaaa", "aaaaa", 1, 0 }, + { "abaaa", "aaaaa", 4, 1 }, + { "aabaa", "aaaaa", 0, 0 }, + { "aabaa", "aaaaa", 1, 0 }, + { "aabaa", "aaaaa", 4, 1 }, + { "aaaba", "aaaaa", 0, 0 }, + { "aaaba", "aaaaa", 1, 0 }, + { "aaaba", "aaaaa", 4, 1 }, + { "aaaab", "aaaaa", 0, 0 }, + { "aaaab", "aaaaa", 1, 0 }, + { "aaaab", "aaaaa", 4, 0 }, + { "word", "Word", 0, 0 }, + { "word", "Word", 1, 1 }, + { "word", "Word", 3, 1 }, + { "word", "wOrd", 0, 0 }, + { "word", "wOrd", 1, 0 }, + { "word", "wOrd", 3, 1 }, + { "word", "woRd", 0, 0 }, + { "word", "woRd", 1, 0 }, + { "word", "woRd", 3, 1 }, + { "word", "worD", 0, 0 }, + { "word", "worD", 1, 0 }, + { "word", "worD", 3, 0 }, + { "WORD", "wORD", 0, 0 }, + { "WORD", "wORD", 1, -1 }, + { "WORD", "wORD", 3, -1 }, + { "WORD", "WoRD", 0, 0 }, + { "WORD", "WoRD", 1, 0 }, + { "WORD", "WoRD", 3, -1 }, + { "WORD", "WOrD", 0, 0 }, + { "WORD", "WOrD", 1, 0 }, + { "WORD", "WOrD", 3, -1 }, + { "WORD", "WORd", 0, 0 }, + { "WORD", "WORd", 1, 0 }, + { "WORD", "WORd", 3, 0 } + + }; int i; @@ -1059,13 +1085,19 @@ PRBool test_012(void) switch( array[i].sign ) { case -1: - if( rv < 0 ) continue; + if( rv < 0 ) { + continue; + } break; case 1: - if( rv > 0 ) continue; + if( rv > 0 ) { + continue; + } break; case 0: - if( 0 == rv ) continue; + if( 0 == rv ) { + continue; + } break; default: PR_NOT_REACHED("static data inconsistancy"); @@ -1092,39 +1124,39 @@ PRBool test_013(void) const char *two; PRIntn sign; } array[] = - { - { (const char *)0, (const char *)0, 0 }, - { (const char *)0, "word", -1 }, - { "word", (const char *)0, 1 }, - { "word", "word", 0 }, - { "aZYXVUT", "bZYXVUT", -1 }, - { "aZYXVUT", "bAAAAAA", -1 }, - { "a", "aa", -1 }, - { "a", "a", 0 }, - { "a", "A", 0 }, - { "aaaaa", "baaaa", -1 }, - { "aaaaa", "abaaa", -1 }, - { "aaaaa", "aabaa", -1 }, - { "aaaaa", "aaaba", -1 }, - { "aaaaa", "aaaab", -1 }, - { "bZYXVUT", "aZYXVUT", 1 }, - { "bAAAAAA", "aZYXVUT", 1 }, - { "aa", "a", 1 }, - { "A", "a", 0 }, - { "baaaa", "aaaaa", 1 }, - { "abaaa", "aaaaa", 1 }, - { "aabaa", "aaaaa", 1 }, - { "aaaba", "aaaaa", 1 }, - { "aaaab", "aaaaa", 1 }, - { "word", "Word", 0 }, - { "word", "wOrd", 0 }, - { "word", "woRd", 0 }, - { "word", "worD", 0 }, - { "WORD", "wORD", 0 }, - { "WORD", "WoRD", 0 }, - { "WORD", "WOrD", 0 }, - { "WORD", "WORd", 0 } - }; + { + { (const char *)0, (const char *)0, 0 }, + { (const char *)0, "word", -1 }, + { "word", (const char *)0, 1 }, + { "word", "word", 0 }, + { "aZYXVUT", "bZYXVUT", -1 }, + { "aZYXVUT", "bAAAAAA", -1 }, + { "a", "aa", -1 }, + { "a", "a", 0 }, + { "a", "A", 0 }, + { "aaaaa", "baaaa", -1 }, + { "aaaaa", "abaaa", -1 }, + { "aaaaa", "aabaa", -1 }, + { "aaaaa", "aaaba", -1 }, + { "aaaaa", "aaaab", -1 }, + { "bZYXVUT", "aZYXVUT", 1 }, + { "bAAAAAA", "aZYXVUT", 1 }, + { "aa", "a", 1 }, + { "A", "a", 0 }, + { "baaaa", "aaaaa", 1 }, + { "abaaa", "aaaaa", 1 }, + { "aabaa", "aaaaa", 1 }, + { "aaaba", "aaaaa", 1 }, + { "aaaab", "aaaaa", 1 }, + { "word", "Word", 0 }, + { "word", "wOrd", 0 }, + { "word", "woRd", 0 }, + { "word", "worD", 0 }, + { "WORD", "wORD", 0 }, + { "WORD", "WoRD", 0 }, + { "WORD", "WOrD", 0 }, + { "WORD", "WORd", 0 } + }; int i; @@ -1137,13 +1169,19 @@ PRBool test_013(void) switch( array[i].sign ) { case -1: - if( rv < 0 ) continue; + if( rv < 0 ) { + continue; + } break; case 1: - if( rv > 0 ) continue; + if( rv > 0 ) { + continue; + } break; case 0: - if( 0 == rv ) continue; + if( 0 == rv ) { + continue; + } break; default: PR_NOT_REACHED("static data inconsistancy"); @@ -1171,104 +1209,104 @@ PRBool test_014(void) PRUint32 max; PRIntn sign; } array[] = - { - { (const char *)0, (const char *)0, 0, 0 }, - { (const char *)0, (const char *)0, 1, 0 }, - { (const char *)0, (const char *)0, 4, 0 }, - { (const char *)0, "word", 0, -1 }, - { (const char *)0, "word", 1, -1 }, - { (const char *)0, "word", 4, -1 }, - { "word", (const char *)0, 0, 1 }, - { "word", (const char *)0, 1, 1 }, - { "word", (const char *)0, 4, 1 }, - { "word", "word", 0, 0 }, - { "word", "word", 1, 0 }, - { "word", "word", 3, 0 }, - { "word", "word", 5, 0 }, - { "aZYXVUT", "bZYXVUT", 0, 0 }, - { "aZYXVUT", "bZYXVUT", 1, -1 }, - { "aZYXVUT", "bZYXVUT", 4, -1 }, - { "aZYXVUT", "bZYXVUT", 9, -1 }, - { "aZYXVUT", "bAAAAAA", 0, 0 }, - { "aZYXVUT", "bAAAAAA", 1, -1 }, - { "aZYXVUT", "bAAAAAA", 4, -1 }, - { "aZYXVUT", "bAAAAAA", 5, -1 }, - { "a", "aa", 0, 0 }, - { "a", "aa", 1, 0 }, - { "a", "aa", 4, -1 }, - { "a", "a", 0, 0 }, - { "a", "a", 1, 0 }, - { "a", "a", 4, 0 }, - { "a", "A", 0, 0 }, - { "a", "A", 1, 0 }, - { "a", "A", 4, 0 }, - { "aaaaa", "baaaa", 0, 0 }, - { "aaaaa", "baaaa", 1, -1 }, - { "aaaaa", "baaaa", 4, -1 }, - { "aaaaa", "abaaa", 0, 0 }, - { "aaaaa", "abaaa", 1, 0 }, - { "aaaaa", "abaaa", 4, -1 }, - { "aaaaa", "aabaa", 0, 0 }, - { "aaaaa", "aabaa", 1, 0 }, - { "aaaaa", "aabaa", 4, -1 }, - { "aaaaa", "aaaba", 0, 0 }, - { "aaaaa", "aaaba", 1, 0 }, - { "aaaaa", "aaaba", 4, -1 }, - { "aaaaa", "aaaab", 0, 0 }, - { "aaaaa", "aaaab", 1, 0 }, - { "aaaaa", "aaaab", 4, 0 }, - { "bZYXVUT", "aZYXVUT", 0, 0 }, - { "bZYXVUT", "aZYXVUT", 1, 1 }, - { "bZYXVUT", "aZYXVUT", 4, 1 }, - { "bAAAAAA", "aZYXVUT", 0, 0 }, - { "bAAAAAA", "aZYXVUT", 1, 1 }, - { "bAAAAAA", "aZYXVUT", 4, 1 }, - { "aa", "a", 0, 0 }, - { "aa", "a", 1, 0 }, - { "aa", "a", 4, 1 }, - { "A", "a", 0, 0 }, - { "A", "a", 1, 0 }, - { "A", "a", 4, 0 }, - { "baaaa", "aaaaa", 0, 0 }, - { "baaaa", "aaaaa", 1, 1 }, - { "baaaa", "aaaaa", 4, 1 }, - { "abaaa", "aaaaa", 0, 0 }, - { "abaaa", "aaaaa", 1, 0 }, - { "abaaa", "aaaaa", 4, 1 }, - { "aabaa", "aaaaa", 0, 0 }, - { "aabaa", "aaaaa", 1, 0 }, - { "aabaa", "aaaaa", 4, 1 }, - { "aaaba", "aaaaa", 0, 0 }, - { "aaaba", "aaaaa", 1, 0 }, - { "aaaba", "aaaaa", 4, 1 }, - { "aaaab", "aaaaa", 0, 0 }, - { "aaaab", "aaaaa", 1, 0 }, - { "aaaab", "aaaaa", 4, 0 }, - { "word", "Word", 0, 0 }, - { "word", "Word", 1, 0 }, - { "word", "Word", 3, 0 }, - { "word", "wOrd", 0, 0 }, - { "word", "wOrd", 1, 0 }, - { "word", "wOrd", 3, 0 }, - { "word", "woRd", 0, 0 }, - { "word", "woRd", 1, 0 }, - { "word", "woRd", 3, 0 }, - { "word", "worD", 0, 0 }, - { "word", "worD", 1, 0 }, - { "word", "worD", 3, 0 }, - { "WORD", "wORD", 0, 0 }, - { "WORD", "wORD", 1, 0 }, - { "WORD", "wORD", 3, 0 }, - { "WORD", "WoRD", 0, 0 }, - { "WORD", "WoRD", 1, 0 }, - { "WORD", "WoRD", 3, 0 }, - { "WORD", "WOrD", 0, 0 }, - { "WORD", "WOrD", 1, 0 }, - { "WORD", "WOrD", 3, 0 }, - { "WORD", "WORd", 0, 0 }, - { "WORD", "WORd", 1, 0 }, - { "WORD", "WORd", 3, 0 } - }; + { + { (const char *)0, (const char *)0, 0, 0 }, + { (const char *)0, (const char *)0, 1, 0 }, + { (const char *)0, (const char *)0, 4, 0 }, + { (const char *)0, "word", 0, -1 }, + { (const char *)0, "word", 1, -1 }, + { (const char *)0, "word", 4, -1 }, + { "word", (const char *)0, 0, 1 }, + { "word", (const char *)0, 1, 1 }, + { "word", (const char *)0, 4, 1 }, + { "word", "word", 0, 0 }, + { "word", "word", 1, 0 }, + { "word", "word", 3, 0 }, + { "word", "word", 5, 0 }, + { "aZYXVUT", "bZYXVUT", 0, 0 }, + { "aZYXVUT", "bZYXVUT", 1, -1 }, + { "aZYXVUT", "bZYXVUT", 4, -1 }, + { "aZYXVUT", "bZYXVUT", 9, -1 }, + { "aZYXVUT", "bAAAAAA", 0, 0 }, + { "aZYXVUT", "bAAAAAA", 1, -1 }, + { "aZYXVUT", "bAAAAAA", 4, -1 }, + { "aZYXVUT", "bAAAAAA", 5, -1 }, + { "a", "aa", 0, 0 }, + { "a", "aa", 1, 0 }, + { "a", "aa", 4, -1 }, + { "a", "a", 0, 0 }, + { "a", "a", 1, 0 }, + { "a", "a", 4, 0 }, + { "a", "A", 0, 0 }, + { "a", "A", 1, 0 }, + { "a", "A", 4, 0 }, + { "aaaaa", "baaaa", 0, 0 }, + { "aaaaa", "baaaa", 1, -1 }, + { "aaaaa", "baaaa", 4, -1 }, + { "aaaaa", "abaaa", 0, 0 }, + { "aaaaa", "abaaa", 1, 0 }, + { "aaaaa", "abaaa", 4, -1 }, + { "aaaaa", "aabaa", 0, 0 }, + { "aaaaa", "aabaa", 1, 0 }, + { "aaaaa", "aabaa", 4, -1 }, + { "aaaaa", "aaaba", 0, 0 }, + { "aaaaa", "aaaba", 1, 0 }, + { "aaaaa", "aaaba", 4, -1 }, + { "aaaaa", "aaaab", 0, 0 }, + { "aaaaa", "aaaab", 1, 0 }, + { "aaaaa", "aaaab", 4, 0 }, + { "bZYXVUT", "aZYXVUT", 0, 0 }, + { "bZYXVUT", "aZYXVUT", 1, 1 }, + { "bZYXVUT", "aZYXVUT", 4, 1 }, + { "bAAAAAA", "aZYXVUT", 0, 0 }, + { "bAAAAAA", "aZYXVUT", 1, 1 }, + { "bAAAAAA", "aZYXVUT", 4, 1 }, + { "aa", "a", 0, 0 }, + { "aa", "a", 1, 0 }, + { "aa", "a", 4, 1 }, + { "A", "a", 0, 0 }, + { "A", "a", 1, 0 }, + { "A", "a", 4, 0 }, + { "baaaa", "aaaaa", 0, 0 }, + { "baaaa", "aaaaa", 1, 1 }, + { "baaaa", "aaaaa", 4, 1 }, + { "abaaa", "aaaaa", 0, 0 }, + { "abaaa", "aaaaa", 1, 0 }, + { "abaaa", "aaaaa", 4, 1 }, + { "aabaa", "aaaaa", 0, 0 }, + { "aabaa", "aaaaa", 1, 0 }, + { "aabaa", "aaaaa", 4, 1 }, + { "aaaba", "aaaaa", 0, 0 }, + { "aaaba", "aaaaa", 1, 0 }, + { "aaaba", "aaaaa", 4, 1 }, + { "aaaab", "aaaaa", 0, 0 }, + { "aaaab", "aaaaa", 1, 0 }, + { "aaaab", "aaaaa", 4, 0 }, + { "word", "Word", 0, 0 }, + { "word", "Word", 1, 0 }, + { "word", "Word", 3, 0 }, + { "word", "wOrd", 0, 0 }, + { "word", "wOrd", 1, 0 }, + { "word", "wOrd", 3, 0 }, + { "word", "woRd", 0, 0 }, + { "word", "woRd", 1, 0 }, + { "word", "woRd", 3, 0 }, + { "word", "worD", 0, 0 }, + { "word", "worD", 1, 0 }, + { "word", "worD", 3, 0 }, + { "WORD", "wORD", 0, 0 }, + { "WORD", "wORD", 1, 0 }, + { "WORD", "wORD", 3, 0 }, + { "WORD", "WoRD", 0, 0 }, + { "WORD", "WoRD", 1, 0 }, + { "WORD", "WoRD", 3, 0 }, + { "WORD", "WOrD", 0, 0 }, + { "WORD", "WOrD", 1, 0 }, + { "WORD", "WOrD", 3, 0 }, + { "WORD", "WORd", 0, 0 }, + { "WORD", "WORd", 1, 0 }, + { "WORD", "WORd", 3, 0 } + }; int i; @@ -1281,13 +1319,19 @@ PRBool test_014(void) switch( array[i].sign ) { case -1: - if( rv < 0 ) continue; + if( rv < 0 ) { + continue; + } break; case 1: - if( rv > 0 ) continue; + if( rv > 0 ) { + continue; + } break; case 0: - if( 0 == rv ) continue; + if( 0 == rv ) { + continue; + } break; default: PR_NOT_REACHED("static data inconsistancy"); @@ -1315,36 +1359,36 @@ PRBool test_015(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, 'a', PR_FALSE, 0 }, - { (const char *)0, '\0', PR_FALSE, 0 }, - { "abcdefg", 'a', PR_TRUE, 0 }, - { "abcdefg", 'b', PR_TRUE, 1 }, - { "abcdefg", 'c', PR_TRUE, 2 }, - { "abcdefg", 'd', PR_TRUE, 3 }, - { "abcdefg", 'e', PR_TRUE, 4 }, - { "abcdefg", 'f', PR_TRUE, 5 }, - { "abcdefg", 'g', PR_TRUE, 6 }, - { "abcdefg", 'h', PR_FALSE, 0 }, - { "abcdefg", '\0', PR_TRUE, 7 }, - { "abcdefg", 'A', PR_FALSE, 0 }, - { "abcdefg", 'B', PR_FALSE, 0 }, - { "abcdefg", 'C', PR_FALSE, 0 }, - { "abcdefg", 'D', PR_FALSE, 0 }, - { "abcdefg", 'E', PR_FALSE, 0 }, - { "abcdefg", 'F', PR_FALSE, 0 }, - { "abcdefg", 'G', PR_FALSE, 0 }, - { "abcdefg", 'H', PR_FALSE, 0 }, - { "abcdefgabcdefg", 'a', PR_TRUE, 0 }, - { "abcdefgabcdefg", 'b', PR_TRUE, 1 }, - { "abcdefgabcdefg", 'c', PR_TRUE, 2 }, - { "abcdefgabcdefg", 'd', PR_TRUE, 3 }, - { "abcdefgabcdefg", 'e', PR_TRUE, 4 }, - { "abcdefgabcdefg", 'f', PR_TRUE, 5 }, - { "abcdefgabcdefg", 'g', PR_TRUE, 6 }, - { "abcdefgabcdefg", 'h', PR_FALSE, 0 }, - { "abcdefgabcdefg", '\0', PR_TRUE, 14 } - }; + { + { (const char *)0, 'a', PR_FALSE, 0 }, + { (const char *)0, '\0', PR_FALSE, 0 }, + { "abcdefg", 'a', PR_TRUE, 0 }, + { "abcdefg", 'b', PR_TRUE, 1 }, + { "abcdefg", 'c', PR_TRUE, 2 }, + { "abcdefg", 'd', PR_TRUE, 3 }, + { "abcdefg", 'e', PR_TRUE, 4 }, + { "abcdefg", 'f', PR_TRUE, 5 }, + { "abcdefg", 'g', PR_TRUE, 6 }, + { "abcdefg", 'h', PR_FALSE, 0 }, + { "abcdefg", '\0', PR_TRUE, 7 }, + { "abcdefg", 'A', PR_FALSE, 0 }, + { "abcdefg", 'B', PR_FALSE, 0 }, + { "abcdefg", 'C', PR_FALSE, 0 }, + { "abcdefg", 'D', PR_FALSE, 0 }, + { "abcdefg", 'E', PR_FALSE, 0 }, + { "abcdefg", 'F', PR_FALSE, 0 }, + { "abcdefg", 'G', PR_FALSE, 0 }, + { "abcdefg", 'H', PR_FALSE, 0 }, + { "abcdefgabcdefg", 'a', PR_TRUE, 0 }, + { "abcdefgabcdefg", 'b', PR_TRUE, 1 }, + { "abcdefgabcdefg", 'c', PR_TRUE, 2 }, + { "abcdefgabcdefg", 'd', PR_TRUE, 3 }, + { "abcdefgabcdefg", 'e', PR_TRUE, 4 }, + { "abcdefgabcdefg", 'f', PR_TRUE, 5 }, + { "abcdefgabcdefg", 'g', PR_TRUE, 6 }, + { "abcdefgabcdefg", 'h', PR_FALSE, 0 }, + { "abcdefgabcdefg", '\0', PR_TRUE, 14 } + }; int i; @@ -1395,36 +1439,36 @@ PRBool test_016(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, 'a', PR_FALSE, 0 }, - { (const char *)0, '\0', PR_FALSE, 0 }, - { "abcdefg", 'a', PR_TRUE, 0 }, - { "abcdefg", 'b', PR_TRUE, 1 }, - { "abcdefg", 'c', PR_TRUE, 2 }, - { "abcdefg", 'd', PR_TRUE, 3 }, - { "abcdefg", 'e', PR_TRUE, 4 }, - { "abcdefg", 'f', PR_TRUE, 5 }, - { "abcdefg", 'g', PR_TRUE, 6 }, - { "abcdefg", 'h', PR_FALSE, 0 }, - { "abcdefg", '\0', PR_TRUE, 7 }, - { "abcdefg", 'A', PR_FALSE, 0 }, - { "abcdefg", 'B', PR_FALSE, 0 }, - { "abcdefg", 'C', PR_FALSE, 0 }, - { "abcdefg", 'D', PR_FALSE, 0 }, - { "abcdefg", 'E', PR_FALSE, 0 }, - { "abcdefg", 'F', PR_FALSE, 0 }, - { "abcdefg", 'G', PR_FALSE, 0 }, - { "abcdefg", 'H', PR_FALSE, 0 }, - { "abcdefgabcdefg", 'a', PR_TRUE, 7 }, - { "abcdefgabcdefg", 'b', PR_TRUE, 8 }, - { "abcdefgabcdefg", 'c', PR_TRUE, 9 }, - { "abcdefgabcdefg", 'd', PR_TRUE, 10 }, - { "abcdefgabcdefg", 'e', PR_TRUE, 11 }, - { "abcdefgabcdefg", 'f', PR_TRUE, 12 }, - { "abcdefgabcdefg", 'g', PR_TRUE, 13 }, - { "abcdefgabcdefg", 'h', PR_FALSE, 0 }, - { "abcdefgabcdefg", '\0', PR_TRUE, 14 } - }; + { + { (const char *)0, 'a', PR_FALSE, 0 }, + { (const char *)0, '\0', PR_FALSE, 0 }, + { "abcdefg", 'a', PR_TRUE, 0 }, + { "abcdefg", 'b', PR_TRUE, 1 }, + { "abcdefg", 'c', PR_TRUE, 2 }, + { "abcdefg", 'd', PR_TRUE, 3 }, + { "abcdefg", 'e', PR_TRUE, 4 }, + { "abcdefg", 'f', PR_TRUE, 5 }, + { "abcdefg", 'g', PR_TRUE, 6 }, + { "abcdefg", 'h', PR_FALSE, 0 }, + { "abcdefg", '\0', PR_TRUE, 7 }, + { "abcdefg", 'A', PR_FALSE, 0 }, + { "abcdefg", 'B', PR_FALSE, 0 }, + { "abcdefg", 'C', PR_FALSE, 0 }, + { "abcdefg", 'D', PR_FALSE, 0 }, + { "abcdefg", 'E', PR_FALSE, 0 }, + { "abcdefg", 'F', PR_FALSE, 0 }, + { "abcdefg", 'G', PR_FALSE, 0 }, + { "abcdefg", 'H', PR_FALSE, 0 }, + { "abcdefgabcdefg", 'a', PR_TRUE, 7 }, + { "abcdefgabcdefg", 'b', PR_TRUE, 8 }, + { "abcdefgabcdefg", 'c', PR_TRUE, 9 }, + { "abcdefgabcdefg", 'd', PR_TRUE, 10 }, + { "abcdefgabcdefg", 'e', PR_TRUE, 11 }, + { "abcdefgabcdefg", 'f', PR_TRUE, 12 }, + { "abcdefgabcdefg", 'g', PR_TRUE, 13 }, + { "abcdefgabcdefg", 'h', PR_FALSE, 0 }, + { "abcdefgabcdefg", '\0', PR_TRUE, 14 } + }; int i; @@ -1476,39 +1520,39 @@ PRBool test_017(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, 'a', 2, PR_FALSE, 0 }, - { (const char *)0, '\0', 2, PR_FALSE, 0 }, - { "abcdefg", 'a', 5, PR_TRUE, 0 }, - { "abcdefg", 'b', 5, PR_TRUE, 1 }, - { "abcdefg", 'c', 5, PR_TRUE, 2 }, - { "abcdefg", 'd', 5, PR_TRUE, 3 }, - { "abcdefg", 'e', 5, PR_TRUE, 4 }, - { "abcdefg", 'f', 5, PR_FALSE, 0 }, - { "abcdefg", 'g', 5, PR_FALSE, 0 }, - { "abcdefg", 'h', 5, PR_FALSE, 0 }, - { "abcdefg", '\0', 5, PR_FALSE, 0 }, - { "abcdefg", '\0', 15, PR_TRUE, 7 }, - { "abcdefg", 'A', 5, PR_FALSE, 0 }, - { "abcdefg", 'B', 5, PR_FALSE, 0 }, - { "abcdefg", 'C', 5, PR_FALSE, 0 }, - { "abcdefg", 'D', 5, PR_FALSE, 0 }, - { "abcdefg", 'E', 5, PR_FALSE, 0 }, - { "abcdefg", 'F', 5, PR_FALSE, 0 }, - { "abcdefg", 'G', 5, PR_FALSE, 0 }, - { "abcdefg", 'H', 5, PR_FALSE, 0 }, - { "abcdefgabcdefg", 'a', 10, PR_TRUE, 0 }, - { "abcdefgabcdefg", 'b', 10, PR_TRUE, 1 }, - { "abcdefgabcdefg", 'c', 10, PR_TRUE, 2 }, - { "abcdefgabcdefg", 'd', 10, PR_TRUE, 3 }, - { "abcdefgabcdefg", 'e', 10, PR_TRUE, 4 }, - { "abcdefgabcdefg", 'f', 10, PR_TRUE, 5 }, - { "abcdefgabcdefg", 'g', 10, PR_TRUE, 6 }, - { "abcdefgabcdefg", 'h', 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", '\0', 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", '\0', 14, PR_FALSE, 0 }, - { "abcdefgabcdefg", '\0', 15, PR_TRUE, 14 } - }; + { + { (const char *)0, 'a', 2, PR_FALSE, 0 }, + { (const char *)0, '\0', 2, PR_FALSE, 0 }, + { "abcdefg", 'a', 5, PR_TRUE, 0 }, + { "abcdefg", 'b', 5, PR_TRUE, 1 }, + { "abcdefg", 'c', 5, PR_TRUE, 2 }, + { "abcdefg", 'd', 5, PR_TRUE, 3 }, + { "abcdefg", 'e', 5, PR_TRUE, 4 }, + { "abcdefg", 'f', 5, PR_FALSE, 0 }, + { "abcdefg", 'g', 5, PR_FALSE, 0 }, + { "abcdefg", 'h', 5, PR_FALSE, 0 }, + { "abcdefg", '\0', 5, PR_FALSE, 0 }, + { "abcdefg", '\0', 15, PR_TRUE, 7 }, + { "abcdefg", 'A', 5, PR_FALSE, 0 }, + { "abcdefg", 'B', 5, PR_FALSE, 0 }, + { "abcdefg", 'C', 5, PR_FALSE, 0 }, + { "abcdefg", 'D', 5, PR_FALSE, 0 }, + { "abcdefg", 'E', 5, PR_FALSE, 0 }, + { "abcdefg", 'F', 5, PR_FALSE, 0 }, + { "abcdefg", 'G', 5, PR_FALSE, 0 }, + { "abcdefg", 'H', 5, PR_FALSE, 0 }, + { "abcdefgabcdefg", 'a', 10, PR_TRUE, 0 }, + { "abcdefgabcdefg", 'b', 10, PR_TRUE, 1 }, + { "abcdefgabcdefg", 'c', 10, PR_TRUE, 2 }, + { "abcdefgabcdefg", 'd', 10, PR_TRUE, 3 }, + { "abcdefgabcdefg", 'e', 10, PR_TRUE, 4 }, + { "abcdefgabcdefg", 'f', 10, PR_TRUE, 5 }, + { "abcdefgabcdefg", 'g', 10, PR_TRUE, 6 }, + { "abcdefgabcdefg", 'h', 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", '\0', 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", '\0', 14, PR_FALSE, 0 }, + { "abcdefgabcdefg", '\0', 15, PR_TRUE, 14 } + }; int i; @@ -1560,39 +1604,39 @@ PRBool test_018(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, 'a', 2, PR_FALSE, 0 }, - { (const char *)0, '\0', 2, PR_FALSE, 0 }, - { "abcdefg", 'a', 5, PR_TRUE, 0 }, - { "abcdefg", 'b', 5, PR_TRUE, 1 }, - { "abcdefg", 'c', 5, PR_TRUE, 2 }, - { "abcdefg", 'd', 5, PR_TRUE, 3 }, - { "abcdefg", 'e', 5, PR_TRUE, 4 }, - { "abcdefg", 'f', 5, PR_FALSE, 0 }, - { "abcdefg", 'g', 5, PR_FALSE, 0 }, - { "abcdefg", 'h', 5, PR_FALSE, 0 }, - { "abcdefg", '\0', 5, PR_FALSE, 0 }, - { "abcdefg", '\0', 15, PR_TRUE, 7 }, - { "abcdefg", 'A', 5, PR_FALSE, 0 }, - { "abcdefg", 'B', 5, PR_FALSE, 0 }, - { "abcdefg", 'C', 5, PR_FALSE, 0 }, - { "abcdefg", 'D', 5, PR_FALSE, 0 }, - { "abcdefg", 'E', 5, PR_FALSE, 0 }, - { "abcdefg", 'F', 5, PR_FALSE, 0 }, - { "abcdefg", 'G', 5, PR_FALSE, 0 }, - { "abcdefg", 'H', 5, PR_FALSE, 0 }, - { "abcdefgabcdefg", 'a', 10, PR_TRUE, 7 }, - { "abcdefgabcdefg", 'b', 10, PR_TRUE, 8 }, - { "abcdefgabcdefg", 'c', 10, PR_TRUE, 9 }, - { "abcdefgabcdefg", 'd', 10, PR_TRUE, 3 }, - { "abcdefgabcdefg", 'e', 10, PR_TRUE, 4 }, - { "abcdefgabcdefg", 'f', 10, PR_TRUE, 5 }, - { "abcdefgabcdefg", 'g', 10, PR_TRUE, 6 }, - { "abcdefgabcdefg", 'h', 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", '\0', 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", '\0', 14, PR_FALSE, 0 }, - { "abcdefgabcdefg", '\0', 15, PR_TRUE, 14 } - }; + { + { (const char *)0, 'a', 2, PR_FALSE, 0 }, + { (const char *)0, '\0', 2, PR_FALSE, 0 }, + { "abcdefg", 'a', 5, PR_TRUE, 0 }, + { "abcdefg", 'b', 5, PR_TRUE, 1 }, + { "abcdefg", 'c', 5, PR_TRUE, 2 }, + { "abcdefg", 'd', 5, PR_TRUE, 3 }, + { "abcdefg", 'e', 5, PR_TRUE, 4 }, + { "abcdefg", 'f', 5, PR_FALSE, 0 }, + { "abcdefg", 'g', 5, PR_FALSE, 0 }, + { "abcdefg", 'h', 5, PR_FALSE, 0 }, + { "abcdefg", '\0', 5, PR_FALSE, 0 }, + { "abcdefg", '\0', 15, PR_TRUE, 7 }, + { "abcdefg", 'A', 5, PR_FALSE, 0 }, + { "abcdefg", 'B', 5, PR_FALSE, 0 }, + { "abcdefg", 'C', 5, PR_FALSE, 0 }, + { "abcdefg", 'D', 5, PR_FALSE, 0 }, + { "abcdefg", 'E', 5, PR_FALSE, 0 }, + { "abcdefg", 'F', 5, PR_FALSE, 0 }, + { "abcdefg", 'G', 5, PR_FALSE, 0 }, + { "abcdefg", 'H', 5, PR_FALSE, 0 }, + { "abcdefgabcdefg", 'a', 10, PR_TRUE, 7 }, + { "abcdefgabcdefg", 'b', 10, PR_TRUE, 8 }, + { "abcdefgabcdefg", 'c', 10, PR_TRUE, 9 }, + { "abcdefgabcdefg", 'd', 10, PR_TRUE, 3 }, + { "abcdefgabcdefg", 'e', 10, PR_TRUE, 4 }, + { "abcdefgabcdefg", 'f', 10, PR_TRUE, 5 }, + { "abcdefgabcdefg", 'g', 10, PR_TRUE, 6 }, + { "abcdefgabcdefg", 'h', 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", '\0', 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", '\0', 14, PR_FALSE, 0 }, + { "abcdefgabcdefg", '\0', 15, PR_TRUE, 14 } + }; int i; @@ -1643,41 +1687,41 @@ PRBool test_019(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, (const char *)0, PR_FALSE, 0 }, - { (const char *)0, "abc", PR_FALSE, 0 }, - { "abc", (const char *)0, PR_FALSE, 0 }, - { "abcdefg", "", PR_FALSE, 0 }, - { "", "aeiou", PR_FALSE, 0 }, - { "abcdefg", "ae", PR_TRUE, 0 }, - { "abcdefg", "ei", PR_TRUE, 4 }, - { "abcdefg", "io", PR_FALSE, 0 }, - { "abcdefg", "bcd", PR_TRUE, 1 }, - { "abcdefg", "cbd", PR_TRUE, 1 }, - { "abcdefg", "dbc", PR_TRUE, 1 }, - { "abcdefg", "ghi", PR_TRUE, 6 }, - { "abcdefg", "AE", PR_FALSE, 0 }, - { "abcdefg", "EI", PR_FALSE, 0 }, - { "abcdefg", "IO", PR_FALSE, 0 }, - { "abcdefg", "BCD", PR_FALSE, 0 }, - { "abcdefg", "CBD", PR_FALSE, 0 }, - { "abcdefg", "DBC", PR_FALSE, 0 }, - { "abcdefg", "GHI", PR_FALSE, 0 }, - { "abcdefgabcdefg", "ae", PR_TRUE, 0 }, - { "abcdefgabcdefg", "ei", PR_TRUE, 4 }, - { "abcdefgabcdefg", "io", PR_FALSE, 0 }, - { "abcdefgabcdefg", "bcd", PR_TRUE, 1 }, - { "abcdefgabcdefg", "cbd", PR_TRUE, 1 }, - { "abcdefgabcdefg", "dbc", PR_TRUE, 1 }, - { "abcdefgabcdefg", "ghi", PR_TRUE, 6 }, - { "abcdefgabcdefg", "AE", PR_FALSE, 0 }, - { "abcdefgabcdefg", "EI", PR_FALSE, 0 }, - { "abcdefgabcdefg", "IO", PR_FALSE, 0 }, - { "abcdefgabcdefg", "BCD", PR_FALSE, 0 }, - { "abcdefgabcdefg", "CBD", PR_FALSE, 0 }, - { "abcdefgabcdefg", "DBC", PR_FALSE, 0 }, - { "abcdefgabcdefg", "GHI", PR_FALSE, 0 } - }; + { + { (const char *)0, (const char *)0, PR_FALSE, 0 }, + { (const char *)0, "abc", PR_FALSE, 0 }, + { "abc", (const char *)0, PR_FALSE, 0 }, + { "abcdefg", "", PR_FALSE, 0 }, + { "", "aeiou", PR_FALSE, 0 }, + { "abcdefg", "ae", PR_TRUE, 0 }, + { "abcdefg", "ei", PR_TRUE, 4 }, + { "abcdefg", "io", PR_FALSE, 0 }, + { "abcdefg", "bcd", PR_TRUE, 1 }, + { "abcdefg", "cbd", PR_TRUE, 1 }, + { "abcdefg", "dbc", PR_TRUE, 1 }, + { "abcdefg", "ghi", PR_TRUE, 6 }, + { "abcdefg", "AE", PR_FALSE, 0 }, + { "abcdefg", "EI", PR_FALSE, 0 }, + { "abcdefg", "IO", PR_FALSE, 0 }, + { "abcdefg", "BCD", PR_FALSE, 0 }, + { "abcdefg", "CBD", PR_FALSE, 0 }, + { "abcdefg", "DBC", PR_FALSE, 0 }, + { "abcdefg", "GHI", PR_FALSE, 0 }, + { "abcdefgabcdefg", "ae", PR_TRUE, 0 }, + { "abcdefgabcdefg", "ei", PR_TRUE, 4 }, + { "abcdefgabcdefg", "io", PR_FALSE, 0 }, + { "abcdefgabcdefg", "bcd", PR_TRUE, 1 }, + { "abcdefgabcdefg", "cbd", PR_TRUE, 1 }, + { "abcdefgabcdefg", "dbc", PR_TRUE, 1 }, + { "abcdefgabcdefg", "ghi", PR_TRUE, 6 }, + { "abcdefgabcdefg", "AE", PR_FALSE, 0 }, + { "abcdefgabcdefg", "EI", PR_FALSE, 0 }, + { "abcdefgabcdefg", "IO", PR_FALSE, 0 }, + { "abcdefgabcdefg", "BCD", PR_FALSE, 0 }, + { "abcdefgabcdefg", "CBD", PR_FALSE, 0 }, + { "abcdefgabcdefg", "DBC", PR_FALSE, 0 }, + { "abcdefgabcdefg", "GHI", PR_FALSE, 0 } + }; int i; @@ -1691,9 +1735,9 @@ PRBool test_019(void) { if( (char *)0 != rv ) { - printf("FAIL %d: %s,%s -> %.32s, not null\n", i, + printf("FAIL %d: %s,%s -> %.32s, not null\n", i, array[i].str ? array[i].str : "(null)", - array[i].chrs ? array[i].chrs : "(null)", + array[i].chrs ? array[i].chrs : "(null)", rv); return PR_FALSE; } @@ -1704,7 +1748,7 @@ PRBool test_019(void) { printf("FAIL %d: %s,%s -> null, not +%lu\n", i, array[i].str ? array[i].str : "(null)", - array[i].chrs ? array[i].chrs : "(null)", + array[i].chrs ? array[i].chrs : "(null)", array[i].off); return PR_FALSE; } @@ -1713,7 +1757,7 @@ PRBool test_019(void) { printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, array[i].str ? array[i].str : "(null)", - array[i].chrs ? array[i].chrs : "(null)", + array[i].chrs ? array[i].chrs : "(null)", rv, array[i].str, array[i].off); return PR_FALSE; } @@ -1734,41 +1778,41 @@ PRBool test_020(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, (const char *)0, PR_FALSE, 0 }, - { (const char *)0, "abc", PR_FALSE, 0 }, - { "abc", (const char *)0, PR_FALSE, 0 }, - { "abcdefg", "", PR_FALSE, 0 }, - { "", "aeiou", PR_FALSE, 0 }, - { "abcdefg", "ae", PR_TRUE, 4 }, - { "abcdefg", "ei", PR_TRUE, 4 }, - { "abcdefg", "io", PR_FALSE, 0 }, - { "abcdefg", "bcd", PR_TRUE, 3 }, - { "abcdefg", "cbd", PR_TRUE, 3 }, - { "abcdefg", "dbc", PR_TRUE, 3 }, - { "abcdefg", "ghi", PR_TRUE, 6 }, - { "abcdefg", "AE", PR_FALSE, 0 }, - { "abcdefg", "EI", PR_FALSE, 0 }, - { "abcdefg", "IO", PR_FALSE, 0 }, - { "abcdefg", "BCD", PR_FALSE, 0 }, - { "abcdefg", "CBD", PR_FALSE, 0 }, - { "abcdefg", "DBC", PR_FALSE, 0 }, - { "abcdefg", "GHI", PR_FALSE, 0 }, - { "abcdefgabcdefg", "ae", PR_TRUE, 11 }, - { "abcdefgabcdefg", "ei", PR_TRUE, 11 }, - { "abcdefgabcdefg", "io", PR_FALSE, 0 }, - { "abcdefgabcdefg", "bcd", PR_TRUE, 10 }, - { "abcdefgabcdefg", "cbd", PR_TRUE, 10 }, - { "abcdefgabcdefg", "dbc", PR_TRUE, 10 }, - { "abcdefgabcdefg", "ghi", PR_TRUE, 13 }, - { "abcdefgabcdefg", "AE", PR_FALSE, 0 }, - { "abcdefgabcdefg", "EI", PR_FALSE, 0 }, - { "abcdefgabcdefg", "IO", PR_FALSE, 0 }, - { "abcdefgabcdefg", "BCD", PR_FALSE, 0 }, - { "abcdefgabcdefg", "CBD", PR_FALSE, 0 }, - { "abcdefgabcdefg", "DBC", PR_FALSE, 0 }, - { "abcdefgabcdefg", "GHI", PR_FALSE, 0 } - }; + { + { (const char *)0, (const char *)0, PR_FALSE, 0 }, + { (const char *)0, "abc", PR_FALSE, 0 }, + { "abc", (const char *)0, PR_FALSE, 0 }, + { "abcdefg", "", PR_FALSE, 0 }, + { "", "aeiou", PR_FALSE, 0 }, + { "abcdefg", "ae", PR_TRUE, 4 }, + { "abcdefg", "ei", PR_TRUE, 4 }, + { "abcdefg", "io", PR_FALSE, 0 }, + { "abcdefg", "bcd", PR_TRUE, 3 }, + { "abcdefg", "cbd", PR_TRUE, 3 }, + { "abcdefg", "dbc", PR_TRUE, 3 }, + { "abcdefg", "ghi", PR_TRUE, 6 }, + { "abcdefg", "AE", PR_FALSE, 0 }, + { "abcdefg", "EI", PR_FALSE, 0 }, + { "abcdefg", "IO", PR_FALSE, 0 }, + { "abcdefg", "BCD", PR_FALSE, 0 }, + { "abcdefg", "CBD", PR_FALSE, 0 }, + { "abcdefg", "DBC", PR_FALSE, 0 }, + { "abcdefg", "GHI", PR_FALSE, 0 }, + { "abcdefgabcdefg", "ae", PR_TRUE, 11 }, + { "abcdefgabcdefg", "ei", PR_TRUE, 11 }, + { "abcdefgabcdefg", "io", PR_FALSE, 0 }, + { "abcdefgabcdefg", "bcd", PR_TRUE, 10 }, + { "abcdefgabcdefg", "cbd", PR_TRUE, 10 }, + { "abcdefgabcdefg", "dbc", PR_TRUE, 10 }, + { "abcdefgabcdefg", "ghi", PR_TRUE, 13 }, + { "abcdefgabcdefg", "AE", PR_FALSE, 0 }, + { "abcdefgabcdefg", "EI", PR_FALSE, 0 }, + { "abcdefgabcdefg", "IO", PR_FALSE, 0 }, + { "abcdefgabcdefg", "BCD", PR_FALSE, 0 }, + { "abcdefgabcdefg", "CBD", PR_FALSE, 0 }, + { "abcdefgabcdefg", "DBC", PR_FALSE, 0 }, + { "abcdefgabcdefg", "GHI", PR_FALSE, 0 } + }; int i; @@ -1782,9 +1826,9 @@ PRBool test_020(void) { if( (char *)0 != rv ) { - printf("FAIL %d: %s,%s -> %.32s, not null\n", i, + printf("FAIL %d: %s,%s -> %.32s, not null\n", i, array[i].str ? array[i].str : "(null)", - array[i].chrs ? array[i].chrs : "(null)", + array[i].chrs ? array[i].chrs : "(null)", rv); return PR_FALSE; } @@ -1795,7 +1839,7 @@ PRBool test_020(void) { printf("FAIL %d: %s,%s -> null, not +%lu\n", i, array[i].str ? array[i].str : "(null)", - array[i].chrs ? array[i].chrs : "(null)", + array[i].chrs ? array[i].chrs : "(null)", array[i].off); return PR_FALSE; } @@ -1804,7 +1848,7 @@ PRBool test_020(void) { printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, array[i].str ? array[i].str : "(null)", - array[i].chrs ? array[i].chrs : "(null)", + array[i].chrs ? array[i].chrs : "(null)", rv, array[i].str, array[i].off); return PR_FALSE; } @@ -1814,7 +1858,7 @@ PRBool test_020(void) printf("PASS\n"); return PR_TRUE; } - + /* PL_strnpbrk */ PRBool test_021(void) { @@ -1826,46 +1870,46 @@ PRBool test_021(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, (const char *)0, 3, PR_FALSE, 0 }, - { (const char *)0, "abc", 3, PR_FALSE, 0 }, - { "abc", (const char *)0, 3, PR_FALSE, 0 }, - { "abcdefg", "", 3, PR_FALSE, 0 }, - { "", "aeiou", 3, PR_FALSE, 0 }, - { "abcdefg", "ae", 0, PR_FALSE, 0 }, - { "abcdefg", "ae", 1, PR_TRUE, 0 }, - { "abcdefg", "ae", 4, PR_TRUE, 0 }, - { "abcdefg", "ae", 5, PR_TRUE, 0 }, - { "abcdefg", "ae", 6, PR_TRUE, 0 }, - { "abcdefg", "ei", 4, PR_FALSE, 0 }, - { "abcdefg", "io", 10, PR_FALSE, 0 }, - { "abcdefg", "bcd", 2, PR_TRUE, 1 }, - { "abcdefg", "cbd", 2, PR_TRUE, 1 }, - { "abcdefg", "dbc", 2, PR_TRUE, 1 }, - { "abcdefg", "ghi", 6, PR_FALSE, 0 }, - { "abcdefg", "ghi", 7, PR_TRUE, 6 }, - { "abcdefg", "AE", 9, PR_FALSE, 0 }, - { "abcdefg", "EI", 9, PR_FALSE, 0 }, - { "abcdefg", "IO", 9, PR_FALSE, 0 }, - { "abcdefg", "BCD", 9, PR_FALSE, 0 }, - { "abcdefg", "CBD", 9, PR_FALSE, 0 }, - { "abcdefg", "DBC", 9, PR_FALSE, 0 }, - { "abcdefg", "GHI", 9, PR_FALSE, 0 }, - { "abcdefgabcdefg", "ae", 10, PR_TRUE, 0 }, - { "abcdefgabcdefg", "ei", 10, PR_TRUE, 4 }, - { "abcdefgabcdefg", "io", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "bcd", 10, PR_TRUE, 1 }, - { "abcdefgabcdefg", "cbd", 10, PR_TRUE, 1 }, - { "abcdefgabcdefg", "dbc", 10, PR_TRUE, 1 }, - { "abcdefgabcdefg", "ghi", 10, PR_TRUE, 6 }, - { "abcdefgabcdefg", "AE", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "EI", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "IO", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "BCD", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "CBD", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "DBC", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "GHI", 10, PR_FALSE, 0 } - }; + { + { (const char *)0, (const char *)0, 3, PR_FALSE, 0 }, + { (const char *)0, "abc", 3, PR_FALSE, 0 }, + { "abc", (const char *)0, 3, PR_FALSE, 0 }, + { "abcdefg", "", 3, PR_FALSE, 0 }, + { "", "aeiou", 3, PR_FALSE, 0 }, + { "abcdefg", "ae", 0, PR_FALSE, 0 }, + { "abcdefg", "ae", 1, PR_TRUE, 0 }, + { "abcdefg", "ae", 4, PR_TRUE, 0 }, + { "abcdefg", "ae", 5, PR_TRUE, 0 }, + { "abcdefg", "ae", 6, PR_TRUE, 0 }, + { "abcdefg", "ei", 4, PR_FALSE, 0 }, + { "abcdefg", "io", 10, PR_FALSE, 0 }, + { "abcdefg", "bcd", 2, PR_TRUE, 1 }, + { "abcdefg", "cbd", 2, PR_TRUE, 1 }, + { "abcdefg", "dbc", 2, PR_TRUE, 1 }, + { "abcdefg", "ghi", 6, PR_FALSE, 0 }, + { "abcdefg", "ghi", 7, PR_TRUE, 6 }, + { "abcdefg", "AE", 9, PR_FALSE, 0 }, + { "abcdefg", "EI", 9, PR_FALSE, 0 }, + { "abcdefg", "IO", 9, PR_FALSE, 0 }, + { "abcdefg", "BCD", 9, PR_FALSE, 0 }, + { "abcdefg", "CBD", 9, PR_FALSE, 0 }, + { "abcdefg", "DBC", 9, PR_FALSE, 0 }, + { "abcdefg", "GHI", 9, PR_FALSE, 0 }, + { "abcdefgabcdefg", "ae", 10, PR_TRUE, 0 }, + { "abcdefgabcdefg", "ei", 10, PR_TRUE, 4 }, + { "abcdefgabcdefg", "io", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "bcd", 10, PR_TRUE, 1 }, + { "abcdefgabcdefg", "cbd", 10, PR_TRUE, 1 }, + { "abcdefgabcdefg", "dbc", 10, PR_TRUE, 1 }, + { "abcdefgabcdefg", "ghi", 10, PR_TRUE, 6 }, + { "abcdefgabcdefg", "AE", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "EI", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "IO", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "BCD", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "CBD", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "DBC", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "GHI", 10, PR_FALSE, 0 } + }; int i; @@ -1879,9 +1923,9 @@ PRBool test_021(void) { if( (char *)0 != rv ) { - printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i, + printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i, array[i].str ? array[i].str : "(null)", - array[i].chrs ? array[i].chrs : "(null)", + array[i].chrs ? array[i].chrs : "(null)", array[i].max, rv); return PR_FALSE; } @@ -1892,7 +1936,7 @@ PRBool test_021(void) { printf("FAIL %d: %s,%s/%lu -> null, not +%lu\n", i, array[i].str ? array[i].str : "(null)", - array[i].chrs ? array[i].chrs : "(null)", + array[i].chrs ? array[i].chrs : "(null)", array[i].max, array[i].off); return PR_FALSE; } @@ -1901,7 +1945,7 @@ PRBool test_021(void) { printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, array[i].str ? array[i].str : "(null)", - array[i].chrs ? array[i].chrs : "(null)", + array[i].chrs ? array[i].chrs : "(null)", array[i].max, rv, array[i].str, array[i].off); return PR_FALSE; } @@ -1923,55 +1967,55 @@ PRBool test_022(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, (const char *)0, 3, PR_FALSE, 0 }, - { (const char *)0, "abc", 3, PR_FALSE, 0 }, - { "abc", (const char *)0, 3, PR_FALSE, 0 }, - { "abcdefg", "", 3, PR_FALSE, 0 }, - { "", "aeiou", 3, PR_FALSE, 0 }, - { "abcdefg", "ae", 0, PR_FALSE, 0 }, - { "abcdefg", "ae", 1, PR_TRUE, 0 }, - { "abcdefg", "ae", 4, PR_TRUE, 0 }, - { "abcdefg", "ae", 5, PR_TRUE, 4 }, - { "abcdefg", "ae", 6, PR_TRUE, 4 }, - { "abcdefg", "ei", 4, PR_FALSE, 0 }, - { "abcdefg", "io", 10, PR_FALSE, 0 }, - { "abcdefg", "bcd", 2, PR_TRUE, 1 }, - { "abcdefg", "cbd", 2, PR_TRUE, 1 }, - { "abcdefg", "dbc", 2, PR_TRUE, 1 }, - { "abcdefg", "bcd", 3, PR_TRUE, 2 }, - { "abcdefg", "cbd", 3, PR_TRUE, 2 }, - { "abcdefg", "dbc", 3, PR_TRUE, 2 }, - { "abcdefg", "bcd", 5, PR_TRUE, 3 }, - { "abcdefg", "cbd", 5, PR_TRUE, 3 }, - { "abcdefg", "dbc", 5, PR_TRUE, 3 }, - { "abcdefg", "bcd", 15, PR_TRUE, 3 }, - { "abcdefg", "cbd", 15, PR_TRUE, 3 }, - { "abcdefg", "dbc", 15, PR_TRUE, 3 }, - { "abcdefg", "ghi", 6, PR_FALSE, 0 }, - { "abcdefg", "ghi", 7, PR_TRUE, 6 }, - { "abcdefg", "AE", 9, PR_FALSE, 0 }, - { "abcdefg", "EI", 9, PR_FALSE, 0 }, - { "abcdefg", "IO", 9, PR_FALSE, 0 }, - { "abcdefg", "BCD", 9, PR_FALSE, 0 }, - { "abcdefg", "CBD", 9, PR_FALSE, 0 }, - { "abcdefg", "DBC", 9, PR_FALSE, 0 }, - { "abcdefg", "GHI", 9, PR_FALSE, 0 }, - { "abcdefgabcdefg", "ae", 10, PR_TRUE, 7 }, - { "abcdefgabcdefg", "ei", 10, PR_TRUE, 4 }, - { "abcdefgabcdefg", "io", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "bcd", 10, PR_TRUE, 9 }, - { "abcdefgabcdefg", "cbd", 10, PR_TRUE, 9 }, - { "abcdefgabcdefg", "dbc", 10, PR_TRUE, 9 }, - { "abcdefgabcdefg", "ghi", 10, PR_TRUE, 6 }, - { "abcdefgabcdefg", "AE", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "EI", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "IO", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "BCD", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "CBD", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "DBC", 10, PR_FALSE, 0 }, - { "abcdefgabcdefg", "GHI", 10, PR_FALSE, 0 } - }; + { + { (const char *)0, (const char *)0, 3, PR_FALSE, 0 }, + { (const char *)0, "abc", 3, PR_FALSE, 0 }, + { "abc", (const char *)0, 3, PR_FALSE, 0 }, + { "abcdefg", "", 3, PR_FALSE, 0 }, + { "", "aeiou", 3, PR_FALSE, 0 }, + { "abcdefg", "ae", 0, PR_FALSE, 0 }, + { "abcdefg", "ae", 1, PR_TRUE, 0 }, + { "abcdefg", "ae", 4, PR_TRUE, 0 }, + { "abcdefg", "ae", 5, PR_TRUE, 4 }, + { "abcdefg", "ae", 6, PR_TRUE, 4 }, + { "abcdefg", "ei", 4, PR_FALSE, 0 }, + { "abcdefg", "io", 10, PR_FALSE, 0 }, + { "abcdefg", "bcd", 2, PR_TRUE, 1 }, + { "abcdefg", "cbd", 2, PR_TRUE, 1 }, + { "abcdefg", "dbc", 2, PR_TRUE, 1 }, + { "abcdefg", "bcd", 3, PR_TRUE, 2 }, + { "abcdefg", "cbd", 3, PR_TRUE, 2 }, + { "abcdefg", "dbc", 3, PR_TRUE, 2 }, + { "abcdefg", "bcd", 5, PR_TRUE, 3 }, + { "abcdefg", "cbd", 5, PR_TRUE, 3 }, + { "abcdefg", "dbc", 5, PR_TRUE, 3 }, + { "abcdefg", "bcd", 15, PR_TRUE, 3 }, + { "abcdefg", "cbd", 15, PR_TRUE, 3 }, + { "abcdefg", "dbc", 15, PR_TRUE, 3 }, + { "abcdefg", "ghi", 6, PR_FALSE, 0 }, + { "abcdefg", "ghi", 7, PR_TRUE, 6 }, + { "abcdefg", "AE", 9, PR_FALSE, 0 }, + { "abcdefg", "EI", 9, PR_FALSE, 0 }, + { "abcdefg", "IO", 9, PR_FALSE, 0 }, + { "abcdefg", "BCD", 9, PR_FALSE, 0 }, + { "abcdefg", "CBD", 9, PR_FALSE, 0 }, + { "abcdefg", "DBC", 9, PR_FALSE, 0 }, + { "abcdefg", "GHI", 9, PR_FALSE, 0 }, + { "abcdefgabcdefg", "ae", 10, PR_TRUE, 7 }, + { "abcdefgabcdefg", "ei", 10, PR_TRUE, 4 }, + { "abcdefgabcdefg", "io", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "bcd", 10, PR_TRUE, 9 }, + { "abcdefgabcdefg", "cbd", 10, PR_TRUE, 9 }, + { "abcdefgabcdefg", "dbc", 10, PR_TRUE, 9 }, + { "abcdefgabcdefg", "ghi", 10, PR_TRUE, 6 }, + { "abcdefgabcdefg", "AE", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "EI", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "IO", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "BCD", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "CBD", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "DBC", 10, PR_FALSE, 0 }, + { "abcdefgabcdefg", "GHI", 10, PR_FALSE, 0 } + }; int i; @@ -1985,9 +2029,9 @@ PRBool test_022(void) { if( (char *)0 != rv ) { - printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i, + printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i, array[i].str ? array[i].str : "(null)", - array[i].chrs ? array[i].chrs : "(null)", + array[i].chrs ? array[i].chrs : "(null)", array[i].max, rv); return PR_FALSE; } @@ -1998,7 +2042,7 @@ PRBool test_022(void) { printf("FAIL %d: %s,%s/%lu -> null, not +%lu\n", i, array[i].str ? array[i].str : "(null)", - array[i].chrs ? array[i].chrs : "(null)", + array[i].chrs ? array[i].chrs : "(null)", array[i].max, array[i].off); return PR_FALSE; } @@ -2007,7 +2051,7 @@ PRBool test_022(void) { printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, array[i].str ? array[i].str : "(null)", - array[i].chrs ? array[i].chrs : "(null)", + array[i].chrs ? array[i].chrs : "(null)", array[i].max, rv, array[i].str, array[i].off); return PR_FALSE; } @@ -2028,58 +2072,58 @@ PRBool test_023(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, (const char *)0, PR_FALSE, 0 }, - { (const char *)0, "blah", PR_FALSE, 0 }, - { "blah-de-blah", (const char *)0, PR_FALSE, 0 }, - { "blah-de-blah", "blah", PR_TRUE, 0 }, - { "", "blah", PR_FALSE, 0 }, - { "blah-de-blah", "", PR_FALSE, 0 }, - { "abcdefg", "a", PR_TRUE, 0 }, - { "abcdefg", "c", PR_TRUE, 2 }, - { "abcdefg", "e", PR_TRUE, 4 }, - { "abcdefg", "g", PR_TRUE, 6 }, - { "abcdefg", "i", PR_FALSE, 0 }, - { "abcdefg", "ab", PR_TRUE, 0 }, - { "abcdefg", "cd", PR_TRUE, 2 }, - { "abcdefg", "ef", PR_TRUE, 4 }, - { "abcdefg", "gh", PR_FALSE, 0 }, - { "abcdabc", "bc", PR_TRUE, 1 }, - { "abcdefg", "abcdefg", PR_TRUE, 0 }, - { "abcdefgabcdefg", "a", PR_TRUE, 0 }, - { "abcdefgabcdefg", "c", PR_TRUE, 2 }, - { "abcdefgabcdefg", "e", PR_TRUE, 4 }, - { "abcdefgabcdefg", "g", PR_TRUE, 6 }, - { "abcdefgabcdefg", "i", PR_FALSE, 0 }, - { "abcdefgabcdefg", "ab", PR_TRUE, 0 }, - { "abcdefgabcdefg", "cd", PR_TRUE, 2 }, - { "abcdefgabcdefg", "ef", PR_TRUE, 4 }, - { "abcdefgabcdefg", "gh", PR_FALSE, 0 }, - { "abcdabcabcdabc", "bc", PR_TRUE, 1 }, - { "abcdefgabcdefg", "abcdefg", PR_TRUE, 0 }, - { "ABCDEFG", "a", PR_FALSE, 0 }, - { "ABCDEFG", "c", PR_FALSE, 0 }, - { "ABCDEFG", "e", PR_FALSE, 0 }, - { "ABCDEFG", "g", PR_FALSE, 0 }, - { "ABCDEFG", "i", PR_FALSE, 0 }, - { "ABCDEFG", "ab", PR_FALSE, 0 }, - { "ABCDEFG", "cd", PR_FALSE, 0 }, - { "ABCDEFG", "ef", PR_FALSE, 0 }, - { "ABCDEFG", "gh", PR_FALSE, 0 }, - { "ABCDABC", "bc", PR_FALSE, 0 }, - { "ABCDEFG", "abcdefg", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "a", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "c", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "e", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "g", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "i", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "ab", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "cd", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "ef", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "gh", PR_FALSE, 0 }, - { "ABCDABCABCDABC", "bc", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "abcdefg", PR_FALSE, 0 } - }; + { + { (const char *)0, (const char *)0, PR_FALSE, 0 }, + { (const char *)0, "blah", PR_FALSE, 0 }, + { "blah-de-blah", (const char *)0, PR_FALSE, 0 }, + { "blah-de-blah", "blah", PR_TRUE, 0 }, + { "", "blah", PR_FALSE, 0 }, + { "blah-de-blah", "", PR_FALSE, 0 }, + { "abcdefg", "a", PR_TRUE, 0 }, + { "abcdefg", "c", PR_TRUE, 2 }, + { "abcdefg", "e", PR_TRUE, 4 }, + { "abcdefg", "g", PR_TRUE, 6 }, + { "abcdefg", "i", PR_FALSE, 0 }, + { "abcdefg", "ab", PR_TRUE, 0 }, + { "abcdefg", "cd", PR_TRUE, 2 }, + { "abcdefg", "ef", PR_TRUE, 4 }, + { "abcdefg", "gh", PR_FALSE, 0 }, + { "abcdabc", "bc", PR_TRUE, 1 }, + { "abcdefg", "abcdefg", PR_TRUE, 0 }, + { "abcdefgabcdefg", "a", PR_TRUE, 0 }, + { "abcdefgabcdefg", "c", PR_TRUE, 2 }, + { "abcdefgabcdefg", "e", PR_TRUE, 4 }, + { "abcdefgabcdefg", "g", PR_TRUE, 6 }, + { "abcdefgabcdefg", "i", PR_FALSE, 0 }, + { "abcdefgabcdefg", "ab", PR_TRUE, 0 }, + { "abcdefgabcdefg", "cd", PR_TRUE, 2 }, + { "abcdefgabcdefg", "ef", PR_TRUE, 4 }, + { "abcdefgabcdefg", "gh", PR_FALSE, 0 }, + { "abcdabcabcdabc", "bc", PR_TRUE, 1 }, + { "abcdefgabcdefg", "abcdefg", PR_TRUE, 0 }, + { "ABCDEFG", "a", PR_FALSE, 0 }, + { "ABCDEFG", "c", PR_FALSE, 0 }, + { "ABCDEFG", "e", PR_FALSE, 0 }, + { "ABCDEFG", "g", PR_FALSE, 0 }, + { "ABCDEFG", "i", PR_FALSE, 0 }, + { "ABCDEFG", "ab", PR_FALSE, 0 }, + { "ABCDEFG", "cd", PR_FALSE, 0 }, + { "ABCDEFG", "ef", PR_FALSE, 0 }, + { "ABCDEFG", "gh", PR_FALSE, 0 }, + { "ABCDABC", "bc", PR_FALSE, 0 }, + { "ABCDEFG", "abcdefg", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "a", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "c", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "e", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "g", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "i", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "ab", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "cd", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "ef", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "gh", PR_FALSE, 0 }, + { "ABCDABCABCDABC", "bc", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "abcdefg", PR_FALSE, 0 } + }; int i; @@ -2113,7 +2157,7 @@ PRBool test_023(void) if( &array[i].str[ array[i].off ] != rv ) { - printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, + printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, array[i].str ? array[i].str : "(null)", array[i].sub ? array[i].sub : "(null)", rv, array[i].str, array[i].off); @@ -2136,58 +2180,58 @@ PRBool test_024(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, (const char *)0, PR_FALSE, 0 }, - { (const char *)0, "blah", PR_FALSE, 0 }, - { "blah-de-blah", (const char *)0, PR_FALSE, 0 }, - { "blah-de-blah", "blah", PR_TRUE, 8 }, - { "", "blah", PR_FALSE, 0 }, - { "blah-de-blah", "", PR_FALSE, 0 }, - { "abcdefg", "a", PR_TRUE, 0 }, - { "abcdefg", "c", PR_TRUE, 2 }, - { "abcdefg", "e", PR_TRUE, 4 }, - { "abcdefg", "g", PR_TRUE, 6 }, - { "abcdefg", "i", PR_FALSE, 0 }, - { "abcdefg", "ab", PR_TRUE, 0 }, - { "abcdefg", "cd", PR_TRUE, 2 }, - { "abcdefg", "ef", PR_TRUE, 4 }, - { "abcdefg", "gh", PR_FALSE, 0 }, - { "abcdabc", "bc", PR_TRUE, 5 }, - { "abcdefg", "abcdefg", PR_TRUE, 0 }, - { "abcdefgabcdefg", "a", PR_TRUE, 7 }, - { "abcdefgabcdefg", "c", PR_TRUE, 9 }, - { "abcdefgabcdefg", "e", PR_TRUE, 11 }, - { "abcdefgabcdefg", "g", PR_TRUE, 13 }, - { "abcdefgabcdefg", "i", PR_FALSE, 0 }, - { "abcdefgabcdefg", "ab", PR_TRUE, 7 }, - { "abcdefgabcdefg", "cd", PR_TRUE, 9 }, - { "abcdefgabcdefg", "ef", PR_TRUE, 11 }, - { "abcdefgabcdefg", "gh", PR_FALSE, 0 }, - { "abcdabcabcdabc", "bc", PR_TRUE, 12 }, - { "abcdefgabcdefg", "abcdefg", PR_TRUE, 7 }, - { "ABCDEFG", "a", PR_FALSE, 0 }, - { "ABCDEFG", "c", PR_FALSE, 0 }, - { "ABCDEFG", "e", PR_FALSE, 0 }, - { "ABCDEFG", "g", PR_FALSE, 0 }, - { "ABCDEFG", "i", PR_FALSE, 0 }, - { "ABCDEFG", "ab", PR_FALSE, 0 }, - { "ABCDEFG", "cd", PR_FALSE, 0 }, - { "ABCDEFG", "ef", PR_FALSE, 0 }, - { "ABCDEFG", "gh", PR_FALSE, 0 }, - { "ABCDABC", "bc", PR_FALSE, 0 }, - { "ABCDEFG", "abcdefg", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "a", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "c", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "e", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "g", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "i", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "ab", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "cd", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "ef", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "gh", PR_FALSE, 0 }, - { "ABCDABCABCDABC", "bc", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "abcdefg", PR_FALSE, 0 } - }; + { + { (const char *)0, (const char *)0, PR_FALSE, 0 }, + { (const char *)0, "blah", PR_FALSE, 0 }, + { "blah-de-blah", (const char *)0, PR_FALSE, 0 }, + { "blah-de-blah", "blah", PR_TRUE, 8 }, + { "", "blah", PR_FALSE, 0 }, + { "blah-de-blah", "", PR_FALSE, 0 }, + { "abcdefg", "a", PR_TRUE, 0 }, + { "abcdefg", "c", PR_TRUE, 2 }, + { "abcdefg", "e", PR_TRUE, 4 }, + { "abcdefg", "g", PR_TRUE, 6 }, + { "abcdefg", "i", PR_FALSE, 0 }, + { "abcdefg", "ab", PR_TRUE, 0 }, + { "abcdefg", "cd", PR_TRUE, 2 }, + { "abcdefg", "ef", PR_TRUE, 4 }, + { "abcdefg", "gh", PR_FALSE, 0 }, + { "abcdabc", "bc", PR_TRUE, 5 }, + { "abcdefg", "abcdefg", PR_TRUE, 0 }, + { "abcdefgabcdefg", "a", PR_TRUE, 7 }, + { "abcdefgabcdefg", "c", PR_TRUE, 9 }, + { "abcdefgabcdefg", "e", PR_TRUE, 11 }, + { "abcdefgabcdefg", "g", PR_TRUE, 13 }, + { "abcdefgabcdefg", "i", PR_FALSE, 0 }, + { "abcdefgabcdefg", "ab", PR_TRUE, 7 }, + { "abcdefgabcdefg", "cd", PR_TRUE, 9 }, + { "abcdefgabcdefg", "ef", PR_TRUE, 11 }, + { "abcdefgabcdefg", "gh", PR_FALSE, 0 }, + { "abcdabcabcdabc", "bc", PR_TRUE, 12 }, + { "abcdefgabcdefg", "abcdefg", PR_TRUE, 7 }, + { "ABCDEFG", "a", PR_FALSE, 0 }, + { "ABCDEFG", "c", PR_FALSE, 0 }, + { "ABCDEFG", "e", PR_FALSE, 0 }, + { "ABCDEFG", "g", PR_FALSE, 0 }, + { "ABCDEFG", "i", PR_FALSE, 0 }, + { "ABCDEFG", "ab", PR_FALSE, 0 }, + { "ABCDEFG", "cd", PR_FALSE, 0 }, + { "ABCDEFG", "ef", PR_FALSE, 0 }, + { "ABCDEFG", "gh", PR_FALSE, 0 }, + { "ABCDABC", "bc", PR_FALSE, 0 }, + { "ABCDEFG", "abcdefg", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "a", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "c", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "e", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "g", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "i", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "ab", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "cd", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "ef", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "gh", PR_FALSE, 0 }, + { "ABCDABCABCDABC", "bc", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "abcdefg", PR_FALSE, 0 } + }; int i; @@ -2221,7 +2265,7 @@ PRBool test_024(void) if( &array[i].str[ array[i].off ] != rv ) { - printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, + printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, array[i].str ? array[i].str : "(null)", array[i].sub ? array[i].sub : "(null)", rv, array[i].str, array[i].off); @@ -2245,79 +2289,79 @@ PRBool test_025(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, (const char *)0, 12, PR_FALSE, 0 }, - { (const char *)0, "blah", 12, PR_FALSE, 0 }, - { "blah-de-blah", (const char *)0, 12, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 0, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 2, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 3, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 4, PR_TRUE, 0 }, - { "blah-de-blah", "blah", 5, PR_TRUE, 0 }, - { "blah-de-blah", "blah", 12, PR_TRUE, 0 }, - { "", "blah", 12, PR_FALSE, 0 }, - { "blah-de-blah", "", 12, PR_FALSE, 0 }, - { "abcdefg", "a", 5, PR_TRUE, 0 }, - { "abcdefg", "c", 5, PR_TRUE, 2 }, - { "abcdefg", "e", 5, PR_TRUE, 4 }, - { "abcdefg", "g", 5, PR_FALSE, 0 }, - { "abcdefg", "i", 5, PR_FALSE, 0 }, - { "abcdefg", "ab", 5, PR_TRUE, 0 }, - { "abcdefg", "cd", 5, PR_TRUE, 2 }, - { "abcdefg", "ef", 5, PR_FALSE, 0 }, - { "abcdefg", "gh", 5, PR_FALSE, 0 }, - { "abcdabc", "bc", 5, PR_TRUE, 1 }, - { "abcdabc", "bc", 6, PR_TRUE, 1 }, - { "abcdabc", "bc", 7, PR_TRUE, 1 }, - { "abcdefg", "abcdefg", 6, PR_FALSE, 0 }, - { "abcdefg", "abcdefg", 7, PR_TRUE, 0 }, - { "abcdefg", "abcdefg", 8, PR_TRUE, 0 }, - { "abcdefgabcdefg", "a", 12, PR_TRUE, 0 }, - { "abcdefgabcdefg", "c", 12, PR_TRUE, 2 }, - { "abcdefgabcdefg", "e", 12, PR_TRUE, 4 }, - { "abcdefgabcdefg", "g", 12, PR_TRUE, 6 }, - { "abcdefgabcdefg", "i", 12, PR_FALSE, 0 }, - { "abcdefgabcdefg", "ab", 12, PR_TRUE, 0 }, - { "abcdefgabcdefg", "cd", 12, PR_TRUE, 2 }, - { "abcdefgabcdefg", "ef", 12, PR_TRUE, 4 }, - { "abcdefgabcdefg", "gh", 12, PR_FALSE, 0 }, - { "abcdabcabcdabc", "bc", 5, PR_TRUE, 1 }, - { "abcdabcabcdabc", "bc", 6, PR_TRUE, 1 }, - { "abcdabcabcdabc", "bc", 7, PR_TRUE, 1 }, - { "abcdefgabcdefg", "abcdefg", 6, PR_FALSE, 0 }, - { "abcdefgabcdefg", "abcdefg", 7, PR_TRUE, 0 }, - { "abcdefgabcdefg", "abcdefg", 8, PR_TRUE, 0 }, - { "ABCDEFG", "a", 5, PR_FALSE, 0 }, - { "ABCDEFG", "c", 5, PR_FALSE, 0 }, - { "ABCDEFG", "e", 5, PR_FALSE, 0 }, - { "ABCDEFG", "g", 5, PR_FALSE, 0 }, - { "ABCDEFG", "i", 5, PR_FALSE, 0 }, - { "ABCDEFG", "ab", 5, PR_FALSE, 0 }, - { "ABCDEFG", "cd", 5, PR_FALSE, 0 }, - { "ABCDEFG", "ef", 5, PR_FALSE, 0 }, - { "ABCDEFG", "gh", 5, PR_FALSE, 0 }, - { "ABCDABC", "bc", 5, PR_FALSE, 0 }, - { "ABCDABC", "bc", 6, PR_FALSE, 0 }, - { "ABCDABC", "bc", 7, PR_FALSE, 0 }, - { "ABCDEFG", "abcdefg", 6, PR_FALSE, 0 }, - { "ABCDEFG", "abcdefg", 7, PR_FALSE, 0 }, - { "ABCDEFG", "abcdefg", 8, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "a", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "c", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "e", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "g", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "i", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "ab", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "cd", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "ef", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "gh", 12, PR_FALSE, 0 }, - { "ABCDABCABCDABC", "bc", 5, PR_FALSE, 0 }, - { "ABCDABCABCDABC", "bc", 6, PR_FALSE, 0 }, - { "ABCDABCABCDABC", "bc", 7, PR_FALSE, }, - { "ABCDEFGABCDEFG", "abcdefg", 6, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "abcdefg", 7, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "abcdefg", 8, PR_FALSE, 0 } - }; + { + { (const char *)0, (const char *)0, 12, PR_FALSE, 0 }, + { (const char *)0, "blah", 12, PR_FALSE, 0 }, + { "blah-de-blah", (const char *)0, 12, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 0, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 2, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 3, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 4, PR_TRUE, 0 }, + { "blah-de-blah", "blah", 5, PR_TRUE, 0 }, + { "blah-de-blah", "blah", 12, PR_TRUE, 0 }, + { "", "blah", 12, PR_FALSE, 0 }, + { "blah-de-blah", "", 12, PR_FALSE, 0 }, + { "abcdefg", "a", 5, PR_TRUE, 0 }, + { "abcdefg", "c", 5, PR_TRUE, 2 }, + { "abcdefg", "e", 5, PR_TRUE, 4 }, + { "abcdefg", "g", 5, PR_FALSE, 0 }, + { "abcdefg", "i", 5, PR_FALSE, 0 }, + { "abcdefg", "ab", 5, PR_TRUE, 0 }, + { "abcdefg", "cd", 5, PR_TRUE, 2 }, + { "abcdefg", "ef", 5, PR_FALSE, 0 }, + { "abcdefg", "gh", 5, PR_FALSE, 0 }, + { "abcdabc", "bc", 5, PR_TRUE, 1 }, + { "abcdabc", "bc", 6, PR_TRUE, 1 }, + { "abcdabc", "bc", 7, PR_TRUE, 1 }, + { "abcdefg", "abcdefg", 6, PR_FALSE, 0 }, + { "abcdefg", "abcdefg", 7, PR_TRUE, 0 }, + { "abcdefg", "abcdefg", 8, PR_TRUE, 0 }, + { "abcdefgabcdefg", "a", 12, PR_TRUE, 0 }, + { "abcdefgabcdefg", "c", 12, PR_TRUE, 2 }, + { "abcdefgabcdefg", "e", 12, PR_TRUE, 4 }, + { "abcdefgabcdefg", "g", 12, PR_TRUE, 6 }, + { "abcdefgabcdefg", "i", 12, PR_FALSE, 0 }, + { "abcdefgabcdefg", "ab", 12, PR_TRUE, 0 }, + { "abcdefgabcdefg", "cd", 12, PR_TRUE, 2 }, + { "abcdefgabcdefg", "ef", 12, PR_TRUE, 4 }, + { "abcdefgabcdefg", "gh", 12, PR_FALSE, 0 }, + { "abcdabcabcdabc", "bc", 5, PR_TRUE, 1 }, + { "abcdabcabcdabc", "bc", 6, PR_TRUE, 1 }, + { "abcdabcabcdabc", "bc", 7, PR_TRUE, 1 }, + { "abcdefgabcdefg", "abcdefg", 6, PR_FALSE, 0 }, + { "abcdefgabcdefg", "abcdefg", 7, PR_TRUE, 0 }, + { "abcdefgabcdefg", "abcdefg", 8, PR_TRUE, 0 }, + { "ABCDEFG", "a", 5, PR_FALSE, 0 }, + { "ABCDEFG", "c", 5, PR_FALSE, 0 }, + { "ABCDEFG", "e", 5, PR_FALSE, 0 }, + { "ABCDEFG", "g", 5, PR_FALSE, 0 }, + { "ABCDEFG", "i", 5, PR_FALSE, 0 }, + { "ABCDEFG", "ab", 5, PR_FALSE, 0 }, + { "ABCDEFG", "cd", 5, PR_FALSE, 0 }, + { "ABCDEFG", "ef", 5, PR_FALSE, 0 }, + { "ABCDEFG", "gh", 5, PR_FALSE, 0 }, + { "ABCDABC", "bc", 5, PR_FALSE, 0 }, + { "ABCDABC", "bc", 6, PR_FALSE, 0 }, + { "ABCDABC", "bc", 7, PR_FALSE, 0 }, + { "ABCDEFG", "abcdefg", 6, PR_FALSE, 0 }, + { "ABCDEFG", "abcdefg", 7, PR_FALSE, 0 }, + { "ABCDEFG", "abcdefg", 8, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "a", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "c", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "e", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "g", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "i", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "ab", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "cd", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "ef", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "gh", 12, PR_FALSE, 0 }, + { "ABCDABCABCDABC", "bc", 5, PR_FALSE, 0 }, + { "ABCDABCABCDABC", "bc", 6, PR_FALSE, 0 }, + { "ABCDABCABCDABC", "bc", 7, PR_FALSE, }, + { "ABCDEFGABCDEFG", "abcdefg", 6, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "abcdefg", 7, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "abcdefg", 8, PR_FALSE, 0 } + }; int i; @@ -2351,7 +2395,7 @@ PRBool test_025(void) if( &array[i].str[ array[i].off ] != rv ) { - printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, + printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, array[i].str ? array[i].str : "(null)", array[i].sub ? array[i].sub : "(null)", array[i].max, rv, array[i].str, array[i].off); @@ -2375,81 +2419,81 @@ PRBool test_026(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, (const char *)0, 12, PR_FALSE, 0 }, - { (const char *)0, "blah", 12, PR_FALSE, 0 }, - { "blah-de-blah", (const char *)0, 12, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 0, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 2, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 3, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 4, PR_TRUE, 0 }, - { "blah-de-blah", "blah", 5, PR_TRUE, 0 }, - { "blah-de-blah", "blah", 11, PR_TRUE, 0 }, - { "blah-de-blah", "blah", 12, PR_TRUE, 8 }, - { "blah-de-blah", "blah", 13, PR_TRUE, 8 }, - { "", "blah", 12, PR_FALSE, 0 }, - { "blah-de-blah", "", 12, PR_FALSE, 0 }, - { "abcdefg", "a", 5, PR_TRUE, 0 }, - { "abcdefg", "c", 5, PR_TRUE, 2 }, - { "abcdefg", "e", 5, PR_TRUE, 4 }, - { "abcdefg", "g", 5, PR_FALSE, 0 }, - { "abcdefg", "i", 5, PR_FALSE, 0 }, - { "abcdefg", "ab", 5, PR_TRUE, 0 }, - { "abcdefg", "cd", 5, PR_TRUE, 2 }, - { "abcdefg", "ef", 5, PR_FALSE, 0 }, - { "abcdefg", "gh", 5, PR_FALSE, 0 }, - { "abcdabc", "bc", 5, PR_TRUE, 1 }, - { "abcdabc", "bc", 6, PR_TRUE, 1 }, - { "abcdabc", "bc", 7, PR_TRUE, 5 }, - { "abcdefg", "abcdefg", 6, PR_FALSE, 0 }, - { "abcdefg", "abcdefg", 7, PR_TRUE, 0 }, - { "abcdefg", "abcdefg", 8, PR_TRUE, 0 }, - { "abcdefgabcdefg", "a", 12, PR_TRUE, 7 }, - { "abcdefgabcdefg", "c", 12, PR_TRUE, 9 }, - { "abcdefgabcdefg", "e", 12, PR_TRUE, 11 }, - { "abcdefgabcdefg", "g", 12, PR_TRUE, 6 }, - { "abcdefgabcdefg", "i", 12, PR_FALSE, 0 }, - { "abcdefgabcdefg", "ab", 12, PR_TRUE, 7 }, - { "abcdefgabcdefg", "cd", 12, PR_TRUE, 9 }, - { "abcdefgabcdefg", "ef", 12, PR_TRUE, 4 }, - { "abcdefgabcdefg", "gh", 12, PR_FALSE, 0 }, - { "abcdabcabcdabc", "bc", 12, PR_TRUE, 8 }, - { "abcdabcabcdabc", "bc", 13, PR_TRUE, 8 }, - { "abcdabcabcdabc", "bc", 14, PR_TRUE, 12 }, - { "abcdefgabcdefg", "abcdefg", 13, PR_TRUE, 0 }, - { "abcdefgabcdefg", "abcdefg", 14, PR_TRUE, 7 }, - { "abcdefgabcdefg", "abcdefg", 15, PR_TRUE, 7 }, - { "ABCDEFG", "a", 5, PR_FALSE, 0 }, - { "ABCDEFG", "c", 5, PR_FALSE, 0 }, - { "ABCDEFG", "e", 5, PR_FALSE, 0 }, - { "ABCDEFG", "g", 5, PR_FALSE, 0 }, - { "ABCDEFG", "i", 5, PR_FALSE, 0 }, - { "ABCDEFG", "ab", 5, PR_FALSE, 0 }, - { "ABCDEFG", "cd", 5, PR_FALSE, 0 }, - { "ABCDEFG", "ef", 5, PR_FALSE, 0 }, - { "ABCDEFG", "gh", 5, PR_FALSE, 0 }, - { "ABCDABC", "bc", 5, PR_FALSE, 0 }, - { "ABCDABC", "bc", 6, PR_FALSE, 0 }, - { "ABCDABC", "bc", 7, PR_FALSE, 0 }, - { "ABCDEFG", "abcdefg", 6, PR_FALSE, 0 }, - { "ABCDEFG", "abcdefg", 7, PR_FALSE, 0 }, - { "ABCDEFG", "abcdefg", 8, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "a", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "c", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "e", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "g", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "i", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "ab", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "cd", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "ef", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "gh", 12, PR_FALSE, 0 }, - { "ABCDABCABCDABC", "bc", 12, PR_FALSE, 0 }, - { "ABCDABCABCDABC", "bc", 13, PR_FALSE, 0 }, - { "ABCDABCABCDABC", "bc", 14, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "abcdefg", 13, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "abcdefg", 14, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "abcdefg", 15, PR_FALSE, 0 } - }; + { + { (const char *)0, (const char *)0, 12, PR_FALSE, 0 }, + { (const char *)0, "blah", 12, PR_FALSE, 0 }, + { "blah-de-blah", (const char *)0, 12, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 0, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 2, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 3, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 4, PR_TRUE, 0 }, + { "blah-de-blah", "blah", 5, PR_TRUE, 0 }, + { "blah-de-blah", "blah", 11, PR_TRUE, 0 }, + { "blah-de-blah", "blah", 12, PR_TRUE, 8 }, + { "blah-de-blah", "blah", 13, PR_TRUE, 8 }, + { "", "blah", 12, PR_FALSE, 0 }, + { "blah-de-blah", "", 12, PR_FALSE, 0 }, + { "abcdefg", "a", 5, PR_TRUE, 0 }, + { "abcdefg", "c", 5, PR_TRUE, 2 }, + { "abcdefg", "e", 5, PR_TRUE, 4 }, + { "abcdefg", "g", 5, PR_FALSE, 0 }, + { "abcdefg", "i", 5, PR_FALSE, 0 }, + { "abcdefg", "ab", 5, PR_TRUE, 0 }, + { "abcdefg", "cd", 5, PR_TRUE, 2 }, + { "abcdefg", "ef", 5, PR_FALSE, 0 }, + { "abcdefg", "gh", 5, PR_FALSE, 0 }, + { "abcdabc", "bc", 5, PR_TRUE, 1 }, + { "abcdabc", "bc", 6, PR_TRUE, 1 }, + { "abcdabc", "bc", 7, PR_TRUE, 5 }, + { "abcdefg", "abcdefg", 6, PR_FALSE, 0 }, + { "abcdefg", "abcdefg", 7, PR_TRUE, 0 }, + { "abcdefg", "abcdefg", 8, PR_TRUE, 0 }, + { "abcdefgabcdefg", "a", 12, PR_TRUE, 7 }, + { "abcdefgabcdefg", "c", 12, PR_TRUE, 9 }, + { "abcdefgabcdefg", "e", 12, PR_TRUE, 11 }, + { "abcdefgabcdefg", "g", 12, PR_TRUE, 6 }, + { "abcdefgabcdefg", "i", 12, PR_FALSE, 0 }, + { "abcdefgabcdefg", "ab", 12, PR_TRUE, 7 }, + { "abcdefgabcdefg", "cd", 12, PR_TRUE, 9 }, + { "abcdefgabcdefg", "ef", 12, PR_TRUE, 4 }, + { "abcdefgabcdefg", "gh", 12, PR_FALSE, 0 }, + { "abcdabcabcdabc", "bc", 12, PR_TRUE, 8 }, + { "abcdabcabcdabc", "bc", 13, PR_TRUE, 8 }, + { "abcdabcabcdabc", "bc", 14, PR_TRUE, 12 }, + { "abcdefgabcdefg", "abcdefg", 13, PR_TRUE, 0 }, + { "abcdefgabcdefg", "abcdefg", 14, PR_TRUE, 7 }, + { "abcdefgabcdefg", "abcdefg", 15, PR_TRUE, 7 }, + { "ABCDEFG", "a", 5, PR_FALSE, 0 }, + { "ABCDEFG", "c", 5, PR_FALSE, 0 }, + { "ABCDEFG", "e", 5, PR_FALSE, 0 }, + { "ABCDEFG", "g", 5, PR_FALSE, 0 }, + { "ABCDEFG", "i", 5, PR_FALSE, 0 }, + { "ABCDEFG", "ab", 5, PR_FALSE, 0 }, + { "ABCDEFG", "cd", 5, PR_FALSE, 0 }, + { "ABCDEFG", "ef", 5, PR_FALSE, 0 }, + { "ABCDEFG", "gh", 5, PR_FALSE, 0 }, + { "ABCDABC", "bc", 5, PR_FALSE, 0 }, + { "ABCDABC", "bc", 6, PR_FALSE, 0 }, + { "ABCDABC", "bc", 7, PR_FALSE, 0 }, + { "ABCDEFG", "abcdefg", 6, PR_FALSE, 0 }, + { "ABCDEFG", "abcdefg", 7, PR_FALSE, 0 }, + { "ABCDEFG", "abcdefg", 8, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "a", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "c", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "e", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "g", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "i", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "ab", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "cd", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "ef", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "gh", 12, PR_FALSE, 0 }, + { "ABCDABCABCDABC", "bc", 12, PR_FALSE, 0 }, + { "ABCDABCABCDABC", "bc", 13, PR_FALSE, 0 }, + { "ABCDABCABCDABC", "bc", 14, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "abcdefg", 13, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "abcdefg", 14, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "abcdefg", 15, PR_FALSE, 0 } + }; int i; @@ -2483,7 +2527,7 @@ PRBool test_026(void) if( &array[i].str[ array[i].off ] != rv ) { - printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, + printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, array[i].str ? array[i].str : "(null)", array[i].sub ? array[i].sub : "(null)", array[i].max, rv, array[i].str, array[i].off); @@ -2506,58 +2550,58 @@ PRBool test_027(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, (const char *)0, PR_FALSE, 0 }, - { (const char *)0, "blah", PR_FALSE, 0 }, - { "blah-de-blah", (const char *)0, PR_FALSE, 0 }, - { "blah-de-blah", "blah", PR_TRUE, 0 }, - { "", "blah", PR_FALSE, 0 }, - { "blah-de-blah", "", PR_FALSE, 0 }, - { "abcdefg", "a", PR_TRUE, 0 }, - { "abcdefg", "c", PR_TRUE, 2 }, - { "abcdefg", "e", PR_TRUE, 4 }, - { "abcdefg", "g", PR_TRUE, 6 }, - { "abcdefg", "i", PR_FALSE, 0 }, - { "abcdefg", "ab", PR_TRUE, 0 }, - { "abcdefg", "cd", PR_TRUE, 2 }, - { "abcdefg", "ef", PR_TRUE, 4 }, - { "abcdefg", "gh", PR_FALSE, 0 }, - { "abcdabc", "bc", PR_TRUE, 1 }, - { "abcdefg", "abcdefg", PR_TRUE, 0 }, - { "abcdefgabcdefg", "a", PR_TRUE, 0 }, - { "abcdefgabcdefg", "c", PR_TRUE, 2 }, - { "abcdefgabcdefg", "e", PR_TRUE, 4 }, - { "abcdefgabcdefg", "g", PR_TRUE, 6 }, - { "abcdefgabcdefg", "i", PR_FALSE, 0 }, - { "abcdefgabcdefg", "ab", PR_TRUE, 0 }, - { "abcdefgabcdefg", "cd", PR_TRUE, 2 }, - { "abcdefgabcdefg", "ef", PR_TRUE, 4 }, - { "abcdefgabcdefg", "gh", PR_FALSE, 0 }, - { "abcdabcabcdabc", "bc", PR_TRUE, 1 }, - { "abcdefgabcdefg", "abcdefg", PR_TRUE, 0 }, - { "ABCDEFG", "a", PR_TRUE, 0 }, - { "ABCDEFG", "c", PR_TRUE, 2 }, - { "ABCDEFG", "e", PR_TRUE, 4 }, - { "ABCDEFG", "g", PR_TRUE, 6 }, - { "ABCDEFG", "i", PR_FALSE, 0 }, - { "ABCDEFG", "ab", PR_TRUE, 0 }, - { "ABCDEFG", "cd", PR_TRUE, 2 }, - { "ABCDEFG", "ef", PR_TRUE, 4 }, - { "ABCDEFG", "gh", PR_FALSE, 0 }, - { "ABCDABC", "bc", PR_TRUE, 1 }, - { "ABCDEFG", "abcdefg", PR_TRUE, 0 }, - { "ABCDEFGABCDEFG", "a", PR_TRUE, 0 }, - { "ABCDEFGABCDEFG", "c", PR_TRUE, 2 }, - { "ABCDEFGABCDEFG", "e", PR_TRUE, 4 }, - { "ABCDEFGABCDEFG", "g", PR_TRUE, 6 }, - { "ABCDEFGABCDEFG", "i", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "ab", PR_TRUE, 0 }, - { "ABCDEFGABCDEFG", "cd", PR_TRUE, 2 }, - { "ABCDEFGABCDEFG", "ef", PR_TRUE, 4 }, - { "ABCDEFGABCDEFG", "gh", PR_FALSE, 0 }, - { "ABCDABCABCDABC", "bc", PR_TRUE, 1 }, - { "ABCDEFGABCDEFG", "abcdefg", PR_TRUE, 0 } - }; + { + { (const char *)0, (const char *)0, PR_FALSE, 0 }, + { (const char *)0, "blah", PR_FALSE, 0 }, + { "blah-de-blah", (const char *)0, PR_FALSE, 0 }, + { "blah-de-blah", "blah", PR_TRUE, 0 }, + { "", "blah", PR_FALSE, 0 }, + { "blah-de-blah", "", PR_FALSE, 0 }, + { "abcdefg", "a", PR_TRUE, 0 }, + { "abcdefg", "c", PR_TRUE, 2 }, + { "abcdefg", "e", PR_TRUE, 4 }, + { "abcdefg", "g", PR_TRUE, 6 }, + { "abcdefg", "i", PR_FALSE, 0 }, + { "abcdefg", "ab", PR_TRUE, 0 }, + { "abcdefg", "cd", PR_TRUE, 2 }, + { "abcdefg", "ef", PR_TRUE, 4 }, + { "abcdefg", "gh", PR_FALSE, 0 }, + { "abcdabc", "bc", PR_TRUE, 1 }, + { "abcdefg", "abcdefg", PR_TRUE, 0 }, + { "abcdefgabcdefg", "a", PR_TRUE, 0 }, + { "abcdefgabcdefg", "c", PR_TRUE, 2 }, + { "abcdefgabcdefg", "e", PR_TRUE, 4 }, + { "abcdefgabcdefg", "g", PR_TRUE, 6 }, + { "abcdefgabcdefg", "i", PR_FALSE, 0 }, + { "abcdefgabcdefg", "ab", PR_TRUE, 0 }, + { "abcdefgabcdefg", "cd", PR_TRUE, 2 }, + { "abcdefgabcdefg", "ef", PR_TRUE, 4 }, + { "abcdefgabcdefg", "gh", PR_FALSE, 0 }, + { "abcdabcabcdabc", "bc", PR_TRUE, 1 }, + { "abcdefgabcdefg", "abcdefg", PR_TRUE, 0 }, + { "ABCDEFG", "a", PR_TRUE, 0 }, + { "ABCDEFG", "c", PR_TRUE, 2 }, + { "ABCDEFG", "e", PR_TRUE, 4 }, + { "ABCDEFG", "g", PR_TRUE, 6 }, + { "ABCDEFG", "i", PR_FALSE, 0 }, + { "ABCDEFG", "ab", PR_TRUE, 0 }, + { "ABCDEFG", "cd", PR_TRUE, 2 }, + { "ABCDEFG", "ef", PR_TRUE, 4 }, + { "ABCDEFG", "gh", PR_FALSE, 0 }, + { "ABCDABC", "bc", PR_TRUE, 1 }, + { "ABCDEFG", "abcdefg", PR_TRUE, 0 }, + { "ABCDEFGABCDEFG", "a", PR_TRUE, 0 }, + { "ABCDEFGABCDEFG", "c", PR_TRUE, 2 }, + { "ABCDEFGABCDEFG", "e", PR_TRUE, 4 }, + { "ABCDEFGABCDEFG", "g", PR_TRUE, 6 }, + { "ABCDEFGABCDEFG", "i", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "ab", PR_TRUE, 0 }, + { "ABCDEFGABCDEFG", "cd", PR_TRUE, 2 }, + { "ABCDEFGABCDEFG", "ef", PR_TRUE, 4 }, + { "ABCDEFGABCDEFG", "gh", PR_FALSE, 0 }, + { "ABCDABCABCDABC", "bc", PR_TRUE, 1 }, + { "ABCDEFGABCDEFG", "abcdefg", PR_TRUE, 0 } + }; int i; @@ -2591,7 +2635,7 @@ PRBool test_027(void) if( &array[i].str[ array[i].off ] != rv ) { - printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, + printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, array[i].str ? array[i].str : "(null)", array[i].sub ? array[i].sub : "(null)", rv, array[i].str, array[i].off); @@ -2614,58 +2658,58 @@ PRBool test_028(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, (const char *)0, PR_FALSE, 0 }, - { (const char *)0, "blah", PR_FALSE, 0 }, - { "blah-de-blah", (const char *)0, PR_FALSE, 0 }, - { "blah-de-blah", "blah", PR_TRUE, 8 }, - { "", "blah", PR_FALSE, 0 }, - { "blah-de-blah", "", PR_FALSE, 0 }, - { "abcdefg", "a", PR_TRUE, 0 }, - { "abcdefg", "c", PR_TRUE, 2 }, - { "abcdefg", "e", PR_TRUE, 4 }, - { "abcdefg", "g", PR_TRUE, 6 }, - { "abcdefg", "i", PR_FALSE, 0 }, - { "abcdefg", "ab", PR_TRUE, 0 }, - { "abcdefg", "cd", PR_TRUE, 2 }, - { "abcdefg", "ef", PR_TRUE, 4 }, - { "abcdefg", "gh", PR_FALSE, 0 }, - { "abcdabc", "bc", PR_TRUE, 5 }, - { "abcdefg", "abcdefg", PR_TRUE, 0 }, - { "abcdefgabcdefg", "a", PR_TRUE, 7 }, - { "abcdefgabcdefg", "c", PR_TRUE, 9 }, - { "abcdefgabcdefg", "e", PR_TRUE, 11 }, - { "abcdefgabcdefg", "g", PR_TRUE, 13 }, - { "abcdefgabcdefg", "i", PR_FALSE, 0 }, - { "abcdefgabcdefg", "ab", PR_TRUE, 7 }, - { "abcdefgabcdefg", "cd", PR_TRUE, 9 }, - { "abcdefgabcdefg", "ef", PR_TRUE, 11 }, - { "abcdefgabcdefg", "gh", PR_FALSE, 0 }, - { "abcdabcabcdabc", "bc", PR_TRUE, 12 }, - { "abcdefgabcdefg", "abcdefg", PR_TRUE, 7 }, - { "ABCDEFG", "a", PR_TRUE, 0 }, - { "ABCDEFG", "c", PR_TRUE, 2 }, - { "ABCDEFG", "e", PR_TRUE, 4 }, - { "ABCDEFG", "g", PR_TRUE, 6 }, - { "ABCDEFG", "i", PR_FALSE, 0 }, - { "ABCDEFG", "ab", PR_TRUE, 0 }, - { "ABCDEFG", "cd", PR_TRUE, 2 }, - { "ABCDEFG", "ef", PR_TRUE, 4 }, - { "ABCDEFG", "gh", PR_FALSE, 0 }, - { "ABCDABC", "bc", PR_TRUE, 5 }, - { "ABCDEFG", "abcdefg", PR_TRUE, 0 }, - { "ABCDEFGABCDEFG", "a", PR_TRUE, 7 }, - { "ABCDEFGABCDEFG", "c", PR_TRUE, 9 }, - { "ABCDEFGABCDEFG", "e", PR_TRUE, 11 }, - { "ABCDEFGABCDEFG", "g", PR_TRUE, 13 }, - { "ABCDEFGABCDEFG", "i", PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "ab", PR_TRUE, 7 }, - { "ABCDEFGABCDEFG", "cd", PR_TRUE, 9 }, - { "ABCDEFGABCDEFG", "ef", PR_TRUE, 11 }, - { "ABCDEFGABCDEFG", "gh", PR_FALSE, 0 }, - { "ABCDABCABCDABC", "bc", PR_TRUE, 12 }, - { "ABCDEFGABCDEFG", "abcdefg", PR_TRUE, 7 } - }; + { + { (const char *)0, (const char *)0, PR_FALSE, 0 }, + { (const char *)0, "blah", PR_FALSE, 0 }, + { "blah-de-blah", (const char *)0, PR_FALSE, 0 }, + { "blah-de-blah", "blah", PR_TRUE, 8 }, + { "", "blah", PR_FALSE, 0 }, + { "blah-de-blah", "", PR_FALSE, 0 }, + { "abcdefg", "a", PR_TRUE, 0 }, + { "abcdefg", "c", PR_TRUE, 2 }, + { "abcdefg", "e", PR_TRUE, 4 }, + { "abcdefg", "g", PR_TRUE, 6 }, + { "abcdefg", "i", PR_FALSE, 0 }, + { "abcdefg", "ab", PR_TRUE, 0 }, + { "abcdefg", "cd", PR_TRUE, 2 }, + { "abcdefg", "ef", PR_TRUE, 4 }, + { "abcdefg", "gh", PR_FALSE, 0 }, + { "abcdabc", "bc", PR_TRUE, 5 }, + { "abcdefg", "abcdefg", PR_TRUE, 0 }, + { "abcdefgabcdefg", "a", PR_TRUE, 7 }, + { "abcdefgabcdefg", "c", PR_TRUE, 9 }, + { "abcdefgabcdefg", "e", PR_TRUE, 11 }, + { "abcdefgabcdefg", "g", PR_TRUE, 13 }, + { "abcdefgabcdefg", "i", PR_FALSE, 0 }, + { "abcdefgabcdefg", "ab", PR_TRUE, 7 }, + { "abcdefgabcdefg", "cd", PR_TRUE, 9 }, + { "abcdefgabcdefg", "ef", PR_TRUE, 11 }, + { "abcdefgabcdefg", "gh", PR_FALSE, 0 }, + { "abcdabcabcdabc", "bc", PR_TRUE, 12 }, + { "abcdefgabcdefg", "abcdefg", PR_TRUE, 7 }, + { "ABCDEFG", "a", PR_TRUE, 0 }, + { "ABCDEFG", "c", PR_TRUE, 2 }, + { "ABCDEFG", "e", PR_TRUE, 4 }, + { "ABCDEFG", "g", PR_TRUE, 6 }, + { "ABCDEFG", "i", PR_FALSE, 0 }, + { "ABCDEFG", "ab", PR_TRUE, 0 }, + { "ABCDEFG", "cd", PR_TRUE, 2 }, + { "ABCDEFG", "ef", PR_TRUE, 4 }, + { "ABCDEFG", "gh", PR_FALSE, 0 }, + { "ABCDABC", "bc", PR_TRUE, 5 }, + { "ABCDEFG", "abcdefg", PR_TRUE, 0 }, + { "ABCDEFGABCDEFG", "a", PR_TRUE, 7 }, + { "ABCDEFGABCDEFG", "c", PR_TRUE, 9 }, + { "ABCDEFGABCDEFG", "e", PR_TRUE, 11 }, + { "ABCDEFGABCDEFG", "g", PR_TRUE, 13 }, + { "ABCDEFGABCDEFG", "i", PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "ab", PR_TRUE, 7 }, + { "ABCDEFGABCDEFG", "cd", PR_TRUE, 9 }, + { "ABCDEFGABCDEFG", "ef", PR_TRUE, 11 }, + { "ABCDEFGABCDEFG", "gh", PR_FALSE, 0 }, + { "ABCDABCABCDABC", "bc", PR_TRUE, 12 }, + { "ABCDEFGABCDEFG", "abcdefg", PR_TRUE, 7 } + }; int i; @@ -2699,7 +2743,7 @@ PRBool test_028(void) if( &array[i].str[ array[i].off ] != rv ) { - printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, + printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, array[i].str ? array[i].str : "(null)", array[i].sub ? array[i].sub : "(null)", rv, array[i].str, array[i].off); @@ -2723,79 +2767,79 @@ PRBool test_029(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, (const char *)0, 12, PR_FALSE, 0 }, - { (const char *)0, "blah", 12, PR_FALSE, 0 }, - { "blah-de-blah", (const char *)0, 12, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 0, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 2, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 3, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 4, PR_TRUE, 0 }, - { "blah-de-blah", "blah", 5, PR_TRUE, 0 }, - { "blah-de-blah", "blah", 12, PR_TRUE, 0 }, - { "", "blah", 12, PR_FALSE, 0 }, - { "blah-de-blah", "", 12, PR_FALSE, 0 }, - { "abcdefg", "a", 5, PR_TRUE, 0 }, - { "abcdefg", "c", 5, PR_TRUE, 2 }, - { "abcdefg", "e", 5, PR_TRUE, 4 }, - { "abcdefg", "g", 5, PR_FALSE, 0 }, - { "abcdefg", "i", 5, PR_FALSE, 0 }, - { "abcdefg", "ab", 5, PR_TRUE, 0 }, - { "abcdefg", "cd", 5, PR_TRUE, 2 }, - { "abcdefg", "ef", 5, PR_FALSE, 0 }, - { "abcdefg", "gh", 5, PR_FALSE, 0 }, - { "abcdabc", "bc", 5, PR_TRUE, 1 }, - { "abcdabc", "bc", 6, PR_TRUE, 1 }, - { "abcdabc", "bc", 7, PR_TRUE, 1 }, - { "abcdefg", "abcdefg", 6, PR_FALSE, 0 }, - { "abcdefg", "abcdefg", 7, PR_TRUE, 0 }, - { "abcdefg", "abcdefg", 8, PR_TRUE, 0 }, - { "abcdefgabcdefg", "a", 12, PR_TRUE, 0 }, - { "abcdefgabcdefg", "c", 12, PR_TRUE, 2 }, - { "abcdefgabcdefg", "e", 12, PR_TRUE, 4 }, - { "abcdefgabcdefg", "g", 12, PR_TRUE, 6 }, - { "abcdefgabcdefg", "i", 12, PR_FALSE, 0 }, - { "abcdefgabcdefg", "ab", 12, PR_TRUE, 0 }, - { "abcdefgabcdefg", "cd", 12, PR_TRUE, 2 }, - { "abcdefgabcdefg", "ef", 12, PR_TRUE, 4 }, - { "abcdefgabcdefg", "gh", 12, PR_FALSE, 0 }, - { "abcdabcabcdabc", "bc", 5, PR_TRUE, 1 }, - { "abcdabcabcdabc", "bc", 6, PR_TRUE, 1 }, - { "abcdabcabcdabc", "bc", 7, PR_TRUE, 1 }, - { "abcdefgabcdefg", "abcdefg", 6, PR_FALSE, 0 }, - { "abcdefgabcdefg", "abcdefg", 7, PR_TRUE, 0 }, - { "abcdefgabcdefg", "abcdefg", 8, PR_TRUE, 0 }, - { "ABCDEFG", "a", 5, PR_TRUE, 0 }, - { "ABCDEFG", "c", 5, PR_TRUE, 2 }, - { "ABCDEFG", "e", 5, PR_TRUE, 4 }, - { "ABCDEFG", "g", 5, PR_FALSE, 0 }, - { "ABCDEFG", "i", 5, PR_FALSE, 0 }, - { "ABCDEFG", "ab", 5, PR_TRUE, 0 }, - { "ABCDEFG", "cd", 5, PR_TRUE, 2 }, - { "ABCDEFG", "ef", 5, PR_FALSE, 0 }, - { "ABCDEFG", "gh", 5, PR_FALSE, 0 }, - { "ABCDABC", "bc", 5, PR_TRUE, 1 }, - { "ABCDABC", "bc", 6, PR_TRUE, 1 }, - { "ABCDABC", "bc", 7, PR_TRUE, 1 }, - { "ABCDEFG", "abcdefg", 6, PR_FALSE, 0 }, - { "ABCDEFG", "abcdefg", 7, PR_TRUE, 0 }, - { "ABCDEFG", "abcdefg", 8, PR_TRUE, 0 }, - { "ABCDEFGABCDEFG", "a", 12, PR_TRUE, 0 }, - { "ABCDEFGABCDEFG", "c", 12, PR_TRUE, 2 }, - { "ABCDEFGABCDEFG", "e", 12, PR_TRUE, 4 }, - { "ABCDEFGABCDEFG", "g", 12, PR_TRUE, 6 }, - { "ABCDEFGABCDEFG", "i", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "ab", 12, PR_TRUE, 0 }, - { "ABCDEFGABCDEFG", "cd", 12, PR_TRUE, 2 }, - { "ABCDEFGABCDEFG", "ef", 12, PR_TRUE, 4 }, - { "ABCDEFGABCDEFG", "gh", 12, PR_FALSE, 0 }, - { "ABCDABCABCDABC", "bc", 5, PR_TRUE, 1 }, - { "ABCDABCABCDABC", "bc", 6, PR_TRUE, 1 }, - { "ABCDABCABCDABC", "bc", 7, PR_TRUE, 1 }, - { "ABCDEFGABCDEFG", "abcdefg", 6, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "abcdefg", 7, PR_TRUE, 0 }, - { "ABCDEFGABCDEFG", "abcdefg", 8, PR_TRUE, 0 } - }; + { + { (const char *)0, (const char *)0, 12, PR_FALSE, 0 }, + { (const char *)0, "blah", 12, PR_FALSE, 0 }, + { "blah-de-blah", (const char *)0, 12, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 0, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 2, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 3, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 4, PR_TRUE, 0 }, + { "blah-de-blah", "blah", 5, PR_TRUE, 0 }, + { "blah-de-blah", "blah", 12, PR_TRUE, 0 }, + { "", "blah", 12, PR_FALSE, 0 }, + { "blah-de-blah", "", 12, PR_FALSE, 0 }, + { "abcdefg", "a", 5, PR_TRUE, 0 }, + { "abcdefg", "c", 5, PR_TRUE, 2 }, + { "abcdefg", "e", 5, PR_TRUE, 4 }, + { "abcdefg", "g", 5, PR_FALSE, 0 }, + { "abcdefg", "i", 5, PR_FALSE, 0 }, + { "abcdefg", "ab", 5, PR_TRUE, 0 }, + { "abcdefg", "cd", 5, PR_TRUE, 2 }, + { "abcdefg", "ef", 5, PR_FALSE, 0 }, + { "abcdefg", "gh", 5, PR_FALSE, 0 }, + { "abcdabc", "bc", 5, PR_TRUE, 1 }, + { "abcdabc", "bc", 6, PR_TRUE, 1 }, + { "abcdabc", "bc", 7, PR_TRUE, 1 }, + { "abcdefg", "abcdefg", 6, PR_FALSE, 0 }, + { "abcdefg", "abcdefg", 7, PR_TRUE, 0 }, + { "abcdefg", "abcdefg", 8, PR_TRUE, 0 }, + { "abcdefgabcdefg", "a", 12, PR_TRUE, 0 }, + { "abcdefgabcdefg", "c", 12, PR_TRUE, 2 }, + { "abcdefgabcdefg", "e", 12, PR_TRUE, 4 }, + { "abcdefgabcdefg", "g", 12, PR_TRUE, 6 }, + { "abcdefgabcdefg", "i", 12, PR_FALSE, 0 }, + { "abcdefgabcdefg", "ab", 12, PR_TRUE, 0 }, + { "abcdefgabcdefg", "cd", 12, PR_TRUE, 2 }, + { "abcdefgabcdefg", "ef", 12, PR_TRUE, 4 }, + { "abcdefgabcdefg", "gh", 12, PR_FALSE, 0 }, + { "abcdabcabcdabc", "bc", 5, PR_TRUE, 1 }, + { "abcdabcabcdabc", "bc", 6, PR_TRUE, 1 }, + { "abcdabcabcdabc", "bc", 7, PR_TRUE, 1 }, + { "abcdefgabcdefg", "abcdefg", 6, PR_FALSE, 0 }, + { "abcdefgabcdefg", "abcdefg", 7, PR_TRUE, 0 }, + { "abcdefgabcdefg", "abcdefg", 8, PR_TRUE, 0 }, + { "ABCDEFG", "a", 5, PR_TRUE, 0 }, + { "ABCDEFG", "c", 5, PR_TRUE, 2 }, + { "ABCDEFG", "e", 5, PR_TRUE, 4 }, + { "ABCDEFG", "g", 5, PR_FALSE, 0 }, + { "ABCDEFG", "i", 5, PR_FALSE, 0 }, + { "ABCDEFG", "ab", 5, PR_TRUE, 0 }, + { "ABCDEFG", "cd", 5, PR_TRUE, 2 }, + { "ABCDEFG", "ef", 5, PR_FALSE, 0 }, + { "ABCDEFG", "gh", 5, PR_FALSE, 0 }, + { "ABCDABC", "bc", 5, PR_TRUE, 1 }, + { "ABCDABC", "bc", 6, PR_TRUE, 1 }, + { "ABCDABC", "bc", 7, PR_TRUE, 1 }, + { "ABCDEFG", "abcdefg", 6, PR_FALSE, 0 }, + { "ABCDEFG", "abcdefg", 7, PR_TRUE, 0 }, + { "ABCDEFG", "abcdefg", 8, PR_TRUE, 0 }, + { "ABCDEFGABCDEFG", "a", 12, PR_TRUE, 0 }, + { "ABCDEFGABCDEFG", "c", 12, PR_TRUE, 2 }, + { "ABCDEFGABCDEFG", "e", 12, PR_TRUE, 4 }, + { "ABCDEFGABCDEFG", "g", 12, PR_TRUE, 6 }, + { "ABCDEFGABCDEFG", "i", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "ab", 12, PR_TRUE, 0 }, + { "ABCDEFGABCDEFG", "cd", 12, PR_TRUE, 2 }, + { "ABCDEFGABCDEFG", "ef", 12, PR_TRUE, 4 }, + { "ABCDEFGABCDEFG", "gh", 12, PR_FALSE, 0 }, + { "ABCDABCABCDABC", "bc", 5, PR_TRUE, 1 }, + { "ABCDABCABCDABC", "bc", 6, PR_TRUE, 1 }, + { "ABCDABCABCDABC", "bc", 7, PR_TRUE, 1 }, + { "ABCDEFGABCDEFG", "abcdefg", 6, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "abcdefg", 7, PR_TRUE, 0 }, + { "ABCDEFGABCDEFG", "abcdefg", 8, PR_TRUE, 0 } + }; int i; @@ -2829,7 +2873,7 @@ PRBool test_029(void) if( &array[i].str[ array[i].off ] != rv ) { - printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, + printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, array[i].str ? array[i].str : "(null)", array[i].sub ? array[i].sub : "(null)", array[i].max, rv, array[i].str, array[i].off); @@ -2853,81 +2897,81 @@ PRBool test_030(void) PRBool ret; PRUint32 off; } array[] = - { - { (const char *)0, (const char *)0, 12, PR_FALSE, 0 }, - { (const char *)0, "blah", 12, PR_FALSE, 0 }, - { "blah-de-blah", (const char *)0, 12, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 0, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 2, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 3, PR_FALSE, 0 }, - { "blah-de-blah", "blah", 4, PR_TRUE, 0 }, - { "blah-de-blah", "blah", 5, PR_TRUE, 0 }, - { "blah-de-blah", "blah", 11, PR_TRUE, 0 }, - { "blah-de-blah", "blah", 12, PR_TRUE, 8 }, - { "blah-de-blah", "blah", 13, PR_TRUE, 8 }, - { "", "blah", 12, PR_FALSE, 0 }, - { "blah-de-blah", "", 12, PR_FALSE, 0 }, - { "abcdefg", "a", 5, PR_TRUE, 0 }, - { "abcdefg", "c", 5, PR_TRUE, 2 }, - { "abcdefg", "e", 5, PR_TRUE, 4 }, - { "abcdefg", "g", 5, PR_FALSE, 0 }, - { "abcdefg", "i", 5, PR_FALSE, 0 }, - { "abcdefg", "ab", 5, PR_TRUE, 0 }, - { "abcdefg", "cd", 5, PR_TRUE, 2 }, - { "abcdefg", "ef", 5, PR_FALSE, 0 }, - { "abcdefg", "gh", 5, PR_FALSE, 0 }, - { "abcdabc", "bc", 5, PR_TRUE, 1 }, - { "abcdabc", "bc", 6, PR_TRUE, 1 }, - { "abcdabc", "bc", 7, PR_TRUE, 5 }, - { "abcdefg", "abcdefg", 6, PR_FALSE, 0 }, - { "abcdefg", "abcdefg", 7, PR_TRUE, 0 }, - { "abcdefg", "abcdefg", 8, PR_TRUE, 0 }, - { "abcdefgabcdefg", "a", 12, PR_TRUE, 7 }, - { "abcdefgabcdefg", "c", 12, PR_TRUE, 9 }, - { "abcdefgabcdefg", "e", 12, PR_TRUE, 11 }, - { "abcdefgabcdefg", "g", 12, PR_TRUE, 6 }, - { "abcdefgabcdefg", "i", 12, PR_FALSE, 0 }, - { "abcdefgabcdefg", "ab", 12, PR_TRUE, 7 }, - { "abcdefgabcdefg", "cd", 12, PR_TRUE, 9 }, - { "abcdefgabcdefg", "ef", 12, PR_TRUE, 4 }, - { "abcdefgabcdefg", "gh", 12, PR_FALSE, 0 }, - { "abcdabcabcdabc", "bc", 12, PR_TRUE, 8 }, - { "abcdabcabcdabc", "bc", 13, PR_TRUE, 8 }, - { "abcdabcabcdabc", "bc", 14, PR_TRUE, 12 }, - { "abcdefgabcdefg", "abcdefg", 13, PR_TRUE, 0 }, - { "abcdefgabcdefg", "abcdefg", 14, PR_TRUE, 7 }, - { "abcdefgabcdefg", "abcdefg", 15, PR_TRUE, 7 }, - { "ABCDEFG", "a", 5, PR_TRUE, 0 }, - { "ABCDEFG", "c", 5, PR_TRUE, 2 }, - { "ABCDEFG", "e", 5, PR_TRUE, 4 }, - { "ABCDEFG", "g", 5, PR_FALSE, 0 }, - { "ABCDEFG", "i", 5, PR_FALSE, 0 }, - { "ABCDEFG", "ab", 5, PR_TRUE, 0 }, - { "ABCDEFG", "cd", 5, PR_TRUE, 2 }, - { "ABCDEFG", "ef", 5, PR_FALSE, 0 }, - { "ABCDEFG", "gh", 5, PR_FALSE, 0 }, - { "ABCDABC", "bc", 5, PR_TRUE, 1 }, - { "ABCDABC", "bc", 6, PR_TRUE, 1 }, - { "ABCDABC", "bc", 7, PR_TRUE, 5 }, - { "ABCDEFG", "abcdefg", 6, PR_FALSE, 0 }, - { "ABCDEFG", "abcdefg", 7, PR_TRUE, 0 }, - { "ABCDEFG", "abcdefg", 8, PR_TRUE, 0 }, - { "ABCDEFGABCDEFG", "a", 12, PR_TRUE, 7 }, - { "ABCDEFGABCDEFG", "c", 12, PR_TRUE, 9 }, - { "ABCDEFGABCDEFG", "e", 12, PR_TRUE, 11 }, - { "ABCDEFGABCDEFG", "g", 12, PR_TRUE, 6 }, - { "ABCDEFGABCDEFG", "i", 12, PR_FALSE, 0 }, - { "ABCDEFGABCDEFG", "ab", 12, PR_TRUE, 7 }, - { "ABCDEFGABCDEFG", "cd", 12, PR_TRUE, 9 }, - { "ABCDEFGABCDEFG", "ef", 12, PR_TRUE, 4 }, - { "ABCDEFGABCDEFG", "gh", 12, PR_FALSE, 0 }, - { "ABCDABCABCDABC", "bc", 12, PR_TRUE, 8 }, - { "ABCDABCABCDABC", "bc", 13, PR_TRUE, 8 }, - { "ABCDABCABCDABC", "bc", 14, PR_TRUE, 12 }, - { "ABCDEFGABCDEFG", "abcdefg", 13, PR_TRUE, 0 }, - { "ABCDEFGABCDEFG", "abcdefg", 14, PR_TRUE, 7 }, - { "ABCDEFGABCDEFG", "abcdefg", 15, PR_TRUE, 7 } - }; + { + { (const char *)0, (const char *)0, 12, PR_FALSE, 0 }, + { (const char *)0, "blah", 12, PR_FALSE, 0 }, + { "blah-de-blah", (const char *)0, 12, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 0, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 2, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 3, PR_FALSE, 0 }, + { "blah-de-blah", "blah", 4, PR_TRUE, 0 }, + { "blah-de-blah", "blah", 5, PR_TRUE, 0 }, + { "blah-de-blah", "blah", 11, PR_TRUE, 0 }, + { "blah-de-blah", "blah", 12, PR_TRUE, 8 }, + { "blah-de-blah", "blah", 13, PR_TRUE, 8 }, + { "", "blah", 12, PR_FALSE, 0 }, + { "blah-de-blah", "", 12, PR_FALSE, 0 }, + { "abcdefg", "a", 5, PR_TRUE, 0 }, + { "abcdefg", "c", 5, PR_TRUE, 2 }, + { "abcdefg", "e", 5, PR_TRUE, 4 }, + { "abcdefg", "g", 5, PR_FALSE, 0 }, + { "abcdefg", "i", 5, PR_FALSE, 0 }, + { "abcdefg", "ab", 5, PR_TRUE, 0 }, + { "abcdefg", "cd", 5, PR_TRUE, 2 }, + { "abcdefg", "ef", 5, PR_FALSE, 0 }, + { "abcdefg", "gh", 5, PR_FALSE, 0 }, + { "abcdabc", "bc", 5, PR_TRUE, 1 }, + { "abcdabc", "bc", 6, PR_TRUE, 1 }, + { "abcdabc", "bc", 7, PR_TRUE, 5 }, + { "abcdefg", "abcdefg", 6, PR_FALSE, 0 }, + { "abcdefg", "abcdefg", 7, PR_TRUE, 0 }, + { "abcdefg", "abcdefg", 8, PR_TRUE, 0 }, + { "abcdefgabcdefg", "a", 12, PR_TRUE, 7 }, + { "abcdefgabcdefg", "c", 12, PR_TRUE, 9 }, + { "abcdefgabcdefg", "e", 12, PR_TRUE, 11 }, + { "abcdefgabcdefg", "g", 12, PR_TRUE, 6 }, + { "abcdefgabcdefg", "i", 12, PR_FALSE, 0 }, + { "abcdefgabcdefg", "ab", 12, PR_TRUE, 7 }, + { "abcdefgabcdefg", "cd", 12, PR_TRUE, 9 }, + { "abcdefgabcdefg", "ef", 12, PR_TRUE, 4 }, + { "abcdefgabcdefg", "gh", 12, PR_FALSE, 0 }, + { "abcdabcabcdabc", "bc", 12, PR_TRUE, 8 }, + { "abcdabcabcdabc", "bc", 13, PR_TRUE, 8 }, + { "abcdabcabcdabc", "bc", 14, PR_TRUE, 12 }, + { "abcdefgabcdefg", "abcdefg", 13, PR_TRUE, 0 }, + { "abcdefgabcdefg", "abcdefg", 14, PR_TRUE, 7 }, + { "abcdefgabcdefg", "abcdefg", 15, PR_TRUE, 7 }, + { "ABCDEFG", "a", 5, PR_TRUE, 0 }, + { "ABCDEFG", "c", 5, PR_TRUE, 2 }, + { "ABCDEFG", "e", 5, PR_TRUE, 4 }, + { "ABCDEFG", "g", 5, PR_FALSE, 0 }, + { "ABCDEFG", "i", 5, PR_FALSE, 0 }, + { "ABCDEFG", "ab", 5, PR_TRUE, 0 }, + { "ABCDEFG", "cd", 5, PR_TRUE, 2 }, + { "ABCDEFG", "ef", 5, PR_FALSE, 0 }, + { "ABCDEFG", "gh", 5, PR_FALSE, 0 }, + { "ABCDABC", "bc", 5, PR_TRUE, 1 }, + { "ABCDABC", "bc", 6, PR_TRUE, 1 }, + { "ABCDABC", "bc", 7, PR_TRUE, 5 }, + { "ABCDEFG", "abcdefg", 6, PR_FALSE, 0 }, + { "ABCDEFG", "abcdefg", 7, PR_TRUE, 0 }, + { "ABCDEFG", "abcdefg", 8, PR_TRUE, 0 }, + { "ABCDEFGABCDEFG", "a", 12, PR_TRUE, 7 }, + { "ABCDEFGABCDEFG", "c", 12, PR_TRUE, 9 }, + { "ABCDEFGABCDEFG", "e", 12, PR_TRUE, 11 }, + { "ABCDEFGABCDEFG", "g", 12, PR_TRUE, 6 }, + { "ABCDEFGABCDEFG", "i", 12, PR_FALSE, 0 }, + { "ABCDEFGABCDEFG", "ab", 12, PR_TRUE, 7 }, + { "ABCDEFGABCDEFG", "cd", 12, PR_TRUE, 9 }, + { "ABCDEFGABCDEFG", "ef", 12, PR_TRUE, 4 }, + { "ABCDEFGABCDEFG", "gh", 12, PR_FALSE, 0 }, + { "ABCDABCABCDABC", "bc", 12, PR_TRUE, 8 }, + { "ABCDABCABCDABC", "bc", 13, PR_TRUE, 8 }, + { "ABCDABCABCDABC", "bc", 14, PR_TRUE, 12 }, + { "ABCDEFGABCDEFG", "abcdefg", 13, PR_TRUE, 0 }, + { "ABCDEFGABCDEFG", "abcdefg", 14, PR_TRUE, 7 }, + { "ABCDEFGABCDEFG", "abcdefg", 15, PR_TRUE, 7 } + }; int i; @@ -2961,7 +3005,7 @@ PRBool test_030(void) if( &array[i].str[ array[i].off ] != rv ) { - printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, + printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, array[i].str ? array[i].str : "(null)", array[i].sub ? array[i].sub : "(null)", array[i].max, rv, array[i].str, array[i].off); @@ -3003,7 +3047,7 @@ PRBool test_031(void) PL_strcat(string, tokens[i]); PL_strcat(string, seps[i]); } - + /* Scan the string for tokens. */ i = 0; s1 = string; |