source: tmcsimulator/trunk/test/tmcsim/highwaymodel/HighwayTest.java @ 422

Revision 422, 1.5 KB checked in by jdalbey, 7 years ago (diff)

Remove ATMS functionality. Reworked and simplified the Highway model to use only VDS data from PeMS. Updated all unit tests.

Line 
1
2package tmcsim.highwaymodel;
3
4import tmcsim.highwaymodel.LoopDetector;
5import tmcsim.highwaymodel.Station;
6import tmcsim.highwaymodel.Highway;
7import tmcsim.highwaymodel.Station.DIRECTION;
8import java.util.ArrayList;
9import java.util.Set;
10import junit.framework.TestCase;
11
12/**
13 *
14 * @author jdalbey
15 */
16public class HighwayTest extends TestCase
17{
18    Station alpha;   
19    Station beta;
20    public HighwayTest(String testName)
21    {
22        super(testName);
23    }
24   
25    @Override
26    protected void setUp() throws Exception
27    {
28        super.setUp();
29        alpha = new Station(1,2,3,"A",new ArrayList<LoopDetector>(), 4, Station.DIRECTION.NORTH, 1.0);       
30        beta = new Station(1,2,3,"B",new ArrayList<LoopDetector>(), 4, Station.DIRECTION.SOUTH, 1.0);       
31    }
32   
33    @Override
34    protected void tearDown() throws Exception
35    {
36        super.tearDown();
37    }
38
39    public void testToString()
40    {
41        System.out.println("toString");
42        Highway instance = new Highway(5,null);
43        String expResult = "5";
44        String result = instance.toString();
45        assertEquals(expResult, result);
46    }
47    public void testDirections()
48    {
49        ArrayList<Station> stations = new ArrayList<Station>();
50        stations.add(alpha);
51        stations.add(beta);
52        Highway h1 = new Highway(5,stations);
53        Set<DIRECTION> dirs = h1.availDirs;
54        assertTrue(dirs.contains(DIRECTION.NORTH));
55        assertTrue(dirs.contains(DIRECTION.SOUTH));
56    }
57}
Note: See TracBrowser for help on using the repository browser.