-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday1.js
40 lines (38 loc) · 892 Bytes
/
day1.js
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
function whatFloor () {
}
describe('Day1', () => {
describe('whatFloor', () => {
const floorCases = {
'(())': 0,
'(((': 3,
'(()(()(': 3,
'))(((((': 3,
'())': -1,
'))(': -1,
')))': -3,
')())())': -3,
}
Object.keys(floorCases).map(input => {
const expected = floorCases[input]
describe(`given ${input}`, () => {
it(`returns ${expected}`, () => {
expect(whatFloor(input)).to.equal(expected)
})
})
})
})
describe('basementPosition', () => {
const basementCases = {
')': 1,
'()())': 5,
}
Object.keys(basementCases).forEach(input => {
const expected = basementCases[input]
describe(`given ${input}`, () => {
it(`returns ${expected}`, () => {
expect(basementPosition(input)).to.equal(expected)
})
})
})
})
})