Skip to content

Commit

Permalink
Fix checkSue2
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasbicus committed Oct 1, 2024
1 parent b9cd2ff commit 0f40a09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions scripts/aoc2015/day16/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("checkSue", function () {
false,
);
});
it("should return false when there is no match", function () {
it("should return true when there is match", function () {
assertEquals(
checkSue({
name: "Sue X",
Expand Down Expand Up @@ -84,19 +84,19 @@ describe("checkSue2", function () {
assertEquals(
checkSue2({
name: "Sue 8",
pomeranians: 7,
goldfish: 8,
cars: 10,
pomeranians: 3,
cats: 7,
trees: 3,
}, referenceSue),
false,
);
});
it("should return false when there is no match", function () {
it("should return true when there is match", function () {
assertEquals(
checkSue2({
name: "Sue X",
trees: 5,
cats: 8,
trees: 4,
cars: 2,
pomeranians: 2,
goldfish: 4,
Expand Down
4 changes: 2 additions & 2 deletions scripts/aoc2015/day16/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ export function checkSue2(sue: Partial<Sue>, referenceSue: Sue): boolean {
switch (name) {
case "pomeranians":
case "goldfish":
if (referenceSue[name] < value) {
if (referenceSue[name] <= value) {
return false;
}
break;
case "cats":
case "trees":
if (referenceSue[name] > value) {
if (referenceSue[name] >= value) {
return false;
}
break;
Expand Down

0 comments on commit 0f40a09

Please sign in to comment.