Changeset 2880


Ignore:
Timestamp:
06/18/07 11:41:39 (12 years ago)
Author:
melissa
Message:

ReaderTest now compiles with jikes.

Location:
trunk/loci/formats/test
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/test/ConfigurationFiles.java

    r2872 r2880  
    5353 
    5454  public boolean initialized(String id) { 
    55     return entries.containsKey(id) && getNumSeries(id) <= currentSeries; 
     55    return entries.containsKey(id) && currentSeries <= getNumSeries(id); 
    5656  } 
    5757 
     
    165165 
    166166  public int getNumSeries(String id) { 
    167     if (!entries.contains(id)) return 0; 
     167    if (!entries.containsKey(id)) return 0; 
    168168    return ((ConfigEntry) entries.get(id)).numSeries; 
    169169  } 
  • trunk/loci/formats/test/ReaderTest.java

    r2873 r2880  
    3131import loci.formats.*; 
    3232import loci.formats.ome.OMEXMLMetadataStore; 
    33 import org.testng.*; 
    34 import org.testng.xml.*; 
    3533 
    3634/**  
     
    3937 * 
    4038 * To run tests: 
    41  * java -ea -mx512m loci.formats.test.ReaderTest <test group> <directory> <time> 
     39 * java -ea -mx512m -Dtestng.directory="/path/" -Dtestng.multiplier="1.0" \ 
     40 *   org.testng.TestNG -sourcedir . testng.xml  
    4241 */ 
    4342public class ReaderTest { 
    4443 
    4544  // -- Fields -- 
    46  
    47   /** Root data directory. */ 
    48   public static String root; 
    4945 
    5046  /** Whether or not this is the first time calling the data provider. */ 
     
    7167    if (isFirstTime) { 
    7268      toTest = new Vector();  
    73       getFiles(root, toTest); 
     69      getFiles(System.getProperty("testng.directory"), toTest); 
    7470      isFirstTime = false;  
    7571    } 
     
    279275      reader.setId(file); 
    280276 
     277      store = (OMEXMLMetadataStore) reader.getMetadataStore(); 
     278 
    281279      boolean success = true; 
    282280      for (int i=0; i<reader.getSeriesCount(); i++) { 
     
    299297 
    300298        if (success) { 
    301           success = failX || failY || failZ || failC || failT || failBE || 
    302             failType || failDE; 
     299          success = !(failX || failY || failZ || failC || failT || failBE || 
     300            failDE || failType); 
    303301        } 
    304302        if (!success) break;  
     
    323321      r.setId(file); 
    324322 
    325       boolean success = true;; 
     323      boolean success = true; 
    326324      boolean failSeries = r.getSeriesCount() != config.getNumSeries(file); 
    327325        
     
    335333        r.setSeries(i); 
    336334        config.setSeries(file, i); 
    337  
     335       
    338336        boolean failX = config.getWidth(file) != r.getSizeX(); 
    339337        boolean failY = config.getHeight(file) != r.getSizeY(); 
     
    345343        boolean failInt = config.isInterleaved(file) != r.isInterleaved();  
    346344        boolean failRGB = config.isRGB(file) != r.isRGB(); 
    347         boolean failTX = config.getThumbX(file) != r.getThumbSizeX(); 
    348         boolean failTY = config.getThumbY(file) != r.getThumbSizeY(); 
     345        // TODO : uncomment this once the config files have been updated  
     346        //boolean failTX = config.getThumbX(file) != r.getThumbSizeX(); 
     347        //boolean failTY = config.getThumbY(file) != r.getThumbSizeY(); 
    349348        boolean failType = config.getPixelType(file) != r.getPixelType(); 
    350349        boolean failEndian = config.isLittleEndian(file) != r.isLittleEndian(); 
    351350       
    352         success = failX || failY || failZ || failC || failT || failDim || 
    353           failInt || failRGB || failTX || failTY || failType || failEndian; 
     351        success = !(failX || failY || failZ || failC || failT || failDim || 
     352          failInt || failRGB || /*failTX || failTY || */failType || failEndian); 
    354353      
    355354        if (!success) { 
     
    418417   * @testng.test dataProvider = "provider" 
    419418   *              groups = "all"  
    420    * @testng.parameters value = "timeMultiplier"  
    421    */ 
    422   public void testAccessTime(String file, float timeMultiplier) { 
    423     try { 
     419   */ 
     420  public void testAccessTime(String file) { 
     421    try { 
     422      float timeMultiplier =  
     423        Float.parseFloat(System.getProperty("testng.multiplier"));  
     424       
    424425      FileStitcher reader = new FileStitcher(); 
    425426      reader.setId(file); 
     
    511512   */ 
    512513  public void testPixelsHashes(String file) { 
     514    boolean success = true; 
    513515    try {  
    514516      // check the MD5 of the first plane in each series  
     
    517519      reader.setId(file); 
    518520 
    519       boolean success = false; 
    520521      for (int i=0; i<reader.getSeriesCount(); i++) { 
    521522        reader.setSeries(i); 
     
    525526          writeLog(file + " failed pixels consistency (series " + i + ")"); 
    526527          success = false; 
    527           break; 
    528         } 
    529       } 
    530       assert success;  
     528          assert success; 
     529          return; 
     530        } 
     531      } 
    531532    } 
    532533    catch (Exception exc) { 
     
    535536      assert false;  
    536537    } 
     538    assert success;  
    537539  } 
    538540 
     
    654656    Location f = new Location(root); 
    655657    String[] subs = f.list(); 
     658    if (subs == null) subs = new String[0];  
    656659    Arrays.sort(subs); 
    657660 
     
    708711      try {  
    709712        String s = (String) configFiles.get(i); 
    710         if (!config.isParsed(s)) config.addFile(s); 
     713        if (!config.isParsed(s)) { 
     714          config.addFile(s); 
     715        }  
    711716      }  
    712717      catch (IOException exc) { 
     
    734739  } 
    735740 
    736   // -- Main method -- 
    737  
    738   public static void main(String[] args) { 
    739     if (args.length < 3) { 
    740       System.out.println("Usage:\njava loci.formats.test.ReaderTest " + 
    741         "<all | fast | xml | pixels | config> <data directory> " + 
    742         "<timing multiplier>"); 
    743     } 
    744  
    745     ReaderTest.root = args[1];  
    746  
    747     XmlSuite suite = new XmlSuite(); 
    748     suite.setName("bftest"); 
    749  
    750     Hashtable params = new Hashtable(); 
    751     params.put("timeMultiplier", args[2]); 
    752     suite.setParameters(params); 
    753  
    754     XmlTest test = new XmlTest(suite); 
    755     test.setName("bf-" + args[0]); 
    756     List classes = new ArrayList(); 
    757     classes.add(new XmlClass("loci.formats.test.ReaderTest")); 
    758     test.setXmlClasses(classes);  
    759     List groups = new ArrayList(); 
    760     groups.add(args[0]); 
    761     test.setIncludedGroups(groups); 
    762  
    763     List suites = new ArrayList(); 
    764     suites.add(suite); 
    765     TestNG tng = new TestNG(); 
    766     tng.setSourcePath(".");  
    767     tng.setXmlSuites(suites); 
    768     tng.run(); 
    769   } 
    770  
    771741} 
Note: See TracChangeset for help on using the changeset viewer.