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