Changeset 160 in tmcsimulator for trunk


Ignore:
Timestamp:
10/22/2017 12:55:32 PM (9 years ago)
Author:
jdalbey
Message:

LoadSadDotsTest?.java Unit test for Highways and Stations for sad vs happy dots.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/test/atmsdriver/model/LoadSadDotsTest.java

    r103 r160  
    1313 * @author jdalbey 
    1414 */ 
    15 public class LoadHighwaysTest extends TestCase { 
     15public class LoadSadDotsTest extends TestCase { 
    1616 
    17     public LoadHighwaysTest(String testName) { 
     17    public LoadSadDotsTest(String testName) { 
    1818        super(testName); 
    1919    } 
     
    2727             
    2828            writer.println("lds_id      line    drop sch lineinfo       system_key      sch_seq glo_seq         count   freeway Dir     ca_pm   lds_name"); 
    29             writer.println("1203081     6       17      2       2       1123005691      26491   1357639         19      55      N       4.58    BRISTOL"); 
    30             writer.println("1210163     6       20      2       2       1123005691      26491   1357639         19      55      N       5.51    PAULARINO 1"); 
    31             writer.println("1203244     50      4       13      13      1123005873      24148   1357650         19      55      N       10      MCFADDEN"); 
    32             writer.println("1203211     50      5       13      13      1123005873      24148   1357650         19      55      N       9.41    EDINGER 2"); 
    33              
    34             writer.println("1203261     23      14      23      21      1123005995      26479   1357626         18      55      S       10.4    S OF 5"); 
    35             writer.println("1203083     6       18      2       2       1123005691      26491   1357639         19      55      S       4.7     BAKER 1"); 
    36             writer.println("1210174     6       19      2       2       1123005691      26491   1357639         19      55      S       5.06    BAKER 2"); 
    37             writer.println("1203270     23      15      23      21      1123005995      26479   1357626         18      55      S       10.5    N OF 5"); 
    38              
    39             writer.println("1205238     22      16      4       4       1123005726      26490   1357624         19      5       S       32.25   17TH 1"); 
    40             writer.println("1205208     22      17      4       4       1123005726      26490   1357624         19      5       S       31.6    GRAND 1"); 
    41             writer.println("1205270     5       19      1       1       1123005673      26492   1357648         20      5       S       33      MAIN 1   "); 
    42              
    43  
     29            writer.println("1205146     50      3       13      13      1123005873      24148   1357650         19      5       N       29.79   NEWPORT"); 
     30            writer.println("1201190     46      6       36      36      1123006209      26472   1357644         20      405     S       4.03    JEFFREY 2"); 
    4431            writer.close(); 
    4532        } catch (Exception e) { 
     
    7057        assertEquals(2, result.size()); 
    7158         
    72         // Test 55 N was loaded 
     59        // Test 5 N was loaded 
    7360        Highway fiftyfiveN = result.get(0); 
    74         assertEquals(new Integer(55), fiftyfiveN.routeNumber); 
     61        assertEquals(new Integer(5), fiftyfiveN.routeNumber); 
    7562         
    76         // Test 55 N stations are sorted by postmile 
    7763        ArrayList<Station> stations = fiftyfiveN.stations; 
    78         ArrayList<Double> stationsPostmiles = new ArrayList<>(); 
    79         for(Station station : stations) 
    80         { 
    81             stationsPostmiles.add(station.postmile); 
    82         } 
    83          
    84         // Create expected station postmile list (sorted) 
    85         ArrayList<Double> expectedStationsPostmiles = new ArrayList<>(); 
    86         expectedStationsPostmiles.add(new Double(4.58)); 
    87         expectedStationsPostmiles.add(new Double(4.7)); 
    88         expectedStationsPostmiles.add(new Double(5.06)); 
    89         expectedStationsPostmiles.add(new Double(5.51)); 
    90         expectedStationsPostmiles.add(new Double(9.41)); 
    91         expectedStationsPostmiles.add(new Double(10)); 
    92         expectedStationsPostmiles.add(new Double(10.4)); 
    93         expectedStationsPostmiles.add(new Double(10.5)); 
    94         for(int i = 0; i < 8; i++) 
    95         { 
    96             assertEquals(expectedStationsPostmiles.get(i),  
    97                     stationsPostmiles.get(i)); 
    98         } 
    99          
    100         // Test 55 S was loaded 
    101         Highway fiftyfiveS = result.get(1); 
    102         assertEquals(new Integer(5), fiftyfiveS.routeNumber); 
    103          
    104         // Test 55 S stations are sorted by postmile 
    105         stations = fiftyfiveS.stations; 
    106         stationsPostmiles.clear(); 
    107         for(Station station : stations) 
    108         { 
    109             stationsPostmiles.add(station.postmile); 
    110         } 
    111         expectedStationsPostmiles.clear(); 
    112         expectedStationsPostmiles.add(new Double(31.6)); 
    113         expectedStationsPostmiles.add(new Double(32.25)); 
    114         expectedStationsPostmiles.add(new Double(33)); 
    115         for(int i = 0; i < 3; i++) 
    116         { 
    117             assertEquals(expectedStationsPostmiles.get(i),  
    118                     stationsPostmiles.get(i)); 
    119         } 
     64        Station sad = stations.get(0); 
     65        System.out.println(""+sad.getStationMeta()); 
     66        assertEquals(22, sad.loops.size()); 
     67 
     68        // Test 405 S was loaded 
     69        Highway fourohfiveS = result.get(1); 
     70        assertEquals(new Integer(405), fourohfiveS.routeNumber); 
     71        stations = fourohfiveS.stations; 
     72        Station happy = stations.get(0); 
     73        System.out.println(""+happy.getStationMeta()); 
     74        assertEquals(9, happy.loops.size()); 
    12075    } 
    12176} 
Note: See TracChangeset for help on using the changeset viewer.