Changeset 657 in tmcsimulator for trunk/test/tmcsim/highwaymodel


Ignore:
Timestamp:
09/12/2022 01:30:08 PM (4 years ago)
Author:
jdalbey
Message:

Update unit tests to run on Windows (path and line separators), remove obsolete paramics test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/tmcsim/highwaymodel/LoadHighwaysTest.java

    r653 r657  
    1818 */ 
    1919public class LoadHighwaysTest extends TestCase { 
     20    // Setup a path for temp files 
     21    static String tmpPath = "/tmp/";// default path is for linux 
     22    static 
     23    { 
     24        String myOs = System.getProperty("os.name").toLowerCase(); 
     25        if (myOs.indexOf("win") >= 0)  
     26        { 
     27          tmpPath = "C:/TEMP/";  // alt path for Windows 
     28        } 
     29    } 
    2030 
    2131    public LoadHighwaysTest(String testName) { 
     
    2838        PrintWriter writer = null; 
    2939        try { 
    30             writer = new PrintWriter(new FileWriter("/tmp/postmiles1.txt")); 
     40            writer = new PrintWriter(new FileWriter(tmpPath + "postmiles1.txt")); 
    3141            writer.println("5 S 0.9,33.408425,-117.599923,CALAFIA,0,0"); 
    3242            writer.println("5 N 1.24,33.413051,-117.601964,MAGDALENA,0,0"); 
    3343            writer.println("5 S 1.49,33.416348,-117.603827,EL CAMINO REAL,0,0"); 
    3444            writer.close(); 
    35             writer = new PrintWriter(new FileWriter("/tmp/postmiles3.txt")); 
     45            writer = new PrintWriter(new FileWriter(tmpPath + "postmiles3.txt")); 
    3646            writer.println("73 N 23.9,33.643656,-117.859875,BISON 2,0.976131,0.217185"); 
    3747            writer.println("55 S 6.88,33.697495,-117.862677,MACARTHU1,-0.710326,0.703873"); 
     
    4959    protected void tearDown() throws Exception { 
    5060        super.tearDown(); 
    51         Path path = FileSystems.getDefault().getPath("/tmp", "postmiles1.txt"); 
     61        Path path = FileSystems.getDefault().getPath(tmpPath, "postmiles1.txt"); 
    5262        Files.delete(path); 
    53         path = FileSystems.getDefault().getPath("/tmp", "postmiles3.txt"); 
     63        path = FileSystems.getDefault().getPath(tmpPath, "postmiles3.txt"); 
    5464        Files.delete(path); 
    5565    } 
     
    6171        System.out.println("testLoadHighways"); 
    6272        Highways highways = new Highways( 
    63                 "/tmp/postmiles1.txt"); 
     73                tmpPath + "postmiles1.txt"); 
    6474 
    6575        // Test for correct number of highways 
     
    97107        System.out.println("testLoadHighways2"); 
    98108        Highways highways = new Highways( 
    99                 "/tmp/postmiles3.txt"); 
     109                tmpPath + "postmiles3.txt"); 
    100110 
    101111        // Test for correct number of highways 
Note: See TracChangeset for help on using the changeset viewer.