[FOray-commit] SF.net SVN: foray: [8515] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-01-25 02:47:31
|
Revision: 8515
http://svn.sourceforge.net/foray/?rev=8515&view=rev
Author: victormote
Date: 2007-01-24 18:47:30 -0800 (Wed, 24 Jan 2007)
Log Message:
-----------
Move a test in the TernaryTree main() method to a JUnit test case, and add infrastructure to run it.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayAll.java
trunk/foray/foray-hyphen-r/.classpath
trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/TernaryTree.java
Added Paths:
-----------
trunk/foray/foray-hyphen-r/src/javatest/
trunk/foray/foray-hyphen-r/src/javatest/org/
trunk/foray/foray-hyphen-r/src/javatest/org/foray/
trunk/foray/foray-hyphen-r/src/javatest/org/foray/hyphenR/
trunk/foray/foray-hyphen-r/src/javatest/org/foray/hyphenR/TestFOrayHyphenR.java
trunk/foray/foray-hyphen-r/src/javatest/org/foray/hyphenR/TestTernaryTree.java
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayAll.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayAll.java 2007-01-25 02:10:09 UTC (rev 8514)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayAll.java 2007-01-25 02:47:30 UTC (rev 8515)
@@ -29,6 +29,7 @@
package org.foray.app;
import org.foray.fotree.TestFOrayFOTree;
+import org.foray.hyphenR.TestFOrayHyphenR;
import org.foray.ps.TestFOrayPS;
import junit.framework.Test;
@@ -47,6 +48,7 @@
final TestSuite testSuite = new TestSuite();
testSuite.addTest(TestFOrayFOTree.suite());
testSuite.addTest(TestFOrayPS.suite());
+ testSuite.addTest(TestFOrayHyphenR.suite());
return testSuite;
}
Modified: trunk/foray/foray-hyphen-r/.classpath
===================================================================
--- trunk/foray/foray-hyphen-r/.classpath 2007-01-25 02:10:09 UTC (rev 8514)
+++ trunk/foray/foray-hyphen-r/.classpath 2007-01-25 02:47:30 UTC (rev 8515)
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding=".#*" kind="src" path="src/java"/>
+ <classpathentry kind="src" path="src/javatest"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="FORAY_LIB_ROOT/commons-logging.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/FOrayCommon"/>
<classpathentry kind="var" path="ANT_HOME/lib/ant.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslHyphen-R"/>
+ <classpathentry kind="lib" path="/FOrayLibsBuild/junit/junit.jar"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/TernaryTree.java
===================================================================
--- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/TernaryTree.java 2007-01-25 02:10:09 UTC (rev 8514)
+++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/TernaryTree.java 2007-01-25 02:47:30 UTC (rev 8515)
@@ -33,8 +33,6 @@
package org.foray.hyphenR;
-import org.foray.common.Logging;
-
import org.apache.commons.logging.Log;
import java.io.Serializable;
@@ -436,6 +434,14 @@
}
/**
+ * Returns the number of nodes in the tree.
+ * @return The number of nodes in the tree.
+ */
+ public int getNodeCount() {
+ return this.freenode;
+ }
+
+ /**
* {@inheritDoc}
*/
public Object clone() {
@@ -746,20 +752,6 @@
}
- public static void main(final String[] args) throws Exception {
- final Log logger = Logging.makeDefaultLogger();
- final TernaryTree tt = new TernaryTree();
- tt.insert("Carlos", 'C');
- tt.insert("Car", 'r');
- tt.insert("palos", 'l');
- tt.insert("pa", 'p');
- tt.trimToSize();
- logger.info(String.valueOf((char) tt.find("Car")));
- logger.info(String.valueOf((char) tt.find("Carlos")));
- logger.info(String.valueOf((char) tt.find("alto")));
- tt.printStats(logger);
- }
-
/**
* Returns the root.
* @return Returns the root.
Added: trunk/foray/foray-hyphen-r/src/javatest/org/foray/hyphenR/TestFOrayHyphenR.java
===================================================================
--- trunk/foray/foray-hyphen-r/src/javatest/org/foray/hyphenR/TestFOrayHyphenR.java (rev 0)
+++ trunk/foray/foray-hyphen-r/src/javatest/org/foray/hyphenR/TestFOrayHyphenR.java 2007-01-25 02:47:30 UTC (rev 8515)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2006 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.hyphenR;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Handles testing for the FOrayHyphen-R module.
+ */
+public class TestFOrayHyphenR extends TestCase {
+
+ /**
+ * Builds a test suite for all classes in this module.
+ * @return The built test suite.
+ */
+ public static Test suite() {
+ final TestSuite testSuite = new TestSuite();
+ testSuite.addTestSuite(TestTernaryTree.class);
+ return testSuite;
+ }
+
+}
Property changes on: trunk/foray/foray-hyphen-r/src/javatest/org/foray/hyphenR/TestFOrayHyphenR.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/foray-hyphen-r/src/javatest/org/foray/hyphenR/TestTernaryTree.java
===================================================================
--- trunk/foray/foray-hyphen-r/src/javatest/org/foray/hyphenR/TestTernaryTree.java (rev 0)
+++ trunk/foray/foray-hyphen-r/src/javatest/org/foray/hyphenR/TestTernaryTree.java 2007-01-25 02:47:30 UTC (rev 8515)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2007 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.hyphenR;
+
+import junit.framework.TestCase;
+
+/**
+ * JUnit test class for the class {@link TernaryTree}.
+ */
+public class TestTernaryTree extends TestCase {
+
+/**
+ * Functional test which adds some key-value pairs to a TernaryTree, then
+ * queries the tree, testing the output.
+ */
+public void testOutput() {
+ /* This test was adapted from the tested class's main() method, which was
+ * the previous mode for testing. The expected values recorded below are
+ * those that were produced by running said method immediately before
+ * creating the class, and are not independently known to be correct.*/
+ final TernaryTree map = new TernaryTree();
+ map.insert("Carlos", 'C');
+ map.insert("Car", 'r');
+ map.insert("palos", 'l');
+ map.insert("pa", 'p');
+ map.trimToSize();
+
+ assertEquals('r', (char) map.find("Car"));
+ assertEquals('C', (char) map.find("Carlos"));
+ assertEquals('\uFFFF', (char) map.find("alto"));
+ assertEquals(4, map.size());
+ assertEquals(10, map.getNodeCount());
+ assertEquals(5, map.getKv().length());
+}
+
+}
Property changes on: trunk/foray/foray-hyphen-r/src/javatest/org/foray/hyphenR/TestTernaryTree.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|