ReactOS 0.4.15-dev-8102-g108db8f
IsDBCSLeadByteEx.c File Reference
#include "precomp.h"
Include dependency graph for IsDBCSLeadByteEx.c:

Go to the source code of this file.

Classes

struct  RANGE
 
struct  ENTRY
 

Macros

#define MAX_RANGE   4
 

Typedefs

typedef struct RANGE RANGE
 
typedef struct ENTRY ENTRY
 

Functions

 START_TEST (IsDBCSLeadByteEx)
 

Macro Definition Documentation

◆ MAX_RANGE

#define MAX_RANGE   4

Definition at line 10 of file IsDBCSLeadByteEx.c.

Typedef Documentation

◆ ENTRY

typedef struct ENTRY ENTRY

◆ RANGE

typedef struct RANGE RANGE

Function Documentation

◆ START_TEST()

START_TEST ( IsDBCSLeadByteEx  )

Definition at line 26 of file IsDBCSLeadByteEx.c.

27{
28 static const ENTRY Entries[] =
29 {
30 {
31 "English", 437,
32 0
33 },
34 {
35 "ChineseSimpilified", 936,
36 1,
37 {
38 { 0x81, 0xFE }
39 }
40 },
41 {
42 "ChineseTraditional", 950,
43 1,
44 {
45 { 0x81, 0xFE }
46 }
47 },
48 {
49 "Japanese", 932,
50 2,
51 {
52 { 0x81, 0x9F }, { 0xE0, 0xFC }
53 }
54 },
55 {
56 "Korean", 949,
57 1,
58 {
59 { 0x81, 0xFE }
60 }
61 }
62 };
63 int i;
64
65 for (i = 0; i < _countof(Entries); ++i)
66 {
67 int Index, iRange;
68 int CodePage = Entries[i].CodePage, StartIndex = 0, RangeCount = 0;
69 BOOL InRange = FALSE;
70 RANGE Ranges[MAX_RANGE];
71 const char *Name = Entries[i].Name;
72
73 ZeroMemory(&Ranges, sizeof(Ranges));
74
75 for (Index = 0; Index < 256; ++Index)
76 {
77 if (InRange)
78 {
79 if (!IsDBCSLeadByteEx(CodePage, Index))
80 {
81 Ranges[RangeCount].StartIndex = StartIndex;
82 Ranges[RangeCount].EndIndex = Index - 1;
83 ++RangeCount;
84 InRange = FALSE;
85 }
86 }
87 else
88 {
89 if (IsDBCSLeadByteEx(CodePage, Index))
90 {
91 StartIndex = Index;
92 InRange = TRUE;
93 }
94 }
95 }
96 if (InRange)
97 {
98 Ranges[RangeCount].StartIndex = StartIndex;
99 Ranges[RangeCount].EndIndex = Index - 1;
100 ++RangeCount;
101 }
102
103 ok(RangeCount == Entries[i].RangeCount,
104 "%s: RangeCount expected %d, was %d\n",
105 Name, Entries[i].RangeCount, RangeCount);
106 for (iRange = 0; iRange < Entries[i].RangeCount; ++iRange)
107 {
108 const RANGE *pRange = &Entries[i].Ranges[iRange];
109 int iStart = Ranges[iRange].StartIndex;
110 int iEnd = Ranges[iRange].EndIndex;
111 ok(iStart == pRange->StartIndex,
112 "%s: Ranges[%d].StartIndex expected: 0x%02X, was: 0x%02X\n",
113 Name, iRange, pRange->StartIndex, iStart);
114 ok(iEnd == pRange->EndIndex,
115 "%s: Ranges[%d].EndIndex was expected: 0x%02X, was: 0x%02X\n",
116 Name, iRange, pRange->EndIndex, iEnd);
117 }
118 }
119}
#define MAX_RANGE
static const ENTRY Entries[]
#define ok(value,...)
Definition: atltest.h:57
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI IsDBCSLeadByteEx(UINT codepage, BYTE testchar)
Definition: locale.c:2103
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define _countof(array)
Definition: sndvol32.h:70
Definition: DelNode.c:62
int CodePage
const char * Name
RANGE Ranges[MAX_RANGE]
int RangeCount
int EndIndex
int StartIndex
_In_ WDFCOLLECTION _In_ ULONG Index
#define ZeroMemory
Definition: winbase.h:1712
_In_ UINT iStart
Definition: wingdi.h:3620