[prev in list] [next in list] [prev in thread] [next in thread]
List: apr-cvs
Subject: svn commit: r719690 - /apr/apr/trunk/test/internal/testucs.c
From: wrowe () apache ! org
Date: 2008-11-21 19:52:45
Message-ID: 20081121195245.980192388875 () eris ! apache ! org
[Download RAW message or body]
Author: wrowe
Date: Fri Nov 21 11:52:44 2008
New Revision: 719690
URL: http://svn.apache.org/viewvc?rev=719690&view=rev
Log:
As I had gone ahead and built this table as part of another exercise,
it seems worth depositing it here, although the list is redundant for
our purposes.
Modified:
apr/apr/trunk/test/internal/testucs.c
Modified: apr/apr/trunk/test/internal/testucs.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/internal/testucs.c?rev=719690&r1=719689&r2=719690&view=diff
==============================================================================
--- apr/apr/trunk/test/internal/testucs.c (original)
+++ apr/apr/trunk/test/internal/testucs.c Fri Nov 21 11:52:44 2008
@@ -22,11 +22,56 @@
struct testval {
unsigned char n[8];
- wchar_t w[4];
int nl;
+ wchar_t w[4];
int wl;
};
+/* For reference; a table of invalid utf-8 encoded ucs-2/ucs-4 sequences.
+ * The table consists of start, end pairs for all invalid ranges.
+ * NO_UCS2_PAIRS will pass the reservered D800-DFFF values, halting at FFFF
+ * FULL_UCS4_MAPPER represents all 31 bit values to 7FFF FFFF
+ *
+ * We already tested these, because we ensure there is a 1:1 mapping across
+ * the entire range of byte values in each position of 1 to 6 byte sequences.
+ */
+struct testval malformed[] = [
+ [[0x80,], 1,], /* 10000000 64 invalid leading continuation values */
+ [[0xBF,], 1,], /* 10111111 64 invalid leading continuation values */
+ [[0xC0,0x80], 2,], /* overshort mapping of 0000 */
+ [[0xC1,0xBF], 2,], /* overshort mapping of 007F */
+ [[0xE0,0x80,0x80,], 3,], /* overshort mapping of 0000 */
+ [[0xE0,0x9F,0xBF,], 3,], /* overshort mapping of 07FF */
+#ifndef NO_UCS2_PAIRS
+ [[0xED,0xA0,0x80,], 3,], /* unexpected mapping of UCS-2 literal D800 */
+ [[0xED,0xBF,0xBF,], 3,], /* unexpected mapping of UCS-2 literal DFFF */
+#endif
+ [[0xF0,0x80,0x80,0x80,], 4,], /* overshort mapping of 0000 */
+ [[0xF0,0x8F,0xBF,0xBF,], 4,], /* overshort mapping of FFFF */
+#ifdef NO_UCS2_PAIRS
+ [[0xF0,0x90,0x80,0x80,], 4,], /* invalid too large value 0001 0000 */
+ [[0xF4,0x8F,0xBF,0xBF,], 4,], /* invalid too large value 0010 FFFF */
+#endif
+#ifndef FULL_UCS4_MAPPER
+ [[0xF4,0x90,0x80,0x80,], 4,], /* invalid too large value 0011 0000 */
+ [[0xF7,0xBF,0xBF,0xBF,], 4,], /* invalid too large value 001F FFFF */
+#endif
+ [[0xF8,0x80,0x80,0x80,0x80,], 5,], /* overshort mapping of 0000 0000 */
+ [[0xF8,0x87,0xBF,0xBF,0xBF,], 5,], /* overshort mapping of 001F FFFF */
+#ifndef FULL_UCS4_MAPPER
+ [[0xF8,0x88,0x80,0x80,0x80,], 5,], /* invalid too large value 0020 0000 */
+ [[0xFB,0xBF,0xBF,0xBF,0xBF,], 5,], /* invalid too large value 03FF FFFF */
+#endif
+ [[0xFC,0x80,0x80,0x80,0x80,0x80,], 6,], /* overshort mapping 0000 0000 */
+ [[0xFC,0x83,0xBF,0xBF,0xBF,0xBF,], 6,], /* overshort mapping 03FF FFFF */
+#ifndef FULL_UCS4_MAPPER
+ [[0xFC,0x84,0x80,0x80,0x80,0x80,], 6,], /* overshort mapping 0400 0000 */
+ [[0xFD,0xBF,0xBF,0xBF,0xBF,0xBF,], 6,], /* overshort mapping 7FFF FFFF */
+#endif
+ [[0xFE,], 1,], /* 11111110 invalid "too large" value, no 7 byte seq */
+ [[0xFF,], 1,], /* 11111111 invalid "too large" value, no 8 byte seq */
+];
+
void displaynw(struct testval *f, struct testval *l)
{
char x[80], *t = x;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic