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