001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Evgeniya G. Maenkova
019: * @version $Revision$
020: */package javax.swing.text.html.parser;
021:
022: import java.util.Hashtable;
023:
024: import junit.framework.TestCase;
025:
026: public class Utils401 {
027: private static void handleEntity(final String name, final int ch,
028: final Hashtable table) {
029: handleEntity(name, name, ch, table);
030: handleEntity(new Integer(ch), name, ch, table);
031: }
032:
033: private static void handleEntity(final Object key,
034: final String name, final int ch, final Hashtable table) {
035: handleEntity(key, name, ch, DTDConstants.CDATA, table);
036: }
037:
038: private static void handleEntity(final Object key,
039: final String name, final int ch, final int type,
040: final Hashtable table) {
041: TestCase.assertTrue(table.containsKey(key));
042: Entity entity = (Entity) table.get(key);
043: Utils.checkEntity(entity, name, type, (char) ch, true, false);
044: table.remove(key);
045: }
046:
047: public static void check32Entities(final Hashtable table) {
048: //203 is becasue there are 100 * 2 + 3 values.
049: //factor 2 = just another key in hashtable;
050: //3 = (SPACE + RE + RS).
051: TestCase.assertEquals(203, table.size());
052: handleLat1(table);
053: handleEntity("amp", 38, table);
054: handleEntity("gt", 62, table);
055: handleEntity("lt", 60, table);
056: handleEntity("quot", 34, table);
057: handleEntity("#SPACE", "#SPACE", ' ', 0, table);
058: handleEntity("#RS", "#RS", '\n', 0, table);
059: handleEntity("#RE", "#RE", '\r', 0, table);
060: TestCase.assertEquals(0, table.size());
061: }
062:
063: public static void check401Entities(final Hashtable table) {
064: handleEntity("#SPACE", "#SPACE", ' ', 0, table);
065: handleEntity("#RS", "#RS", '\n', 0, table);
066: handleEntity("#RE", "#RE", '\r', 0, table);
067: handleLat1(table);
068: handleSpecial(table);
069: handleSymbol(table);
070: handleEntity("squot", 39, table);
071: TestCase.assertEquals(0, table.size());
072: }
073:
074: private static void handleLat1(final Hashtable table) {
075: //--Don't edit
076: handleEntity("nbsp", 160, table);
077: handleEntity("iexcl", 161, table);
078: handleEntity("cent", 162, table);
079: handleEntity("pound", 163, table);
080: handleEntity("curren", 164, table);
081: handleEntity("yen", 165, table);
082: handleEntity("brvbar", 166, table);
083: handleEntity("sect", 167, table);
084: handleEntity("uml", 168, table);
085: handleEntity("copy", 169, table);
086: handleEntity("ordf", 170, table);
087: handleEntity("laquo", 171, table);
088: handleEntity("not", 172, table);
089: handleEntity("shy", 173, table);
090: handleEntity("reg", 174, table);
091: handleEntity("macr", 175, table);
092: handleEntity("deg", 176, table);
093: handleEntity("plusmn", 177, table);
094: handleEntity("sup2", 178, table);
095: handleEntity("sup3", 179, table);
096: handleEntity("acute", 180, table);
097: handleEntity("micro", 181, table);
098: handleEntity("para", 182, table);
099: handleEntity("middot", 183, table);
100: handleEntity("cedil", 184, table);
101: handleEntity("sup1", 185, table);
102: handleEntity("ordm", 186, table);
103: handleEntity("raquo", 187, table);
104: handleEntity("frac14", 188, table);
105: handleEntity("frac12", 189, table);
106: handleEntity("frac34", 190, table);
107: handleEntity("iquest", 191, table);
108: handleEntity("Agrave", 192, table);
109: handleEntity("Aacute", 193, table);
110: handleEntity("Acirc", 194, table);
111: handleEntity("Atilde", 195, table);
112: handleEntity("Auml", 196, table);
113: handleEntity("Aring", 197, table);
114: handleEntity("AElig", 198, table);
115: handleEntity("Ccedil", 199, table);
116: handleEntity("Egrave", 200, table);
117: handleEntity("Eacute", 201, table);
118: handleEntity("Ecirc", 202, table);
119: handleEntity("Euml", 203, table);
120: handleEntity("Igrave", 204, table);
121: handleEntity("Iacute", 205, table);
122: handleEntity("Icirc", 206, table);
123: handleEntity("Iuml", 207, table);
124: handleEntity("ETH", 208, table);
125: handleEntity("Ntilde", 209, table);
126: handleEntity("Ograve", 210, table);
127: handleEntity("Oacute", 211, table);
128: handleEntity("Ocirc", 212, table);
129: handleEntity("Otilde", 213, table);
130: handleEntity("Ouml", 214, table);
131: handleEntity("times", 215, table);
132: handleEntity("Oslash", 216, table);
133: handleEntity("Ugrave", 217, table);
134: handleEntity("Uacute", 218, table);
135: handleEntity("Ucirc", 219, table);
136: handleEntity("Uuml", 220, table);
137: handleEntity("Yacute", 221, table);
138: handleEntity("THORN", 222, table);
139: handleEntity("szlig", 223, table);
140: handleEntity("agrave", 224, table);
141: handleEntity("aacute", 225, table);
142: handleEntity("acirc", 226, table);
143: handleEntity("atilde", 227, table);
144: handleEntity("auml", 228, table);
145: handleEntity("aring", 229, table);
146: handleEntity("aelig", 230, table);
147: handleEntity("ccedil", 231, table);
148: handleEntity("egrave", 232, table);
149: handleEntity("eacute", 233, table);
150: handleEntity("ecirc", 234, table);
151: handleEntity("euml", 235, table);
152: handleEntity("igrave", 236, table);
153: handleEntity("iacute", 237, table);
154: handleEntity("icirc", 238, table);
155: handleEntity("iuml", 239, table);
156: handleEntity("eth", 240, table);
157: handleEntity("ntilde", 241, table);
158: handleEntity("ograve", 242, table);
159: handleEntity("oacute", 243, table);
160: handleEntity("ocirc", 244, table);
161: handleEntity("otilde", 245, table);
162: handleEntity("ouml", 246, table);
163: handleEntity("divide", 247, table);
164: handleEntity("oslash", 248, table);
165: handleEntity("ugrave", 249, table);
166: handleEntity("uacute", 250, table);
167: handleEntity("ucirc", 251, table);
168: handleEntity("uuml", 252, table);
169: handleEntity("yacute", 253, table);
170: handleEntity("thorn", 254, table);
171: handleEntity("yuml", 255, table);
172: }
173:
174: private static void handleSymbol(final Hashtable table) {
175: //! Don't edit
176: handleEntity("fnof", 402, table);
177: handleEntity("Alpha", 913, table);
178: handleEntity("Beta", 914, table);
179: handleEntity("Gamma", 915, table);
180: handleEntity("Delta", 916, table);
181: handleEntity("Epsilon", 917, table);
182: handleEntity("Zeta", 918, table);
183: handleEntity("Eta", 919, table);
184: handleEntity("Theta", 920, table);
185: handleEntity("Iota", 921, table);
186: handleEntity("Kappa", 922, table);
187: handleEntity("Lambda", 923, table);
188: handleEntity("Mu", 924, table);
189: handleEntity("Nu", 925, table);
190: handleEntity("Xi", 926, table);
191: handleEntity("Omicron", 927, table);
192: handleEntity("Pi", 928, table);
193: handleEntity("Rho", 929, table);
194: handleEntity("Sigma", 931, table);
195: handleEntity("Tau", 932, table);
196: handleEntity("Upsilon", 933, table);
197: handleEntity("Phi", 934, table);
198: handleEntity("Chi", 935, table);
199: handleEntity("Psi", 936, table);
200: handleEntity("Omega", 937, table);
201: handleEntity("alpha", 945, table);
202: handleEntity("beta", 946, table);
203: handleEntity("gamma", 947, table);
204: handleEntity("delta", 948, table);
205: handleEntity("epsilon", 949, table);
206: handleEntity("zeta", 950, table);
207: handleEntity("eta", 951, table);
208: handleEntity("theta", 952, table);
209: handleEntity("iota", 953, table);
210: handleEntity("kappa", 954, table);
211: handleEntity("lambda", 955, table);
212: handleEntity("mu", 956, table);
213: handleEntity("nu", 957, table);
214: handleEntity("xi", 958, table);
215: handleEntity("omicron", 959, table);
216: handleEntity("pi", 960, table);
217: handleEntity("rho", 961, table);
218: handleEntity("sigmaf", 962, table);
219: handleEntity("sigma", 963, table);
220: handleEntity("tau", 964, table);
221: handleEntity("upsilon", 965, table);
222: handleEntity("phi", 966, table);
223: handleEntity("chi", 967, table);
224: handleEntity("psi", 968, table);
225: handleEntity("omega", 969, table);
226: handleEntity("thetasym", 977, table);
227: handleEntity("upsih", 978, table);
228: handleEntity("piv", 982, table);
229: handleEntity("bull", 8226, table);
230: handleEntity("hellip", 8230, table);
231: handleEntity("prime", 8242, table);
232: handleEntity("Prime", 8243, table);
233: handleEntity("oline", 8254, table);
234: handleEntity("frasl", 8260, table);
235: handleEntity("weierp", 8472, table);
236: handleEntity("image", 8465, table);
237: handleEntity("real", 8476, table);
238: handleEntity("trade", 8482, table);
239: handleEntity("alefsym", 8501, table);
240: handleEntity("larr", 8592, table);
241: handleEntity("uarr", 8593, table);
242: handleEntity("rarr", 8594, table);
243: handleEntity("darr", 8595, table);
244: handleEntity("harr", 8596, table);
245: handleEntity("crarr", 8629, table);
246: handleEntity("lArr", 8656, table);
247: handleEntity("uArr", 8657, table);
248: handleEntity("rArr", 8658, table);
249: handleEntity("dArr", 8659, table);
250: handleEntity("hArr", 8660, table);
251: handleEntity("forall", 8704, table);
252: handleEntity("part", 8706, table);
253: handleEntity("exist", 8707, table);
254: handleEntity("empty", 8709, table);
255: handleEntity("nabla", 8711, table);
256: handleEntity("isin", 8712, table);
257: handleEntity("notin", 8713, table);
258: handleEntity("ni", 8715, table);
259: handleEntity("prod", 8719, table);
260: handleEntity("sum", 8721, table);
261: handleEntity("minus", 8722, table);
262: handleEntity("lowast", 8727, table);
263: handleEntity("radic", 8730, table);
264: handleEntity("prop", 8733, table);
265: handleEntity("infin", 8734, table);
266: handleEntity("ang", 8736, table);
267: handleEntity("and", 8743, table);
268: handleEntity("or", 8744, table);
269: handleEntity("cap", 8745, table);
270: handleEntity("cup", 8746, table);
271: handleEntity("int", 8747, table);
272: handleEntity("there4", 8756, table);
273: handleEntity("sim", 8764, table);
274: handleEntity("cong", 8773, table);
275: handleEntity("asymp", 8776, table);
276: handleEntity("ne", 8800, table);
277: handleEntity("equiv", 8801, table);
278: handleEntity("le", 8804, table);
279: handleEntity("ge", 8805, table);
280: handleEntity("sub", 8834, table);
281: handleEntity("sup", 8835, table);
282: handleEntity("nsub", 8836, table);
283: handleEntity("sube", 8838, table);
284: handleEntity("supe", 8839, table);
285: handleEntity("oplus", 8853, table);
286: handleEntity("otimes", 8855, table);
287: handleEntity("perp", 8869, table);
288: handleEntity("sdot", 8901, table);
289: handleEntity("lceil", 8968, table);
290: handleEntity("rceil", 8969, table);
291: handleEntity("lfloor", 8970, table);
292: handleEntity("rfloor", 8971, table);
293: handleEntity("lang", 9001, table);
294: handleEntity("rang", 9002, table);
295: handleEntity("loz", 9674, table);
296: handleEntity("spades", 9824, table);
297: handleEntity("clubs", 9827, table);
298: handleEntity("hearts", 9829, table);
299: handleEntity("diams", 9830, table);
300: }
301:
302: private static void handleSpecial(final Hashtable table) {
303: //!Don't edit
304: handleEntity("quot", 34, table);
305: handleEntity("amp", 38, table);
306: handleEntity("lt", 60, table);
307: handleEntity("gt", 62, table);
308: handleEntity("OElig", 338, table);
309: handleEntity("oelig", 339, table);
310: handleEntity("Scaron", 352, table);
311: handleEntity("scaron", 353, table);
312: handleEntity("Yuml", 376, table);
313: handleEntity("circ", 710, table);
314: handleEntity("tilde", 732, table);
315: handleEntity("ensp", 8194, table);
316: handleEntity("emsp", 8195, table);
317: handleEntity("thinsp", 8201, table);
318: handleEntity("zwnj", 8204, table);
319: handleEntity("zwj", 8205, table);
320: handleEntity("lrm", 8206, table);
321: handleEntity("rlm", 8207, table);
322: handleEntity("ndash", 8211, table);
323: handleEntity("mdash", 8212, table);
324: handleEntity("lsquo", 8216, table);
325: handleEntity("rsquo", 8217, table);
326: handleEntity("sbquo", 8218, table);
327: handleEntity("ldquo", 8220, table);
328: handleEntity("rdquo", 8221, table);
329: handleEntity("bdquo", 8222, table);
330: handleEntity("dagger", 8224, table);
331: handleEntity("Dagger", 8225, table);
332: handleEntity("permil", 8240, table);
333: handleEntity("lsaquo", 8249, table);
334: handleEntity("rsaquo", 8250, table);
335: handleEntity("euro", 8364, table);
336: }
337: }
|