tests/libjava-mauve/src/gnu/testlet/java/lang/Character/Blocks15.java
branchjk_new_structure
changeset 1541 75c2e24dea9a
parent 1540 92ac284961c1
child 1542 be11db817bcf
equal deleted inserted replaced
1540:92ac284961c1 1541:75c2e24dea9a
     1 // Tags: JDK1.5
       
     2 
       
     3 /*
       
     4    Copyright (C) 2005 Andrew John Hughes (gnu_andrew@member.fsf.org)
       
     5 
       
     6    This file is part of Mauve.
       
     7 
       
     8    Mauve is free software; you can redistribute it and/or modify
       
     9    it under the terms of the GNU General Public License as published by
       
    10    the Free Software Foundation; either version 2, or (at your option)
       
    11    any later version.
       
    12 
       
    13    Mauve is distributed in the hope that it will be useful,
       
    14    but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    16    GNU General Public License for more details.
       
    17 
       
    18    You should have received a copy of the GNU General Public License
       
    19    along with Mauve; see the file COPYING.  If not, write to
       
    20    the Free Software Foundation, 59 Temple Place - Suite 330,
       
    21    Boston, MA 02111-1307, USA.
       
    22 */
       
    23 
       
    24 package gnu.testlet.java.lang.Character;
       
    25 
       
    26 import gnu.testlet.Testlet;
       
    27 import gnu.testlet.TestHarness;
       
    28 
       
    29 public class Blocks15
       
    30   implements Testlet
       
    31 {
       
    32 
       
    33   public void test (TestHarness harness)
       
    34   {
       
    35     harness.check(Character.UnicodeBlock.forName("Greek"), Character.UnicodeBlock.GREEK);
       
    36     harness.check(Character.UnicodeBlock.forName("Combining Marks for Symbols"),
       
    37 		  Character.UnicodeBlock.COMBINING_MARKS_FOR_SYMBOLS);
       
    38     harness.check(Character.UnicodeBlock.forName("CombiningMarksforSymbols"),
       
    39 		  Character.UnicodeBlock.COMBINING_MARKS_FOR_SYMBOLS);
       
    40      harness.check(Character.UnicodeBlock.forName("Miscellaneous Mathematical Symbols-B"),
       
    41 		   Character.UnicodeBlock.MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B);
       
    42      harness.check(Character.UnicodeBlock.forName("MiscellaneousMathematicalSymbols-B"),
       
    43 		   Character.UnicodeBlock.MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B);
       
    44      harness.check(Character.UnicodeBlock.forName("Miscellaneous_Mathematical_Symbols_B"),
       
    45 		   Character.UnicodeBlock.MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B);
       
    46      try
       
    47        {
       
    48 	 Character.UnicodeBlock.forName(null);
       
    49 	 harness.fail("null allowed to forName()");
       
    50        }
       
    51      catch (NullPointerException e)
       
    52        {
       
    53 	 harness.check(true);
       
    54        }
       
    55      try
       
    56        {
       
    57 	 Character.UnicodeBlock.forName("GNU Classpath Characters");
       
    58 	 harness.fail("Allowed request for invalid character set to forName()");
       
    59        }
       
    60      catch (IllegalArgumentException e)
       
    61        {
       
    62 	 harness.check(true);
       
    63        }
       
    64      harness.check(Character.UnicodeBlock.of(0x2191), Character.UnicodeBlock.ARROWS);
       
    65      harness.check(Character.UnicodeBlock.of(0x100000),
       
    66 		   Character.UnicodeBlock.SUPPLEMENTARY_PRIVATE_USE_AREA_B);
       
    67      try
       
    68        {
       
    69 	 Character.UnicodeBlock.of(0x200000);
       
    70 	 harness.fail("Allowed invalid codepoint to of(int)");
       
    71        }
       
    72      catch (IllegalArgumentException e)
       
    73        {
       
    74 	 harness.check(true);
       
    75        }
       
    76   }
       
    77 
       
    78 }