-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-cases.js
91 lines (91 loc) · 2.44 KB
/
test-cases.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
module.exports.testCases = {
// Each test case property name corresponds to a file in ./challenges folder
build_grid: [
[[1, 'x'], [['x']]],
[[2, 'x'], [['x', 'x'], ['x', 'x']]],
[[3, 'x'], [['x', 'x', 'x'], ['x', 'x', 'x'], ['x', 'x', 'x']]],
[[4, 'x'], [['x', 'x', 'x', 'x'], ['x', 'x', 'x', 'x'], ['x', 'x', 'x', 'x'], ['x', 'x', 'x', 'x']]],
],
char_count: [
[['aaa', 'a'], 3],
[['abc', 'c'], 1],
[['abb', 'b'], 2],
[['efg', 'z'], 0],
],
check_for_numbers: [
[[[]], false],
[[[1, 2, 3]], true],
[[['a', 'b', 'c']], false],
[[[{}, false, 'x', [], '1']], false],
[[[{}, false, 'x', [], 1]], true],
],
remove_chars: [
[['aaa', 'a'], ''],
[['abc', 'c'], 'ab'],
[['abb', 'b'], 'a'],
[['efg', 'z'], 'efg'],
],
shared_chars: [
[[[]], ''],
[[['abc']], 'abc'],
[[['aaa', 'aab', 'aac']], 'a'],
[[['abc', 'xyz']], ''],
[[['ab', 'bc', 'cd']], ''],
[[['acb', 'cba', 'bca']], 'abc'],
[[['dbecfa', 'xyzcba', 'gahbic']], 'abc'],
],
smallest_integer: [
[[[0]], 0],
[[[5, 4, 3, 2, 1, 0]], 0],
[[[10, 9, 8, 7, -5, -4, -3, -2, 1]], -5],
[[Array(100).fill(null).map((_, i) => 100 - i)], 1],
[[Array(100).fill(null).map((_, i) => i - 100)], -100]
],
valid_brackets: [
[[''], true],
[['[]'], true],
[['[[[]'], false],
[[']]]'], false],
[['[[][][[]]]'], true],
],
validate_dependency: [
[
[
[
['A', 'B'],
['A', 'C'],
['C', 'D'],
['B', 'C'],
['D', 'E'],
]
],
true
],
[
[
[
['A', 'B'],
['B', 'C'],
['D', 'E'],
['E', 'F'],
['G', 'H'],
['E', 'R'],
]
],
true
],
[
[
[
['A', 'B'],
['B', 'C'],
['C', 'E'],
['G', 'H'],
['E', 'R'],
['E', 'A'], // A is already listed above
]
],
false
],
],
}