]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/main/tests/core/src/com/ibm/icu/dev/test/lang/UCharacterDirectionTest.java
go
[Dictionary.git] / jars / icu4j-4_4_2-src / main / tests / core / src / com / ibm / icu / dev / test / lang / UCharacterDirectionTest.java
1 /**\r
2  *******************************************************************************\r
3  * Copyright (C) 2001-2009, International Business Machines Corporation and    *\r
4  * others. All Rights Reserved.                                                *\r
5  *******************************************************************************\r
6  */\r
7 package com.ibm.icu.dev.test.lang;\r
8 \r
9 import com.ibm.icu.dev.test.TestFmwk;\r
10 import com.ibm.icu.lang.UCharacterDirection;\r
11 \r
12 /**\r
13 * Testing UCharacterDirection\r
14 * @author Syn Wee Quek\r
15 * @since July 22 2002\r
16 */\r
17 public class UCharacterDirectionTest extends TestFmwk\r
18 {    \r
19     // constructor -----------------------------------------------------------\r
20     \r
21     /**\r
22     * Private constructor to prevent initialization\r
23     */\r
24     public UCharacterDirectionTest()\r
25     {\r
26     }\r
27     \r
28     // public methods --------------------------------------------------------\r
29       \r
30     public static void main(String[] arg)  \r
31     {\r
32         try\r
33         {\r
34             UCharacterDirectionTest test = new UCharacterDirectionTest();\r
35             test.run(arg);\r
36         }\r
37         catch (Exception e)\r
38         {\r
39             e.printStackTrace();\r
40         }\r
41     }\r
42     \r
43     /**\r
44     * Gets the name of the argument category\r
45     * @returns category name\r
46     */\r
47     public void TestToString()\r
48     {\r
49         String name[] = {"Left-to-Right",\r
50                          "Right-to-Left", \r
51                          "European Number",\r
52                          "European Number Separator",\r
53                          "European Number Terminator",\r
54                          "Arabic Number",\r
55                          "Common Number Separator",\r
56                          "Paragraph Separator",\r
57                          "Segment Separator",\r
58                          "Whitespace",\r
59                          "Other Neutrals",\r
60                          "Left-to-Right Embedding",\r
61                          "Left-to-Right Override",\r
62                          "Right-to-Left Arabic",\r
63                          "Right-to-Left Embedding",\r
64                          "Right-to-Left Override",\r
65                          "Pop Directional Format",\r
66                          "Non-Spacing Mark",\r
67                          "Boundary Neutral",\r
68                          "Unassigned"};\r
69         \r
70         for (int i = UCharacterDirection.LEFT_TO_RIGHT;\r
71             // Placed <= because we need to consider 'Unassigned'\r
72             // when it goes out of bounds of UCharacterDirection\r
73             i <= UCharacterDirection.CHAR_DIRECTION_COUNT; i++) {\r
74              if (!UCharacterDirection.toString(i).equals(name[i])) {\r
75                 errln("Error toString for direction " + i + " expected " +\r
76                       name[i]);\r
77              }\r
78         }\r
79     }\r
80 }\r