Skip to content

Commit

Permalink
test instead of it
Browse files Browse the repository at this point in the history
  • Loading branch information
shahata committed Jan 26, 2024
1 parent ab10045 commit 4483040
Show file tree
Hide file tree
Showing 226 changed files with 836 additions and 836 deletions.
8 changes: 4 additions & 4 deletions src/2015/day01.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ const input = readInput(import.meta.url);

describe('day01 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(part1('()()')).toEqual(0);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(74);
});
});

describe('part2', () => {
it('should work for part 2 examples', () => {
test('it should work for part 2 examples', () => {
expect(part2('()())()')).toEqual(5);
});

it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(1795);
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/2015/day02.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ const input = readInput(import.meta.url);

describe('day02 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(part1('2x3x4\n1x1x10')).toEqual(101);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(1588178);
});
});

describe('part2', () => {
it('should work for part 2 examples', () => {
test('it should work for part 2 examples', () => {
expect(part2('2x3x4\n1x1x10')).toEqual(48);
});

it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(3783758);
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/2015/day03.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ const input = readInput(import.meta.url);

describe('day03 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(part1('>')).toEqual(2);
expect(part1('^>v<')).toEqual(4);
expect(part1('^v^v^v^v^v')).toEqual(2);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(2592);
});
});

describe('part2', () => {
it('should work for part 2 examples', () => {
test('it should work for part 2 examples', () => {
expect(part2('^v')).toEqual(3);
expect(part2('^>v<')).toEqual(3);
expect(part2('^v^v^v^v^v')).toEqual(11);
});

it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(2360);
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/2015/day04.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ const input = readInput(import.meta.url);

describe('day04 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(part1('abcdef')).toEqual(609043);
expect(part1('pqrstuv')).toEqual(1048970);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(282749);
});
});

describe('part2', () => {
it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(9962624);
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/2015/day05.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ const input = readInput(import.meta.url);

describe('day05 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(part1('ugknbfddgicrmopn')).toEqual(1);
expect(part1('aaa')).toEqual(1);
expect(part1('jchzalrnumimnmhp')).toEqual(0);
expect(part1('haegwjzuvuyypxyu')).toEqual(0);
expect(part1('dvszwmarrgswjxmb')).toEqual(0);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(236);
});
});

describe('part2', () => {
it('should work for part 2 examples', () => {
test('it should work for part 2 examples', () => {
expect(part2('qjhvhtzxzqqjkmpb')).toEqual(1);
expect(part2('xxyxx')).toEqual(1);
expect(part2('uurcxstgmygtbstg')).toEqual(0);
expect(part2('ieodomkazucvgmuy')).toEqual(0);
});

it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(51);
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/2015/day06.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const input = readInput(import.meta.url);

describe('day06 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(
part1(
[
Expand All @@ -17,18 +17,18 @@ describe('day06 2015', () => {
).toEqual(1e6 - 1e3 - 4);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(400410);
});
});

describe('part2', () => {
it('should work for part 2 examples', () => {
test('it should work for part 2 examples', () => {
expect(part2('turn on 0,0 through 0,0')).toEqual(1);
expect(part2('toggle 0,0 through 999,999')).toEqual(2e6);
});

it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(15343601);
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/2015/day07.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const input = readInput(import.meta.url);

describe('day07 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(part1('123 -> x\n456 -> y\nx AND y -> a')).toEqual(72);
expect(part1(`123 -> x\n456 -> y\nx OR y -> a`)).toEqual(507);
expect(part1(`123 -> x\n456 -> y\nx LSHIFT 2 -> a`)).toEqual(492);
Expand All @@ -14,13 +14,13 @@ describe('day07 2015', () => {
expect(part1(`123 -> x\n456 -> y\nNOT y -> a`)).toEqual(65079);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(16076);
});
});

describe('part2', () => {
it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(2797);
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/2015/day08.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ const input = readInput(import.meta.url);

describe('day08 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(part1('""')).toEqual(2 - 0);
expect(part1('"abc"')).toEqual(5 - 3);
expect(part1('"aaa\\"aaa"')).toEqual(10 - 7);
expect(part1('"\\x27"')).toEqual(6 - 1);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(1350);
});
});

describe('part2', () => {
it('should work for part 2 examples', () => {
test('it should work for part 2 examples', () => {
expect(part2('""')).toEqual(6 - 2);
expect(part2('"abc"')).toEqual(9 - 5);
expect(part2('"aaa\\"aaa"')).toEqual(16 - 10);
expect(part2('"\\x27"')).toEqual(11 - 6);
});

it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(2085);
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/2015/day09.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const input = readInput(import.meta.url);

describe('day09 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(
part1(
[
Expand All @@ -17,13 +17,13 @@ describe('day09 2015', () => {
).toEqual(605);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(251);
});
});

describe('part2', () => {
it('should work for part 2 examples', () => {
test('it should work for part 2 examples', () => {
expect(
part2(
[
Expand All @@ -35,7 +35,7 @@ describe('day09 2015', () => {
).toEqual(982);
});

it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(898);
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/2015/day10.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ const input = readInput(import.meta.url);

describe('day10 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(part1('1', 1)).toEqual(2);
expect(part1('11', 1)).toEqual(2);
expect(part1('21', 1)).toEqual(4);
expect(part1('1211', 1)).toEqual(6);
expect(part1('111221', 1)).toEqual(6);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(252594);
});
});

describe('part2', () => {
it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(3579328);
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/2015/day11.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ const input = readInput(import.meta.url);

describe('day11 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(part1('abcdefgh')).toEqual('abcdffaa');
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual('vzbxxyzz');
});
});

describe('part2', () => {
it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual('vzcaabcc');
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/2015/day12.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const input = readInput(import.meta.url);

describe('day12 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(part1('[1,2,3]')).toEqual(6);
expect(part1('{"a":2,"b":4}')).toEqual(6);
expect(part1('[[[3]]]')).toEqual(3);
Expand All @@ -16,20 +16,20 @@ describe('day12 2015', () => {
expect(part1('{}')).toEqual(0);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(119433);
});
});

describe('part2', () => {
it('should work for part 2 examples', () => {
test('it should work for part 2 examples', () => {
expect(part2('[1,2,3]')).toEqual(6);
expect(part2('[1,{"c":"red","b":2},3]')).toEqual(4);
expect(part2('{"d":"red","e":[1,2,3,4],"f":5}')).toEqual(0);
expect(part2('[1,"red",5]')).toEqual(6);
});

it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(68466);
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/2015/day13.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const input = readInput(import.meta.url);

describe('day13 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(
part1(
[
Expand All @@ -26,13 +26,13 @@ describe('day13 2015', () => {
).toEqual(330);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(733);
});
});

describe('part2', () => {
it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(725);
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/2015/day14.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const input = readInput(import.meta.url);

describe('day14 2015', () => {
describe('part1', () => {
it('should work for part 1 examples', () => {
test('it should work for part 1 examples', () => {
expect(
part1(
`Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds.
Expand All @@ -15,13 +15,13 @@ Dancer can fly 16 km/s for 11 seconds, but then must rest for 162 seconds.`,
).toEqual(1120);
});

it('should work for part 1 input', () => {
test('it should work for part 1 input', () => {
expect(part1(input)).toEqual(2640);
});
});

describe('part2', () => {
it('should work for part 2 examples', () => {
test('it should work for part 2 examples', () => {
expect(
part2(
`Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds.
Expand All @@ -31,7 +31,7 @@ Dancer can fly 16 km/s for 11 seconds, but then must rest for 162 seconds.`,
).toEqual(689);
});

it('should work for part 2 input', () => {
test('it should work for part 2 input', () => {
expect(part2(input)).toEqual(1102);
});
});
Expand Down
Loading

0 comments on commit 4483040

Please sign in to comment.