Hi list,
I was trying to move the libjdepend-java debian package to our 'main'
section (compiled with free tools) and it compiled fine with kaffe. I
thought it was a good idea to also run the junit tests against the free
compiled version and I got two failures.
Attached is the diff of the junit tests (it's not a real diff because I
removed unnecessary lines). I also attached the junit test of jdepend.
I'll upload the package as is. I don't know exactly if it's a problem in
NumberFormat or if the jdepend classes does not run as it should.
Thanks for your comments,
--
Arnaud Vandyck
,= ,-_-. =.
((_/)o o(\_))
`-'(. .)`-'
\_/
Java Trap: http://www.gnu.org/philosophy/java-trap.html
--- jdepend-2.9-IBM-JDK-1.4.2.build.log 2005-03-22 09:35:41.471963904 +0100
+++ jdepend-2.9-kaffe.build.log 2005-03-22 09:41:25.775621792 +0100
[...]
test:
[junit] Testsuite: jdepend.framework.AllTests
- [junit] Tests run: 53, Failures: 0, Errors: 0, Time elapsed: 3.971 sec
+ [junit] Tests run: 45, Failures: 1, Errors: 0, Time elapsed: 19.471 sec
- [junit] Testcase: testInvalidClassFile took 0.017 sec
- [junit] Testcase: testInterfaceClass took 0.009 sec
- [junit] Testcase: testAbstractClass took 0.007 sec
- [junit] Testcase: testConcreteClass took 0.018 sec
- [junit] Testcase: testInnerClass took 0.006 sec
- [junit] Testcase: testPackageClass took 0.002 sec
- [junit] Testcase: testJDependComponents took 0.549 sec
- [junit] Testcase: testInvalidJarFile took 0.002 sec
- [junit] Testcase: testInvalidZipFile took 0.002 sec
- [junit] Testcase: testJarFile took 0.018 sec
- [junit] Testcase: testJarFileWithoutInnerClasses took 0.028 sec
- [junit] Testcase: testZipFile took 0.007 sec
- [junit] Testcase: testZipFileWithoutInnerClasses took 0.007 sec
- [junit] Testcase: testCountClasses took 0.01 sec
- [junit] Testcase: testMatchPass took 0.019 sec
- [junit] Testcase: testMatchFail took 0.003 sec
- [junit] Testcase: testJDependConstraints took 0.417 sec
- [junit] Testcase: testNoCycles took 0.008 sec
- [junit] Testcase: test2Node1BranchCycle took 0 sec
- [junit] Testcase: test3Node1BranchCycle took 0.001 sec
- [junit] Testcase: test3Node1BranchSubCycle took 0.001 sec
- [junit] Testcase: test3Node2BranchCycle took 0.001 sec
- [junit] Testcase: test5Node2BranchCycle took 0.001 sec
- [junit] Testcase: testNoCycles took 0.001 sec
- [junit] Testcase: test2Node1BranchCycle took 0 sec
- [junit] Testcase: test3Node1BranchCycle took 0 sec
- [junit] Testcase: test3Node1BranchSubCycle took 0.001 sec
- [junit] Testcase: test3Node2BranchCycle took 0.001 sec
- [junit] Testcase: test5Node2BranchCycle took 0.001 sec
- [junit] Testcase: testEmptyFileManager took 0 sec
- [junit] Testcase: testBuildDirectory took 0.008 sec
- [junit] Testcase: testNonExistentDirectory took 0.001 sec
- [junit] Testcase: testInvalidDirectory took 0 sec
- [junit] Testcase: testClassFile took 0.001 sec
- [junit] Testcase: testNonExistentClassFile took 0 sec
- [junit] Testcase: testInvalidClassFile took 0.001 sec
- [junit] Testcase: testJar took 0.001 sec
- [junit] Testcase: testZip took 0 sec
- [junit] Testcase: testWar took 0.001 sec
- [junit] Testcase: testDefault took 0.002 sec
- [junit] Testcase: testFile took 0.001 sec
- [junit] Testcase: testCollection took 0 sec
- [junit] Testcase: testCollectionSubset took 0 sec
- [junit] Testcase: testAnalyzeClassFiles took 0.398 sec
- [junit] Testcase: testConfiguredVolatility took 0.334 sec
- [junit] Testcase: testDefaultFilters took 0.001 sec
- [junit] Testcase: testFiltersFromFile took 0.188 sec
- [junit] Testcase: testDefaultPackages took 0.038 sec
- [junit] Testcase: testOnePackageDistance took 0.348 sec
- [junit] Testcase: testOnePackageHasNoCycles took 0.392 sec
- [junit] Testcase: testAllPackagesDistance took 0.356 sec
- [junit] Testcase: testAllPackagesHaveNoCycles took 0.394 sec
- [junit] Testcase: testDependencyConstraint took 0.351 sec
[...]
+ [junit] Testcase: testPackageClass took 0.068 sec
+ [junit] Testcase: testInnerClass took 0.027 sec
+ [junit] Testcase: testConcreteClass took 0.059 sec
+ [junit] Testcase: testAbstractClass took 0.044 sec
+ [junit] Testcase: testInterfaceClass took 0.027 sec
+ [junit] Testcase: testInvalidClassFile took 0.008 sec
+ [junit] Testcase: testJDependComponents took 4.031 sec
+ [junit] Testcase: testCountClasses took 0.185 sec
+ [junit] Testcase: testZipFileWithoutInnerClasses took 0.164 sec
+ [junit] Testcase: testZipFile took 0.191 sec
+ [junit] Testcase: testJarFileWithoutInnerClasses took 0.187 sec
+ [junit] Testcase: testJarFile took 0.176 sec
+ [junit] Testcase: testInvalidZipFile took 0.007 sec
+ [junit] Testcase: testInvalidJarFile took 0.008 sec
+ [junit] Testcase: testJDependConstraints took 4.615 sec
+ [junit] Testcase: testMatchFail took 0.011 sec
+ [junit] Testcase: testMatchPass took 0.015 sec
+ [junit] Testcase: test5Node2BranchCycle took 0.01 sec
+ [junit] Testcase: test3Node2BranchCycle took 0.005 sec
+ [junit] Testcase: test3Node1BranchSubCycle took 0.005 sec
+ [junit] Testcase: test3Node1BranchCycle took 0.005 sec
+ [junit] Testcase: test2Node1BranchCycle took 0.004 sec
+ [junit] Testcase: testNoCycles took 0.003 sec
+ [junit] Testcase: test5Node2BranchCycle took 0.011 sec
+ [junit] Testcase: test3Node2BranchCycle took 0.005 sec
+ [junit] Testcase: test3Node1BranchSubCycle took 0.005 sec
+ [junit] Testcase: test3Node1BranchCycle took 0.005 sec
+ [junit] Testcase: test2Node1BranchCycle took 0.004 sec
+ [junit] Testcase: testNoCycles took 0.004 sec
+ [junit] Testcase: testWar took 0.01 sec
+ [junit] Testcase: testZip took 0.005 sec
+ [junit] Testcase: testJar took 0.006 sec
+ [junit] Testcase: testInvalidClassFile took 0.003 sec
+ [junit] Testcase: testNonExistentClassFile took 0.003 sec
+ [junit] Testcase: testClassFile took 0.004 sec
+ [junit] Testcase: testInvalidDirectory took 0.007 sec
+ [junit] Testcase: testNonExistentDirectory took 0.002 sec
+ [junit] Testcase: testBuildDirectory took 0.269 sec
+ [junit] Testcase: testEmptyFileManager took 0.003 sec
+ [junit] Testcase: testCollectionSubset took 0.002 sec
+ [junit] Testcase: testCollection took 0.003 sec
+ [junit] Testcase: testFile took 0.017 sec
+ [junit] Testcase: testDefault took 0.1 sec
+ [junit] Testcase: testConfiguredVolatility took 4.261 sec
+ [junit] Testcase: testAnalyzeClassFiles took 4.763 sec
+ [junit] FAILED
+ [junit] expected:<...2> but was:<...3>
+ [junit] junit.framework.ComparisonFailure: expected:<...2> but was:<...3>
+ [junit] at jdepend.framework.MetricTest.assertSwingUIPackage
(MetricTest.java:99)
+ [junit] at jdepend.framework.MetricTest.assertAnalyzePackages
(MetricTest.java:56)
+ [junit] at jdepend.framework.MetricTest.testAnalyzeClassFiles
(MetricTest.java:42)
+ [junit] at java.lang.reflect.Method.invoke0 (Method.java)
+ [junit] at java.lang.reflect.Method.invoke (Method.java:255)
package jdepend.framework;
import java.io.IOException;
import java.text.NumberFormat;
/**
* @author <b>Mike Clark</b>
* @author Clarkware Consulting, Inc.
*/
public class MetricTest extends JDependTestCase {
private JDepend jdepend;
private static NumberFormat formatter;
static {
formatter = NumberFormat.getInstance();
formatter.setMaximumFractionDigits(2);
}
public MetricTest(String name) {
super(name);
}
protected void setUp() {
super.setUp();
PackageFilter filter = new PackageFilter();
filter.addPackage("java.*");
filter.addPackage("javax.*");
jdepend = new JDepend(filter);
jdepend.analyzeInnerClasses(false);
}
protected void tearDown() {
super.tearDown();
}
public void testAnalyzeClassFiles() throws IOException {
jdepend.addDirectory(getBuildDir());
assertAnalyzePackages();
}
private void assertAnalyzePackages() {
assertEquals(39, jdepend.countClasses());
PackageFilter filter = jdepend.getFilter();
filter.addPackage("junit.*");
jdepend.analyze();
assertFrameworkPackage();
assertTextUIPackage();
assertSwingUIPackage();
assertXmlUIPackage();
}
private void assertFrameworkPackage() {
JavaPackage p = jdepend.getPackage("jdepend.framework");
assertNotNull(p);
assertEquals(25, p.getConcreteClassCount());
assertEquals(4, p.getAbstractClassCount());
assertEquals(3, p.afferentCoupling());
assertEquals(0, p.efferentCoupling());
assertEquals(format(0.14f), format(p.abstractness()));
assertEquals(format(0.0f), format(p.instability()));
assertEquals(format(0.86f), format(p.distance()));
assertEquals(1, p.getVolatility());
}
private void assertTextUIPackage() {
JavaPackage p = jdepend.getPackage("jdepend.textui");
assertNotNull(p);
assertEquals(1, p.getConcreteClassCount());
assertEquals(0, p.getAbstractClassCount());
assertEquals(1, p.efferentCoupling());
assertEquals("0", format(p.abstractness()));
assertEquals(1, p.afferentCoupling());
assertEquals(format(0.5f), format(p.instability()));
assertEquals(format(0.5f), format(p.distance()));
assertEquals(1, p.getVolatility());
}
private void assertSwingUIPackage() {
JavaPackage p = jdepend.getPackage("jdepend.swingui");
assertNotNull(p);
assertEquals(7, p.getConcreteClassCount());
assertEquals(1, p.getAbstractClassCount());
assertEquals(0, p.afferentCoupling());
assertEquals(1, p.efferentCoupling());
assertEquals(format(0.12f), format(p.abstractness()));
assertEquals("1", format(p.instability()));
assertEquals(format(0.12f), format(p.distance()));
assertEquals(1, p.getVolatility());
}
private void assertXmlUIPackage() {
JavaPackage p = jdepend.getPackage("jdepend.xmlui");
assertNotNull(p);
assertEquals(1, p.getConcreteClassCount());
assertEquals(0, p.getAbstractClassCount());
assertEquals(0, p.afferentCoupling());
assertEquals(2, p.efferentCoupling());
assertEquals(format(0.0f), format(p.abstractness()));
assertEquals("1", format(p.instability()));
assertEquals(format(0.0f), format(p.distance()));
assertEquals(1, p.getVolatility());
}
public void testConfiguredVolatility() throws IOException {
jdepend.addDirectory(getBuildDir());
JavaPackage pkg = new JavaPackage("jdepend.swingui");
pkg.setVolatility(0);
jdepend.addPackage(pkg);
jdepend.analyze();
JavaPackage analyzedPkg = jdepend.getPackage(pkg.getName());
assertEquals(0, analyzedPkg.getVolatility());
assertEquals(format(0.0f), format(analyzedPkg.distance()));
assertEquals(7, analyzedPkg.getConcreteClassCount());
}
private String format(float f) {
return formatter.format(f);
}
}
_______________________________________________
Classpath mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath