public void testAddRemoveConnections() { CConnectionList list = CConnectionList.getInstance(); list.initList(3); list.addConnection(TEST_CONNECTION_AB_EXPLICIT); list.addConnection(TEST_CONNECTION_BC_EXPLICIT); list.addConnection(TEST_CONNECTION_AC_EXPLICIT); Assert.IsTrue(list.length() == 3); Assert.AreSame(list.getConnection(0), TEST_CONNECTION_AB_EXPLICIT); Assert.AreSame(list.getConnection(1), TEST_CONNECTION_BC_EXPLICIT); Assert.AreSame(list.getConnection(2), TEST_CONNECTION_AC_EXPLICIT); /* * list.removeConnection(TEST_CONNECTION_BC_EXPLICIT); * Assert.IsTrue(list.length() == 2); * Assert.AreSame(list.getConnection(0), TEST_CONNECTION_AB_EXPLICIT); * Assert.AreSame(list.getConnection(1), TEST_CONNECTION_AC_EXPLICIT); * * // Löschen einer Verbindung die nicht verhanden ist * list.removeConnection(TEST_CONNECTION_NOT_IN_LIST); * Assert.IsTrue(list.length() == 2); */ list.removeAll(); Assert.IsTrue(list.length() == 0); }
public void testGetConnection() { CConnectionList list = CConnectionList.getInstance(); list.addConnection(TEST_CONNECTION_AB_EXPLICIT); list.addConnection(TEST_CONNECTION_BC_EXPLICIT); list.addConnection(TEST_CONNECTION_AC_EXPLICIT); Assert.AreSame(list.getConnection(0), TEST_CONNECTION_AB_EXPLICIT); Assert.AreSame(list.getConnection(1), TEST_CONNECTION_BC_EXPLICIT); Assert.AreSame(list.getConnection(2), TEST_CONNECTION_AC_EXPLICIT); List <CConnection> connectionsOfPoint = list.getConnectionOfPoint(TEST_POINT_A); Assert.IsTrue(connectionsOfPoint.Contains(TEST_CONNECTION_AB_EXPLICIT)); Assert.IsTrue(connectionsOfPoint.Contains(TEST_CONNECTION_AC_EXPLICIT)); Assert.IsFalse(connectionsOfPoint.Contains(TEST_CONNECTION_BC_EXPLICIT)); }
public void testTSPExplicitLowerDiagRowFormat() { string fileAdress = "../../../../ALL_tsp/LowerDiagRowTest.tsp"; Stream file = new FileStream(fileAdress, FileMode.Open); CTSPLibFileParser fileParser = new CTSPLibFileParser(file); fileParser.fillTSPPointList(); CConnectionList connList = CConnectionList.getInstance(); CTSPPoint point1, point2; CConnection connection12 = connList.getConnection(0); Assert.IsTrue(connection12.getDistance() == 1.0); connection12.getPoints(out point1, out point2); }