01 /*
02 * HtmlConstantsTests.java
03 * Copyright (c) 1998-2008, The University of Sheffield.
04 *
05 * This code is from the GATE project (http://gate.ac.uk/) and is free
06 * software licenced under the GNU General Public License version 3. It is
07 * distributed without any warranty. For more details see COPYING.txt in the
08 * top level directory (or at http://gatewiki.sf.net/COPYING.txt).
09 *
10 * Hamish Cunningham, 13th May 2006
11 */
12
13 package gate.yam.translate;
14
15 import java.util.*;
16 import junit.framework.*;
17 import gate.yam.parse.*;
18
19 /**
20 * Check that all the YAM parse tree nodes are associated with an appropriate
21 * set of constants.
22 */
23 public class HtmlConstantsTests extends TestCase
24 implements HtmlConstants, YamParserTreeConstants, TranslationConstants
25 {
26 /** Create the test case. */
27 public HtmlConstantsTests(String testName) { super(testName); }
28
29 /** Check HtmlConstants against YamParserTreeConstants. */
30 public void testConstants() {
31 int numNodes = jjtNodeName.length;
32
33 for(int i=0; i<numNodes; i++) {
34 if(i >= htmlConstantsTable.length)
35 fail("ran out of constants at jjtNodeName = " + jjtNodeName[i]);
36 if(! jjtNodeName[i].equals(htmlConstantsTable[i][CONSTANTNAME]))
37 fail(
38 "node name mismatch, wanted " + jjtNodeName[i] +
39 " but got " + htmlConstantsTable[i][CONSTANTNAME]
40 );
41 }
42
43 // html headings bug
44 HtmlTranslator htmlTranslator = new HtmlTranslator();
45 assertTrue("1".equals(htmlTranslator.getConstantStart("1")));
46
47 } // testConstants()
48
49 /** Get the path to the preamble resource (DUMMY). */
50 public String getPreamblePath() { return null; }
51
52 /** Array mapping node type name to start/end strings (DUMMY). */
53 public String[][] getConstantsTable() { return null; }
54
55 /** Array mapping predicate type name to attributes (DUMMY). */
56 public Object[][] getPredicatesTable() { return null; }
57
58 } // HtmlConstantsTests
|