Various unit test fixes.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1748 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
<!-- build configuration -->
|
||||
<project name="samskivert tests" default="test" basedir=".">
|
||||
|
||||
<!-- we want to access the environment -->
|
||||
<property environment="env"/>
|
||||
<property name="java.libraries" value="${env.JAVA_LIBS}"/>
|
||||
|
||||
<!-- we need to do this to avoid conflicts with the XML jar files loaded
|
||||
to run ant versus the XML jar files we load for our tests -->
|
||||
<!-- we need to do this to avoid conflicts with the XML jar files loaded -->
|
||||
<!-- to run ant versus the XML jar files we load for our tests -->
|
||||
<property name="junit.fork" value="true"/>
|
||||
|
||||
<!-- things you probably don't want to change -->
|
||||
@@ -20,7 +16,6 @@
|
||||
<pathelement location="${deploy.dir}/classes"/>
|
||||
<fileset dir="../lib" includes="**/*.jar"/>
|
||||
<fileset dir="lib" includes="**/*.jar"/>
|
||||
<fileset dir="${java.libraries}" includes="**/*.jar"/>
|
||||
</path>
|
||||
|
||||
<!-- prepares the application directories -->
|
||||
@@ -51,7 +46,9 @@
|
||||
|
||||
<!-- run the tests -->
|
||||
<target name="test" depends="compile" description="Run tests.">
|
||||
<junit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
|
||||
<taskdef name="unit" classpathref="classpath"
|
||||
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
|
||||
<unit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
|
||||
<classpath refid="classpath"/>
|
||||
<sysproperty key="test_dir" value="${test.dir}"/>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
@@ -60,7 +57,7 @@
|
||||
<include name="**/*Test.java"/>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
</unit>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
||||
+3
-3
@@ -31,7 +31,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.commons.io.StreamUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import com.samskivert.test.TestUtil;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class SiteResourceLoaderTest extends TestCase
|
||||
if (cin == null) {
|
||||
throw new IOException("Unable to load " + compareFile);
|
||||
}
|
||||
cmp.append(StreamUtils.streamAsString(cin));
|
||||
cmp.append(IOUtils.toString(cin));
|
||||
|
||||
// Log.info("Loaded resources [cmp=" + compareFile + "]: " + gen);
|
||||
|
||||
@@ -107,7 +107,7 @@ public class SiteResourceLoaderTest extends TestCase
|
||||
rpath = TestUtil.getResourcePath(rpath);
|
||||
rin = new FileInputStream(rpath);
|
||||
}
|
||||
buffer.append(StreamUtils.streamAsString(rin));
|
||||
buffer.append(IOUtils.toString(rin));
|
||||
}
|
||||
|
||||
public static Test suite ()
|
||||
|
||||
@@ -130,6 +130,6 @@ public class HashIntMapTest extends TestCase
|
||||
}
|
||||
|
||||
protected static final String TEST1 =
|
||||
"(19, 18, 17, 16, 15, 14, 13, 12, 11, 10)";
|
||||
"(15, 16, 14, 19, 11, 18, 12, 17, 13, 10)";
|
||||
protected static final String TEST2 = "(11, 10)";
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class QuickSortTest extends TestCase
|
||||
for (int d = 1; d <= 100; d++) {
|
||||
for (int n = 0; n < 100; n++) {
|
||||
a[n] = new Integer(n / d);
|
||||
QuickSort.csort (a, 0, n, comp);
|
||||
QuickSort.sort(a, 0, n, comp);
|
||||
for (int i = 0; i <= n; i++) {
|
||||
assertTrue("Failure for up " + n + "/" + d,
|
||||
a[i].intValue() == i / d);
|
||||
@@ -45,7 +45,7 @@ public class QuickSortTest extends TestCase
|
||||
for (int i = 0; i <= n; i++) {
|
||||
a[i] = new Integer((n - i) / d);
|
||||
}
|
||||
QuickSort.csort (a, 0, n, comp);
|
||||
QuickSort.sort(a, 0, n, comp);
|
||||
for (int i = 0; i <= n; i++) {
|
||||
assertTrue("Failure for down " + n + "/" + d,
|
||||
a[i].intValue() == i / d);
|
||||
@@ -61,20 +61,20 @@ public class QuickSortTest extends TestCase
|
||||
a[i] = new Integer(rand(30000));
|
||||
}
|
||||
|
||||
QuickSort.csort (a, 0, n, comp);
|
||||
QuickSort.sort(a, 0, n, comp);
|
||||
for (int i = 0; i < n; i++) {
|
||||
assertTrue("Failure for random " + n,
|
||||
a[i].intValue() <= a[i+1].intValue());
|
||||
}
|
||||
|
||||
QuickSort.csort (a, 0, n, comp);
|
||||
QuickSort.sort(a, 0, n, comp);
|
||||
for (int i = 0; i < n; i++) {
|
||||
assertTrue("Failure for random " + n + " (resort)",
|
||||
a[i].intValue() <= a[i+1].intValue());
|
||||
}
|
||||
|
||||
a[rand(n+1)] = new Integer(rand(30000));
|
||||
QuickSort.csort (a, 0, n, comp);
|
||||
QuickSort.sort(a, 0, n, comp);
|
||||
for (int i = 0; i < n; i++) {
|
||||
assertTrue("Failure for random " + n + " (resort 2)",
|
||||
a[i].intValue() <= a[i+1].intValue());
|
||||
|
||||
@@ -66,15 +66,15 @@ public class SetFieldRuleTest extends TestCase
|
||||
|
||||
// set up some rules
|
||||
digester.addRule("object/intField",
|
||||
new SetFieldRule(digester, "intField"));
|
||||
new SetFieldRule("intField"));
|
||||
digester.addRule("object/stringField",
|
||||
new SetFieldRule(digester, "stringField"));
|
||||
new SetFieldRule("stringField"));
|
||||
digester.addRule("object/integerField",
|
||||
new SetFieldRule(digester, "integerField"));
|
||||
new SetFieldRule("integerField"));
|
||||
digester.addRule("object/intArrayField",
|
||||
new SetFieldRule(digester, "intArrayField"));
|
||||
new SetFieldRule("intArrayField"));
|
||||
digester.addRule("object/stringArrayField",
|
||||
new SetFieldRule(digester, "stringArrayField"));
|
||||
new SetFieldRule("stringArrayField"));
|
||||
|
||||
try {
|
||||
String xmlpath =
|
||||
|
||||
Reference in New Issue
Block a user