forked from CorinnaKrebs/SolutionValidator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUsedVehiclesTest.cpp
More file actions
56 lines (46 loc) · 1.57 KB
/
UsedVehiclesTest.cpp
File metadata and controls
56 lines (46 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "pch.h"
#include "CppUnitTest.h"
#include "../Validator/ConstraintsRouting.h"
#include <string>
#include <vector>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace validator;
namespace RoutingConstraints {
TEST_CLASS(UsedVehiclesTest) {
public:
TEST_METHOD(ExceedingVMax) {
const unsigned int v_max = 1;
// Instance Creation
std::vector<Customer> customers{ };
std::vector<ItemType> itemtypes{ };
Instance instance("", Vehicle(0, 0, 0, 0, 0, 0, 0, 0, 0), itemtypes, customers, v_max, 1);
// Tour Creation
std::vector<unsigned int> customer_ids{ };
std::vector<unsigned int> item_ids{};
Tour tour1(1, customer_ids, item_ids);
Tour tour2(2, customer_ids, item_ids);
// Solution Creation
std::vector<Tour> tours{ tour1, tour2 };
Solution solution(tours);
// Test
Assert::AreEqual(true, ConstraintsRouting::checkUsedVehicles(solution, instance, false));
}
TEST_METHOD(FeasibleVMax) {
const unsigned int v_max = 2;
// Instance Creation
std::vector<Customer> customers{ };
std::vector<ItemType> itemtypes{ };
Instance instance("", Vehicle(0, 0, 0, 0, 0, 0, 0, 0, 0), itemtypes, customers, v_max, 1);
// Tour Creation
std::vector<unsigned int> customer_ids{ };
std::vector<unsigned int> item_ids{};
Tour tour1(1, customer_ids, item_ids);
Tour tour2(2, customer_ids, item_ids);
// Solution Creation
std::vector<Tour> tours{ tour1, tour2 };
Solution solution(tours);
// Test
Assert::AreEqual(true, ConstraintsRouting::checkUsedVehicles(solution, instance, false));
}
};
}