-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
40 lines (32 loc) · 1.1 KB
/
test.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
const assert = require('assert');
const notQuiteLisp = require('./not-quite-lisp');
const notQuiteLisp2 = require('./not-quite-lisp2');
describe('Day 1: Not Quite Lisp', () => {
it('should properly calculate (()) and ()()', () => {
assert.equal(0, notQuiteLisp('(())'));
assert.equal(0, notQuiteLisp('()()'));
});
it('should properly calculate ((( and (()(()(', () => {
assert.equal(3, notQuiteLisp('((('));
assert.equal(3, notQuiteLisp('(()(()('));
});
it('should properly calculate ))(((((', () => {
assert.equal(3, notQuiteLisp('))((((('));
});
it('should properly calculate ()) and ))(', () => {
assert.equal(-1, notQuiteLisp('())'));
assert.equal(-1, notQuiteLisp('))('));
});
it('should properly calculate ))) and )())())', () => {
assert.equal(-3, notQuiteLisp(')))'));
assert.equal(-3, notQuiteLisp(')())())'));
});
describe('Part Two', () => {
it('should properly calculate )', () => {
assert.equal(1, notQuiteLisp2(')'));
});
it('should properly calculate ()())', () => {
assert.equal(5, notQuiteLisp2('()())'));
});
});
});