01: /**
02: *******************************************************************************
03: * Copyright (C) 1996-2006, International Business Machines Corporation and *
04: * others. All Rights Reserved. *
05: *******************************************************************************
06: */package com.ibm.icu.dev.test.lang;
07:
08: import com.ibm.icu.dev.test.TestFmwk;
09: import com.ibm.icu.lang.UCharacterCategory;
10:
11: /**
12: * Testing UCharacterCategory
13: * @author Syn Wee Quek
14: * @since April 02 2002
15: */
16: public class UCharacterCategoryTest extends TestFmwk {
17: // constructor -----------------------------------------------------------
18:
19: /**
20: * Private constructor to prevent initialisation
21: */
22: public UCharacterCategoryTest() {
23: }
24:
25: // public methods --------------------------------------------------------
26:
27: public static void main(String[] arg) {
28: try {
29: UCharacterCategoryTest test = new UCharacterCategoryTest();
30: test.run(arg);
31: } catch (Exception e) {
32: e.printStackTrace();
33: }
34: }
35:
36: /**
37: * Gets the name of the argument category
38: * @returns category name
39: */
40: public void TestToString() {
41: String name[] = { "Unassigned", "Letter, Uppercase",
42: "Letter, Lowercase", "Letter, Titlecase",
43: "Letter, Modifier", "Letter, Other",
44: "Mark, Non-Spacing", "Mark, Enclosing",
45: "Mark, Spacing Combining", "Number, Decimal Digit",
46: "Number, Letter", "Number, Other", "Separator, Space",
47: "Separator, Line", "Separator, Paragraph",
48: "Other, Control", "Other, Format",
49: "Other, Private Use", "Other, Surrogate",
50: "Punctuation, Dash", "Punctuation, Open",
51: "Punctuation, Close", "Punctuation, Connector",
52: "Punctuation, Other", "Symbol, Math",
53: "Symbol, Currency", "Symbol, Modifier",
54: "Symbol, Other", "Punctuation, Initial quote",
55: "Punctuation, Final quote" };
56: for (int i = UCharacterCategory.UNASSIGNED; i < UCharacterCategory.CHAR_CATEGORY_COUNT; i++) {
57: if (!UCharacterCategory.toString(i).equals(name[i])) {
58: errln("Error toString for category " + i + " expected "
59: + name[i]);
60: }
61: }
62: }
63: }
|