~ubuntu-branches/ubuntu/gutsy/icu/gutsy

« back to all changes in this revision

Viewing changes to source/test/intltest/biditst.h

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2005-05-21 22:44:31 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: package-import@ubuntu.com-20050521224431-r7rktfhnu1n4tf1g
Tags: 2.1-2.1
Rename icu-doc to icu21-doc. icu-doc is built by the icu28 package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/********************************************************************
 
2
 * COPYRIGHT: 
 
3
 * Copyright (c) 1997-2001, International Business Machines Corporation and
 
4
 * others. All Rights Reserved.
 
5
 ********************************************************************/
 
6
/*   file name:  cbididat.c
 
7
*   encoding:   US-ASCII
 
8
*   tab size:   8 (not used)
 
9
*   indentation:4
 
10
*
 
11
*   created on: 1999sep22
 
12
*   created by: Markus W. Scherer
 
13
*/
 
14
 
 
15
#ifndef _BIDITST_H
 
16
#define _BIDITST_H
 
17
 
 
18
#include "unicode/utypes.h"
 
19
#include "unicode/uchar.h"
 
20
#include "unicode/bidi.h"
 
21
#include "intltest.h"
 
22
 
 
23
#define MAX_STRING_LENGTH 200
 
24
 
 
25
/* length of an array */
 
26
#define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0]))
 
27
 
 
28
/*  Comparing the description of the BiDi algorithm with this implementation
 
29
    is easier with the same names for the BiDi types in the code as there.
 
30
    See UCharDirection in uchar.h .
 
31
*/
 
32
enum { 
 
33
    L=  U_LEFT_TO_RIGHT,
 
34
    R=  U_RIGHT_TO_LEFT,
 
35
    EN= U_EUROPEAN_NUMBER,
 
36
    ES= U_EUROPEAN_NUMBER_SEPARATOR,
 
37
    ET= U_EUROPEAN_NUMBER_TERMINATOR,
 
38
    AN= U_ARABIC_NUMBER,
 
39
    CS= U_COMMON_NUMBER_SEPARATOR,
 
40
    B=  U_BLOCK_SEPARATOR,
 
41
    S=  U_SEGMENT_SEPARATOR,
 
42
    WS= U_WHITE_SPACE_NEUTRAL,
 
43
    ON= U_OTHER_NEUTRAL,
 
44
    LRE=U_LEFT_TO_RIGHT_EMBEDDING,
 
45
    LRO=U_LEFT_TO_RIGHT_OVERRIDE,
 
46
    AL= U_RIGHT_TO_LEFT_ARABIC,
 
47
    RLE=U_RIGHT_TO_LEFT_EMBEDDING,
 
48
    RLO=U_RIGHT_TO_LEFT_OVERRIDE,
 
49
    PDF=U_POP_DIRECTIONAL_FORMAT,
 
50
    NSM=U_DIR_NON_SPACING_MARK,
 
51
    BN= U_BOUNDARY_NEUTRAL,
 
52
    dirPropCount
 
53
};
 
54
 
 
55
typedef struct {
 
56
    const uint8_t *text;
 
57
    int32_t length;
 
58
    UBiDiLevel paraLevel;
 
59
    int32_t lineStart, lineLimit;
 
60
    UBiDiDirection direction;
 
61
    UBiDiLevel resultLevel;
 
62
    const UBiDiLevel *levels;
 
63
    const uint8_t *visualMap;
 
64
} BiDiTestData;
 
65
 
 
66
 
 
67
 
 
68
 
 
69
 
 
70
class BiDiTest: public IntlTest{
 
71
 
 
72
private:
 
73
    
 
74
public:
 
75
    void TestBiDi(void);
 
76
 
 
77
    void TestBiDi(BiDi& bidi, BiDi& line);
 
78
 
 
79
    void TestBiDi(BiDi& bidi, int testNumber, BiDiTestData *test, int32_t lineStart);
 
80
 
 
81
    void TestReordering(BiDi& bidi, int testNumber);
 
82
 
 
83
    void TestInverseBiDi(void);
 
84
 
 
85
    void TestInverseBiDi(BiDi& bidi, UBiDiLevel direction);
 
86
 
 
87
    void TestInverseBiDi(BiDi& bidi, const UChar* src,int32_t srcLength, UBiDiLevel direction, UErrorCode& errorCode);
 
88
 
 
89
    void TestWriteReverse(void);
 
90
 
 
91
 
 
92
    UChar* getStringFromDirProps(const uint8_t *dirProps, int32_t length);
 
93
 
 
94
    void printUnicode(const UChar* s,int32_t length, const UBiDiLevel *levels);
 
95
 
 
96
    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par = NULL */);
 
97
};
 
98
 
 
99
#endif