From: <mwl...@us...> - 2007-08-22 18:20:42
|
Revision: 494 http://cishell.svn.sourceforge.net/cishell/?rev=494&view=rev Author: mwlinnem Date: 2007-08-22 11:20:40 -0700 (Wed, 22 Aug 2007) Log Message: ----------- Tests listed in converter reports are now sorted by success then test number. Modified Paths: -------------- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/ConverterTester2.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/allconvs/AllConvsReportGenerator.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/allconvs/ConvReportSubGenerator.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/ConvResult.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/TestResult.java Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/ConverterTester2.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/ConverterTester2.java 2007-08-22 17:26:12 UTC (rev 493) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/ConverterTester2.java 2007-08-22 18:20:40 UTC (rev 494) @@ -158,8 +158,7 @@ FilePassResult[] results = this.testRunner.runTest(testBasicData); //return the results of the test - String testName = "Test " + numTestsSoFar; - return new TestResult(results, testConvs, compareConvs, testName); + return new TestResult(results, testConvs, compareConvs, numTestsSoFar); } private Data[][] wrapInData(String[] testFilePaths, String format) { Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/allconvs/AllConvsReportGenerator.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/allconvs/AllConvsReportGenerator.java 2007-08-22 17:26:12 UTC (rev 493) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/allconvs/AllConvsReportGenerator.java 2007-08-22 18:20:40 UTC (rev 494) @@ -94,23 +94,38 @@ report.println("Trusted Converters..."); for (int ii = 0; ii < trustedConvs.size(); ii++) { ConvResult cr = (ConvResult) trustedConvs.get(ii); + + //add this converters name to all convs report report.println(" " + cr.getNameNoPackage()); + + //generate corresponding sub-report + this.convSubGen.generate(cr); + ConvReport convReport = this.convSubGen.getConvReport(); + convReportsList.add(convReport); } report.println(""); report.println("Non-Trusted Converters..."); for (int ii = 0; ii < nonTrustedConvs.size(); ii++) { ConvResult cr = (ConvResult) nonTrustedConvs.get(ii); + + //add this converters name to all convs report report.println(" " + cr.getNameNoPackage()); - } - report.println(""); - - for (int ii = 0; ii < convResults.length; ii++) { - this.convSubGen.generate(convResults[ii]); + + //generate corresponding sub-report + this.convSubGen.generate(cr); ConvReport convReport = this.convSubGen.getConvReport(); convReportsList.add(convReport); + } + report.println(""); +// for (int ii = 0; ii < convResults.length; ii++) { +// this.convSubGen.generate(convResults[ii]); +// ConvReport convReport = this.convSubGen.getConvReport(); +// convReportsList.add(convReport); +// } + // String summary = "%" + avgChanceCorrect * 100 + " Correct"; String summary = ""; ConvReport[] convReports = Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/allconvs/ConvReportSubGenerator.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/allconvs/ConvReportSubGenerator.java 2007-08-22 17:26:12 UTC (rev 493) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/allconvs/ConvReportSubGenerator.java 2007-08-22 18:20:40 UTC (rev 494) @@ -61,7 +61,7 @@ report.println(""); report.println("Involved in the following tests..."); - TestResult[] involvedTests = cr.getTests(); + TestResult[] involvedTests = cr.getTestsBySuccess(); for (int ii = 0; ii < involvedTests.length; ii++) { TestResult tr = involvedTests[ii]; report.println(" " + tr.getNameWithSuccess()); Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/ConvResult.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/ConvResult.java 2007-08-22 17:26:12 UTC (rev 493) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/ConvResult.java 2007-08-22 18:20:40 UTC (rev 494) @@ -1,10 +1,9 @@ package org.cishell.testing.convertertester.core.tester2.reportgen.results; import java.util.ArrayList; -import java.util.HashSet; +import java.util.Collections; import java.util.Iterator; import java.util.List; -import java.util.Set; import org.cishell.testing.convertertester.core.tester2.reportgen.results.filepass.FilePassFailure; import org.cishell.testing.convertertester.core.tester2.reportgen.results.filepass.FilePassSuccess; @@ -18,7 +17,7 @@ private List failFilePasses = new ArrayList(); private List successFilePasses = new ArrayList(); private List uniqueFailureExplanations = new ArrayList(); - private Set tests = new HashSet(); + private List tests = new ArrayList(); private boolean isTrusted; @@ -56,7 +55,9 @@ } public void addTest(TestResult tr) { - this.tests.add(tr); + if (! tests.contains(tr)) { + this.tests.add(tr); + } } /** @@ -95,9 +96,15 @@ } public TestResult[] getTests() { + Collections.sort(this.tests); return (TestResult[]) this.tests.toArray(new TestResult[0]); } + public TestResult[] getTestsBySuccess() { + Collections.sort(this.tests, TestResult.getCompareBySuccess()); + return (TestResult[]) this.tests.toArray(new TestResult[0]); + } + public void addPass(FilePassSuccess fp) { this.successFilePasses.add(fp); } Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/TestResult.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/TestResult.java 2007-08-22 17:26:12 UTC (rev 493) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/TestResult.java 2007-08-22 18:20:40 UTC (rev 494) @@ -1,13 +1,14 @@ package org.cishell.testing.convertertester.core.tester2.reportgen.results; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import org.cishell.testing.convertertester.core.converter.graph.ConverterPath; -public class TestResult { +public class TestResult implements Comparable { public static final String DEFAULT_NAME = "Default Test Result Name"; @@ -15,6 +16,8 @@ private List passedFPRs; private List failedFPRs; + private int testNum; + private String format; private String name = DEFAULT_NAME; @@ -25,11 +28,12 @@ private boolean[] successes; public TestResult(FilePassResult[] fprs, ConverterPath testConvs, - ConverterPath compareConvs, String name) { + ConverterPath compareConvs, int testNum) { this.fprs = fprs; this.testConvs = testConvs; this.compareConvs = compareConvs; - this.name = name; + this.testNum = testNum; + this.name = "Test " + testNum; this.successes = new boolean[fprs.length]; @@ -96,6 +100,10 @@ return this.name; } + public int getTestNum() { + return this.testNum; + } + public String getNameWithSuccess() { return getName() + " - " + getSummary(); } @@ -166,8 +174,62 @@ this.cachedSuccesses = true; } + + public int compareTo(Object arg0) { + if ((arg0 instanceof TestResult)) { + TestResult otherTR = (TestResult) arg0; + return getTestNum() - otherTR.getTestNum(); + } else { + throw new IllegalArgumentException("Must compare to another " + + "TestResult"); + } + } + public static Comparator getCompareBySuccess() { + return new CompareBySuccess(); + } + private static class CompareBySuccess implements Comparator { + + /** + * Compare first by success, where + * completely successful > partially successful > complet failure, + * and then alphabetize (the natural order of test results) + * for cases where they both have the same success type. + */ + public int compare(Object o1, Object o2) { + if (o1 instanceof TestResult && o2 instanceof TestResult) { + TestResult tr1 = (TestResult) o1; + TestResult tr2 = (TestResult) o2; + + int success1 = getSuccessRating(tr1); + int success2 = getSuccessRating(tr2); + + if (success1 != success2) { + return success2 - success1; + } else { + return tr1.compareTo(tr2); + } + + } else { + throw new IllegalArgumentException("Can only " + + "compare test results"); + } + + } + + private int getSuccessRating(TestResult tr) { + if (tr.allSucceeded()) { + return 2; + } else if (tr.someSucceeded()) { + return 1; + } else { + return 0; + } + } + } + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |