public void Test_cal_service_util_must_reply_index() { Train_obj train = new Train_obj(200); TF_Demand demand = new TF_Demand(1440, 5, "test"); int[,] outbound_demand = new int[5, 5]; List <Service> outbound_services = new List <Service>(); int[] service = { 1, 0, 1, 1, 1 }; int[] service2 = { 0, 0, 1, 0, 1 }; int[] service3 = { 1, 1, 1, 1, 1 }; int[] service4 = { 0, 1, 1, 1, 1 }; List <int[]> test1 = new List <int[]>(); test1.Add(service); test1.Add(service2); Service aService; aService = new Service("aaa", service); outbound_services.Add(aService); aService = new Service("3_station_outbound", service2); outbound_services.Add(aService); aService = new Service("2_station_outbound", service3); outbound_services.Add(aService); aService = new Service("4_station_outbound_start_at_1", service4); outbound_services.Add(aService); //outbound_demand = demand.getOutbound_demand(0); int actual = Service_algo.cal_all_service_util(outbound_demand, train, outbound_services); int expected = 0; Assert.AreEqual(expected, actual); }
public void Test_getOn_TrainClass() { Train_obj train = new Train_obj(100); train.getOn(50, 1); int actual = train.remain_cap; int expected = 50; Assert.AreEqual(expected, actual); }
public void Test_maxUtilze() { Train_obj train = new Train_obj(100); int[] service = { 1, 1, 1, 1, 0 }; Service services = new Service("test", service); float actual = Service_algo.max_utilize_of_service(train.cap, services); float expected = 8500; Assert.Equal(expected, actual); }
//[TestMethod] public void Train_service_all_station() { TF_Demand tfd = new TF_Demand(1440, 5, "TEST"); int[,] demand = { { 0, 10, 10, 10, 10 }, { 10, 0, 10, 10, 10 }, { 10, 10, 0, 10, 10 }, { 10, 10, 10, 0, 10 }, { 10, 10, 10, 10, 0 } }; tfd.demand[0] = demand; Train_obj train = new Train_obj(40); int[] service_all_station = { 1, 1, 1, 1, 1 }; List <Service> forward = new List <Service>(); Service testService = new Service("All_station_outbound", service_all_station); forward.Add(testService); int[,] expected = { { 0, 0, 0, 0, 0 }, { 10, 0, 6, 7, 7 }, { 10, 10, 0, 3, 3 }, { 10, 10, 10, 0, 0 }, { 10, 10, 10, 10, 0 } }; Service_algo.test_orchestrator_of_service(tfd, train, forward); for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { Assert.AreEqual(expected[i, j], tfd.demand[0][i, j]); } } }
public void Train_service_4_station_no_overcap() { TF_Demand tfd = new TF_Demand(1440, 5, "TEST"); int[,] demand = { { 0, 10, 10, 10, 10 }, { 10, 0, 10, 10, 10 }, { 10, 10, 0, 10, 10 }, { 10, 10, 10, 0, 10 }, { 10, 10, 10, 10, 0 } }; tfd.demand[0] = demand; Train_obj train = new Train_obj(40); int[] service_4_station = { 1, 1, 1, 0, 1 }; List <Service> forward = new List <Service>(); Service testService = new Service("All_station_outbound", service_4_station); forward.Add(testService); int[,] expected = { { 0, 0, 0, 10, 0 }, { 10, 0, 0, 10, 0 }, { 10, 10, 0, 10, 0 }, { 10, 10, 10, 0, 10 }, { 10, 10, 10, 10, 0 } }; Service_algo.Train_a_b_c_d_e(tfd, train, forward[0], 0); for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { Assert.Equal(expected[i, j], tfd.demand[0][i, j]); } } }