Skip to content

Instantly share code, notes, and snippets.

@cameronmoreau
Created December 11, 2020 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cameronmoreau/25366276e04d189e9d35ff0bdda4c016 to your computer and use it in GitHub Desktop.
Save cameronmoreau/25366276e04d189e9d35ff0bdda4c016 to your computer and use it in GitHub Desktop.
it("checks for schedule conflicts", () => {
const crewInfo = {
crews: [
{
id: 2,
vehicle: "pickup_truck",
schedule: [
{
start_hour: 8,
end_hour: 13,
},
],
},
],
};
const orders = [
[[6, 7], 2],
[[8, 13], -1],
[[9, 11], -1],
[[10, 15], -1],
[[14, 15], 2],
];
orders.forEach(([time, e]) => {
assert.equal(
getOptimalCrew(crewInfo, {
vehicle: "pickup_truck",
start_hour: time[0],
end_hour: time[1],
}),
e,
`failed on ${time} ${e}`
);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment