Refactor, units, tests
This commit is contained in:
parent
519c34bc60
commit
cd90705ba1
24 changed files with 1221 additions and 1222 deletions
|
@ -1,23 +0,0 @@
|
|||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const yaml = require('js-yaml')
|
||||
const points_lib = require('../src/points')
|
||||
|
||||
const fixtures = path.join(__dirname, 'fixtures')
|
||||
const absolem_config = yaml.load(fs.readFileSync(path.join(fixtures, 'absolem.yaml')).toString())
|
||||
|
||||
describe('Absolem', function() {
|
||||
it('#points', function() {
|
||||
const expected = fs.readJSONSync(path.join(fixtures, 'absolem_points.json'))
|
||||
const actual = points_lib.parse(absolem_config.points)
|
||||
// remove metadata, so that it only checks the points
|
||||
Object.values(actual).map(val => delete val.meta)
|
||||
// only check points in the "main" zones
|
||||
for (const key of Object.keys(actual)) {
|
||||
if (!expected[key]) {
|
||||
delete actual[key]
|
||||
}
|
||||
}
|
||||
actual.should.deep.equal(expected)
|
||||
})
|
||||
})
|
28
test/complex/index.js
Normal file
28
test/complex/index.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const yaml = require('js-yaml')
|
||||
const glob = require('glob')
|
||||
const u = require('../../src/utils')
|
||||
const ergogen = require('../../src/ergogen')
|
||||
|
||||
const cap = s => s.charAt(0).toUpperCase() + s.slice(1)
|
||||
|
||||
for (const part of ['points', 'outlines', 'cases', 'pcbs']) {
|
||||
describe(cap(part), function() {
|
||||
const dir = path.join(__dirname, part)
|
||||
for (const input_path of glob.sync(path.join(dir, '*.yaml'))) {
|
||||
const basename = path.basename(input_path, '.yaml')
|
||||
const title = basename.split('_').join(' ')
|
||||
it(title, function() {
|
||||
const dirname = path.dirname(input_path)
|
||||
const input = yaml.load(fs.readFileSync(input_path).toString())
|
||||
const actual = ergogen.process(input, true)
|
||||
for (const expected_path of glob.sync(path.join(dirname, basename + '___*'))) {
|
||||
const expected = JSON.parse(fs.readFileSync(expected_path).toString())
|
||||
const comp_path = expected_path.split('___')[1].split('.')[0].split('_').join('.')
|
||||
u.deep(actual, comp_path).should.deep.equal(expected)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
24
test/complex/outlines/001_basic_outline.yaml
Normal file
24
test/complex/outlines/001_basic_outline.yaml
Normal file
|
@ -0,0 +1,24 @@
|
|||
points:
|
||||
zones:
|
||||
matrix:
|
||||
columns:
|
||||
left.key.bind: [,10,,]
|
||||
right.key.bind: [,,,10]
|
||||
rows:
|
||||
bottom.key.bind: [10,,,]
|
||||
top.key.bind: [,,10,]
|
||||
key:
|
||||
bind: [0, 0, 0, 0]
|
||||
outlines:
|
||||
exports:
|
||||
outline:
|
||||
main:
|
||||
type: keys
|
||||
side: left
|
||||
size: 20
|
||||
min:
|
||||
type: keys
|
||||
side: left
|
||||
bound: false
|
||||
size: 14
|
||||
operation: subtract
|
506
test/complex/outlines/001_basic_outline___outlines.json
Normal file
506
test/complex/outlines/001_basic_outline___outlines.json
Normal file
|
@ -0,0 +1,506 @@
|
|||
{
|
||||
"outline": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {
|
||||
"a": {
|
||||
"paths": {
|
||||
"ShapeLine1": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
-10,
|
||||
-10
|
||||
],
|
||||
"end": [
|
||||
29,
|
||||
-10
|
||||
]
|
||||
},
|
||||
"ShapeLine4": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
-10,
|
||||
-10
|
||||
],
|
||||
"end": [
|
||||
-10,
|
||||
29
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"paths": {},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"paths": {},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {
|
||||
"a": {
|
||||
"paths": {
|
||||
"ShapeLine3": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
-10,
|
||||
29
|
||||
],
|
||||
"end": [
|
||||
29,
|
||||
29
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"paths": {},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"paths": {},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {
|
||||
"a": {
|
||||
"paths": {
|
||||
"ShapeLine2": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
29,
|
||||
-10
|
||||
],
|
||||
"end": [
|
||||
29,
|
||||
29
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"paths": {},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"paths": {},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {
|
||||
"a": {
|
||||
"paths": {},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"paths": {},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"paths": {},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {
|
||||
"a": {
|
||||
"models": {},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"paths": {
|
||||
"ShapeLine1": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
-7,
|
||||
-7
|
||||
],
|
||||
"end": [
|
||||
7,
|
||||
-7
|
||||
]
|
||||
},
|
||||
"ShapeLine2": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
7,
|
||||
-7
|
||||
],
|
||||
"end": [
|
||||
7,
|
||||
7
|
||||
]
|
||||
},
|
||||
"ShapeLine3": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
7,
|
||||
7
|
||||
],
|
||||
"end": [
|
||||
-7,
|
||||
7
|
||||
]
|
||||
},
|
||||
"ShapeLine4": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
-7,
|
||||
7
|
||||
],
|
||||
"end": [
|
||||
-7,
|
||||
-7
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"paths": {
|
||||
"ShapeLine1": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
-7,
|
||||
12
|
||||
],
|
||||
"end": [
|
||||
7,
|
||||
12
|
||||
]
|
||||
},
|
||||
"ShapeLine2": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
7,
|
||||
12
|
||||
],
|
||||
"end": [
|
||||
7,
|
||||
26
|
||||
]
|
||||
},
|
||||
"ShapeLine3": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
7,
|
||||
26
|
||||
],
|
||||
"end": [
|
||||
-7,
|
||||
26
|
||||
]
|
||||
},
|
||||
"ShapeLine4": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
-7,
|
||||
26
|
||||
],
|
||||
"end": [
|
||||
-7,
|
||||
12
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"paths": {
|
||||
"ShapeLine1": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
12,
|
||||
-7
|
||||
],
|
||||
"end": [
|
||||
26,
|
||||
-7
|
||||
]
|
||||
},
|
||||
"ShapeLine2": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
26,
|
||||
-7
|
||||
],
|
||||
"end": [
|
||||
26,
|
||||
7
|
||||
]
|
||||
},
|
||||
"ShapeLine3": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
26,
|
||||
7
|
||||
],
|
||||
"end": [
|
||||
12,
|
||||
7
|
||||
]
|
||||
},
|
||||
"ShapeLine4": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
12,
|
||||
7
|
||||
],
|
||||
"end": [
|
||||
12,
|
||||
-7
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
"b": {
|
||||
"paths": {
|
||||
"ShapeLine1": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
12,
|
||||
12
|
||||
],
|
||||
"end": [
|
||||
26,
|
||||
12
|
||||
]
|
||||
},
|
||||
"ShapeLine2": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
26,
|
||||
12
|
||||
],
|
||||
"end": [
|
||||
26,
|
||||
26
|
||||
]
|
||||
},
|
||||
"ShapeLine3": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
26,
|
||||
26
|
||||
],
|
||||
"end": [
|
||||
12,
|
||||
26
|
||||
]
|
||||
},
|
||||
"ShapeLine4": {
|
||||
"type": "line",
|
||||
"origin": [
|
||||
12,
|
||||
26
|
||||
],
|
||||
"end": [
|
||||
12,
|
||||
12
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
}
|
44
test/complex/outlines/002_gluing.yaml
Normal file
44
test/complex/outlines/002_gluing.yaml
Normal file
|
@ -0,0 +1,44 @@
|
|||
points:
|
||||
zones:
|
||||
matrix:
|
||||
columns:
|
||||
left.key.bind: [,10,,]
|
||||
right.key.bind: [,,,10]
|
||||
rows:
|
||||
bottom.key.bind: [10,,,]
|
||||
top.key.bind: [,,10,]
|
||||
key:
|
||||
bind: [0, 0, 0, 0]
|
||||
rotate: -20
|
||||
mirror:
|
||||
ref: matrix_right_top
|
||||
distance: 30
|
||||
outlines:
|
||||
glue:
|
||||
default:
|
||||
top:
|
||||
left:
|
||||
ref: matrix_right_top
|
||||
shift: [,sy / 2]
|
||||
right:
|
||||
ref: mirror_matrix_right_top
|
||||
shift: [,sy / 2]
|
||||
bottom:
|
||||
left:
|
||||
ref: matrix_right_bottom
|
||||
shift: [,sy / -2]
|
||||
right:
|
||||
ref: mirror_matrix_right_bottom
|
||||
shift: [,sy / -2]
|
||||
exports:
|
||||
outline:
|
||||
main:
|
||||
type: keys
|
||||
side: both
|
||||
size: 20
|
||||
min:
|
||||
type: keys
|
||||
side: both
|
||||
bound: false
|
||||
size: 14
|
||||
operation: subtract
|
9
test/complex/points/001_basic_2x2.yaml
Normal file
9
test/complex/points/001_basic_2x2.yaml
Normal file
|
@ -0,0 +1,9 @@
|
|||
points:
|
||||
zones:
|
||||
matrix:
|
||||
columns:
|
||||
left:
|
||||
right:
|
||||
rows:
|
||||
bottom:
|
||||
top:
|
130
test/complex/points/001_basic_2x2___points_data.json
Normal file
130
test/complex/points/001_basic_2x2___points_data.json
Normal file
|
@ -0,0 +1,130 @@
|
|||
{
|
||||
"matrix_left_bottom": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"r": 0,
|
||||
"meta": {
|
||||
"shift": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotate": 0,
|
||||
"padding": 19,
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"skip": false,
|
||||
"asym": "both",
|
||||
"name": "matrix_left_bottom",
|
||||
"colrow": "left_bottom",
|
||||
"col": {
|
||||
"stagger": 0,
|
||||
"spread": 0,
|
||||
"rotate": 0,
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rows": {},
|
||||
"key": {},
|
||||
"name": "left"
|
||||
},
|
||||
"row": "bottom"
|
||||
}
|
||||
},
|
||||
"matrix_left_top": {
|
||||
"x": 0,
|
||||
"y": 19,
|
||||
"r": 0,
|
||||
"meta": {
|
||||
"shift": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotate": 0,
|
||||
"padding": 19,
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"skip": false,
|
||||
"asym": "both",
|
||||
"name": "matrix_left_top",
|
||||
"colrow": "left_top",
|
||||
"col": {
|
||||
"stagger": 0,
|
||||
"spread": 0,
|
||||
"rotate": 0,
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rows": {},
|
||||
"key": {},
|
||||
"name": "left"
|
||||
},
|
||||
"row": "top"
|
||||
}
|
||||
},
|
||||
"matrix_right_bottom": {
|
||||
"x": 19,
|
||||
"y": 0,
|
||||
"r": 0,
|
||||
"meta": {
|
||||
"shift": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotate": 0,
|
||||
"padding": 19,
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"skip": false,
|
||||
"asym": "both",
|
||||
"name": "matrix_right_bottom",
|
||||
"colrow": "right_bottom",
|
||||
"col": {
|
||||
"stagger": 0,
|
||||
"spread": 19,
|
||||
"rotate": 0,
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rows": {},
|
||||
"key": {},
|
||||
"name": "right"
|
||||
},
|
||||
"row": "bottom"
|
||||
}
|
||||
},
|
||||
"matrix_right_top": {
|
||||
"x": 19,
|
||||
"y": 19,
|
||||
"r": 0,
|
||||
"meta": {
|
||||
"shift": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotate": 0,
|
||||
"padding": 19,
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"skip": false,
|
||||
"asym": "both",
|
||||
"name": "matrix_right_top",
|
||||
"colrow": "right_top",
|
||||
"col": {
|
||||
"stagger": 0,
|
||||
"spread": 19,
|
||||
"rotate": 0,
|
||||
"origin": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rows": {},
|
||||
"key": {},
|
||||
"name": "right"
|
||||
},
|
||||
"row": "top"
|
||||
}
|
||||
}
|
||||
}
|
13
test/complex/points/002_adjustments.yaml
Normal file
13
test/complex/points/002_adjustments.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
points:
|
||||
zones:
|
||||
matrix:
|
||||
columns:
|
||||
left:
|
||||
right:
|
||||
stagger: 5
|
||||
spread: 25
|
||||
rotate: 5
|
||||
origin: [-9, -9]
|
||||
rows:
|
||||
bottom:
|
||||
top:
|
707
test/fixtures/absolem.yaml
vendored
707
test/fixtures/absolem.yaml
vendored
|
@ -1,707 +0,0 @@
|
|||
points:
|
||||
zones:
|
||||
matrix:
|
||||
anchor:
|
||||
rotate: 5
|
||||
columns:
|
||||
pinky:
|
||||
rotate: -5
|
||||
origin: [7, -7]
|
||||
rows:
|
||||
bottom:
|
||||
home:
|
||||
bind: [,15,-1]
|
||||
top:
|
||||
bind: [,15,-1]
|
||||
key:
|
||||
column_net: P1
|
||||
column_mark: P
|
||||
ring:
|
||||
stagger: 12
|
||||
rows:
|
||||
bottom:
|
||||
bind: [,,,10]
|
||||
home:
|
||||
bind: [,10]
|
||||
top:
|
||||
bind: [,10]
|
||||
key:
|
||||
column_net: P0
|
||||
column_mark: R
|
||||
middle:
|
||||
stagger: 5
|
||||
rows:
|
||||
bottom:
|
||||
bind: [,10,,10]
|
||||
home:
|
||||
bind: [,10,,10]
|
||||
top:
|
||||
key:
|
||||
column_net: P2
|
||||
column_mark: M
|
||||
index:
|
||||
stagger: -6
|
||||
rows:
|
||||
bottom:
|
||||
bind: [,10]
|
||||
home:
|
||||
bind: [,,,10]
|
||||
top:
|
||||
bind: [,,,10]
|
||||
key:
|
||||
column_net: P3
|
||||
column_mark: X
|
||||
inner:
|
||||
stagger: -2
|
||||
rows:
|
||||
bottom:
|
||||
bind: [,,10,]
|
||||
home:
|
||||
bind: [,,,10]
|
||||
top:
|
||||
bind: [,,,10]
|
||||
key:
|
||||
column_net: P4
|
||||
column_mark: I
|
||||
rows:
|
||||
bottom:
|
||||
bind: [10]
|
||||
row_net: P16
|
||||
row_mark: LB
|
||||
mirror:
|
||||
row_net: P7
|
||||
row_mark: RB
|
||||
home:
|
||||
bind: [10]
|
||||
row_net: P14
|
||||
row_mark: LH
|
||||
mirror:
|
||||
row_net: P6
|
||||
row_mark: RH
|
||||
top:
|
||||
row_net: P15
|
||||
row_mark: LT
|
||||
mirror:
|
||||
row_net: P5
|
||||
row_mark: RT
|
||||
s19:
|
||||
extends: matrix
|
||||
columns:
|
||||
pinky:
|
||||
rows:
|
||||
bottom:
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
shift: [,12]
|
||||
home:
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
shift: [,6]
|
||||
top:
|
||||
footprints:
|
||||
row_ext:
|
||||
anchor:
|
||||
shift: [, -10]
|
||||
extra_column:
|
||||
type: pad
|
||||
anchor:
|
||||
shift: [-4, 4]
|
||||
nets:
|
||||
net: 'P19'
|
||||
params:
|
||||
width: 2
|
||||
height: 2
|
||||
front: false
|
||||
text: 'E'
|
||||
align: right
|
||||
key:
|
||||
footprints:
|
||||
row_ext:
|
||||
type: pad
|
||||
anchor:
|
||||
shift: [-4, -4]
|
||||
nets:
|
||||
net: '!row_net'
|
||||
params:
|
||||
width: 2
|
||||
height: 2
|
||||
front: false
|
||||
text: '!row_mark'
|
||||
align: right
|
||||
ring:
|
||||
rows:
|
||||
bottom:
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
shift: [,5]
|
||||
home:
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
shift: [,2.5]
|
||||
middle:
|
||||
rows:
|
||||
top:
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
shift: [,-6]
|
||||
home:
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
shift: [,-3]
|
||||
index:
|
||||
rows:
|
||||
bottom:
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
shift: [-8.25,6]
|
||||
home:
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
shift: [-8.25,3]
|
||||
top:
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
shift: [-8.25,]
|
||||
rows:
|
||||
top:
|
||||
footprints:
|
||||
mx:
|
||||
anchor:
|
||||
rotate: 180
|
||||
alps:
|
||||
anchor:
|
||||
rotate: 180
|
||||
choc:
|
||||
anchor:
|
||||
rotate: 180
|
||||
col_ext:
|
||||
type: pad
|
||||
anchor:
|
||||
shift: [4, 4]
|
||||
nets:
|
||||
net: '!column_net'
|
||||
params:
|
||||
width: 2
|
||||
height: 2
|
||||
front: false
|
||||
text: '!column_mark'
|
||||
bottom:
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
rotate: 270
|
||||
col_ext:
|
||||
type: pad
|
||||
anchor:
|
||||
shift: [4, -4]
|
||||
nets:
|
||||
net: '!column_net'
|
||||
params:
|
||||
width: 2
|
||||
height: 2
|
||||
front: false
|
||||
text: '!column_mark'
|
||||
key:
|
||||
tags:
|
||||
s19: true
|
||||
footprints: &quad
|
||||
mx:
|
||||
type: mx
|
||||
nets:
|
||||
from: '!colrow'
|
||||
to: '!column_net'
|
||||
alps:
|
||||
type: alps
|
||||
nets:
|
||||
from: '!colrow'
|
||||
to: '!column_net'
|
||||
<<: &choc
|
||||
choc:
|
||||
type: choc
|
||||
nets:
|
||||
from: '!colrow'
|
||||
to: '!column_net'
|
||||
diode:
|
||||
type: diode
|
||||
anchor:
|
||||
rotate: 90
|
||||
shift: [8.25, 0]
|
||||
nets:
|
||||
from: '!colrow'
|
||||
to: '!row_net'
|
||||
mirror:
|
||||
footprints: &quad_mirror
|
||||
mx:
|
||||
nets:
|
||||
from: '!column_net'
|
||||
to: '!colrow'
|
||||
alps:
|
||||
nets:
|
||||
from: '!column_net'
|
||||
to: '!colrow'
|
||||
<<: &choc_mirror
|
||||
choc:
|
||||
nets:
|
||||
from: '!column_net'
|
||||
to: '!colrow'
|
||||
s18:
|
||||
extends: matrix
|
||||
columns:
|
||||
pinky:
|
||||
stagger: 1
|
||||
origin: [7, -8]
|
||||
rows:
|
||||
top:
|
||||
footprints:
|
||||
choc:
|
||||
anchor:
|
||||
rotate: 180
|
||||
key:
|
||||
padding: 18
|
||||
tags:
|
||||
s18: true
|
||||
footprints: *choc
|
||||
mirror:
|
||||
footprints: *choc_mirror
|
||||
thumbfan:
|
||||
anchor:
|
||||
ref: matrix_inner_bottom
|
||||
shift: [-7, -19]
|
||||
columns:
|
||||
near:
|
||||
spread: 21.25
|
||||
rotate: -28
|
||||
origin: [9.5, -9]
|
||||
rows:
|
||||
thumb:
|
||||
bind: [10,5,,]
|
||||
column_net: P2
|
||||
tags:
|
||||
classic: true
|
||||
footprints:
|
||||
choc:
|
||||
anchor:
|
||||
rotate: 180
|
||||
diode:
|
||||
anchor:
|
||||
shift: [8,]
|
||||
row_ext:
|
||||
type: pad
|
||||
anchor:
|
||||
shift: [-3, 9]
|
||||
nets:
|
||||
net: '!row_net'
|
||||
params:
|
||||
width: 2
|
||||
height: 2
|
||||
front: false
|
||||
text: '!row_mark'
|
||||
align: right
|
||||
home:
|
||||
spread: 21.25
|
||||
rotate: -28
|
||||
origin: [11.75, -9]
|
||||
rows:
|
||||
thumb:
|
||||
bind: [,10,,15]
|
||||
column_net: P3
|
||||
tags:
|
||||
classic: true
|
||||
uniform: true
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
shift: [8,]
|
||||
far:
|
||||
rows:
|
||||
thumb:
|
||||
bind: [-1,,,5]
|
||||
column_net: P4
|
||||
tags:
|
||||
classic: true
|
||||
footprints:
|
||||
choc:
|
||||
anchor:
|
||||
rotate: 180
|
||||
diode:
|
||||
anchor:
|
||||
shift: [-4,]
|
||||
rotate: 0
|
||||
mirror:
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
rotate: 180
|
||||
rows:
|
||||
thumb:
|
||||
row_net: P10
|
||||
row_mark: LF
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
shift: [0, 9]
|
||||
rotate: 180
|
||||
mirror:
|
||||
row_net: P8
|
||||
row_mark: RF
|
||||
footprints:
|
||||
diode:
|
||||
anchor:
|
||||
rotate: 0
|
||||
key:
|
||||
footprints: *quad
|
||||
mirror: *quad_mirror
|
||||
unifar:
|
||||
anchor:
|
||||
ref: thumbfan_home_thumb
|
||||
columns:
|
||||
home_again:
|
||||
rotate: -28
|
||||
origin: [9.5, -9]
|
||||
key:
|
||||
skip: true
|
||||
far:
|
||||
rows:
|
||||
thumb:
|
||||
bind: [-1,,,5]
|
||||
key:
|
||||
column_net: P4
|
||||
footprints:
|
||||
choc:
|
||||
anchor:
|
||||
rotate: 180
|
||||
diode: '!!unset'
|
||||
mirror:
|
||||
footprints:
|
||||
diode: '!!unset'
|
||||
tags:
|
||||
uniform: true
|
||||
rows:
|
||||
thumb:
|
||||
row_net: P10
|
||||
mirror:
|
||||
row_net: P8
|
||||
key:
|
||||
footprints: *quad
|
||||
mirror: *quad_mirror
|
||||
uninear:
|
||||
anchor:
|
||||
ref: thumbfan_home_thumb
|
||||
columns:
|
||||
home_again:
|
||||
spread: -19
|
||||
rotate: 28
|
||||
origin: [-9.5, -9]
|
||||
key:
|
||||
skip: true
|
||||
near:
|
||||
rows:
|
||||
thumb:
|
||||
bind: [10,5,,]
|
||||
key:
|
||||
column_net: P2
|
||||
footprints:
|
||||
choc:
|
||||
anchor:
|
||||
rotate: 180
|
||||
diode: '!!unset'
|
||||
mirror:
|
||||
footprints:
|
||||
diode: '!!unset'
|
||||
tags:
|
||||
uniform: true
|
||||
rows:
|
||||
thumb:
|
||||
row_net: P10
|
||||
mirror:
|
||||
row_net: P8
|
||||
key:
|
||||
footprints: *quad
|
||||
mirror: *quad_mirror
|
||||
key:
|
||||
bind: [0,0,0,0]
|
||||
rotate: -20
|
||||
mirror:
|
||||
ref: matrix_pinky_home
|
||||
distance: 223.7529778
|
||||
outlines:
|
||||
glue:
|
||||
classic_s19:
|
||||
top:
|
||||
left:
|
||||
ref: matrix_inner_top
|
||||
shift: [, 0.5]
|
||||
right:
|
||||
ref: mirror_matrix_inner_top
|
||||
shift: [, 0.5]
|
||||
bottom:
|
||||
left:
|
||||
ref: thumbfan_far_thumb
|
||||
shift: [0.5, 0]
|
||||
rotate: 90
|
||||
right:
|
||||
ref: mirror_thumbfan_far_thumb
|
||||
shift: [0.5, 0]
|
||||
rotate: 90
|
||||
waypoints:
|
||||
- percent: 50
|
||||
width: 50
|
||||
- percent: 90
|
||||
width: 25
|
||||
uniform_s19:
|
||||
extends: classic_s19
|
||||
bottom:
|
||||
left:
|
||||
ref: unifar_far_thumb
|
||||
right:
|
||||
ref: mirror_unifar_far_thumb
|
||||
classic_s18:
|
||||
extends: classic_s19
|
||||
top:
|
||||
left:
|
||||
ref: s18_inner_top
|
||||
right:
|
||||
ref: mirror_s18_inner_top
|
||||
uniform_s18:
|
||||
extends:
|
||||
- uniform_s19
|
||||
- classic_s18
|
||||
exports:
|
||||
classic_s19_outline:
|
||||
main:
|
||||
type: keys
|
||||
side: both
|
||||
tags:
|
||||
- s19
|
||||
- classic
|
||||
glue: classic_s19
|
||||
size: 13.5
|
||||
corner: .5
|
||||
uniform_s19_outline:
|
||||
extends: classic_s19_outline
|
||||
main:
|
||||
tags:
|
||||
- s19
|
||||
- uniform
|
||||
glue: uniform_s19
|
||||
uniform_s18_outline:
|
||||
extends: uniform_s19_outline
|
||||
main:
|
||||
tags:
|
||||
- s18
|
||||
- uniform
|
||||
glue: uniform_s18
|
||||
mounting_holes:
|
||||
ring_top:
|
||||
type: circle
|
||||
ref: matrix_ring_home
|
||||
shift: [-10, 5]
|
||||
radius: 2.25
|
||||
mirror: true
|
||||
ring_bottom:
|
||||
type: circle
|
||||
ref: matrix_ring_home
|
||||
shift: [-9, -9]
|
||||
radius: 2.25
|
||||
mirror: true
|
||||
operation: stack
|
||||
index_top:
|
||||
type: circle
|
||||
ref: matrix_index_home
|
||||
shift: [9.5, 9.5]
|
||||
radius: 2.25
|
||||
mirror: true
|
||||
operation: stack
|
||||
index_bottom:
|
||||
type: circle
|
||||
ref: matrix_index_home
|
||||
shift: [9.5, -9.5]
|
||||
radius: 2.25
|
||||
mirror: true
|
||||
operation: stack
|
||||
thumb_near:
|
||||
type: circle
|
||||
ref: thumbfan_home_thumb
|
||||
shift: [-12, 2]
|
||||
radius: 2.25
|
||||
mirror: true
|
||||
operation: stack
|
||||
thumb_far:
|
||||
type: circle
|
||||
ref: thumbfan_home_thumb
|
||||
shift: [12, 2]
|
||||
radius: 2.25
|
||||
mirror: true
|
||||
operation: stack
|
||||
middle:
|
||||
type: circle
|
||||
ref: thumbfan_home_thumb
|
||||
shift: [-8, 19]
|
||||
radius: 2.25
|
||||
mirror: true
|
||||
operation: stack
|
||||
intersected_outline:
|
||||
one:
|
||||
type: outline
|
||||
name: classic_s19_outline
|
||||
two:
|
||||
type: outline
|
||||
name: uniform_s18_outline
|
||||
operation: intersect
|
||||
controller_cutout:
|
||||
type: rectangle
|
||||
ref:
|
||||
- s18_inner_top
|
||||
- mirror_s18_inner_top
|
||||
shift: [-10, -5]
|
||||
size: [20, 10]
|
||||
operation: subtract
|
||||
mounting_holes:
|
||||
type: outline
|
||||
name: mounting_holes
|
||||
operation: subtract
|
||||
classic_s19_switches:
|
||||
main:
|
||||
type: keys
|
||||
side: both
|
||||
tags:
|
||||
- classic
|
||||
glue: classic_s19
|
||||
size: 14
|
||||
bound: false
|
||||
uniform_s19_switches:
|
||||
main:
|
||||
type: keys
|
||||
side: both
|
||||
tags:
|
||||
- uniform
|
||||
glue: uniform_s19
|
||||
size: 14
|
||||
bound: false
|
||||
pcb_middle:
|
||||
raw:
|
||||
type: keys
|
||||
side: middle
|
||||
tags:
|
||||
- s19
|
||||
- classic
|
||||
glue: classic_s19
|
||||
size: 24
|
||||
helper1:
|
||||
type: rectangle
|
||||
size: [25, 5]
|
||||
ref: thumbfan_home_thumb
|
||||
shift: [0, 12]
|
||||
mirror: true
|
||||
helper2:
|
||||
type: rectangle
|
||||
size: [25, 5]
|
||||
ref: thumbfan_far_thumb
|
||||
shift: [-25, 12]
|
||||
mirror: true
|
||||
outer_bounds:
|
||||
type: outline
|
||||
name: classic_s19_outline
|
||||
operation: intersect
|
||||
pcbs:
|
||||
main:
|
||||
outlines:
|
||||
edge:
|
||||
outline: intersected_outline
|
||||
layer: Edge.Cuts
|
||||
middle:
|
||||
outline: pcb_middle
|
||||
layer: F.SilkS
|
||||
footprints:
|
||||
mcu:
|
||||
type: promicro
|
||||
anchor:
|
||||
ref:
|
||||
- s18_inner_top
|
||||
- mirror_s18_inner_top
|
||||
shift: [0, -23]
|
||||
rotate: 270
|
||||
slider:
|
||||
type: slider
|
||||
anchor:
|
||||
ref:
|
||||
- s18_inner_top
|
||||
- mirror_s18_inner_top
|
||||
shift: [0, -7.5]
|
||||
nets:
|
||||
from: RAWER
|
||||
to: RAW
|
||||
params:
|
||||
side: B
|
||||
reset:
|
||||
type: reset
|
||||
anchor:
|
||||
ref:
|
||||
- s18_inner_top
|
||||
- mirror_s18_inner_top
|
||||
shift: [0, -17]
|
||||
rotate: 90
|
||||
nets:
|
||||
from: RST
|
||||
to: GND
|
||||
params:
|
||||
side: B
|
||||
extra_row_left:
|
||||
type: pad
|
||||
anchor:
|
||||
ref:
|
||||
- s18_inner_top
|
||||
- mirror_s18_inner_top
|
||||
shift: [-15, -10]
|
||||
nets:
|
||||
net: 'P20'
|
||||
params:
|
||||
width: 3
|
||||
height: 3
|
||||
front: false
|
||||
text: 'LN'
|
||||
align: right
|
||||
extra_row_right:
|
||||
type: pad
|
||||
anchor:
|
||||
ref:
|
||||
- s18_inner_top
|
||||
- mirror_s18_inner_top
|
||||
shift: [15, -10]
|
||||
nets:
|
||||
net: 'P21'
|
||||
params:
|
||||
width: 3
|
||||
height: 3
|
||||
front: false
|
||||
text: 'RN'
|
||||
battery:
|
||||
type: jstph
|
||||
anchor:
|
||||
ref:
|
||||
- matrix_inner_bottom
|
||||
- mirror_matrix_inner_bottom
|
||||
shift: [0, -43]
|
||||
rotate: 180
|
||||
nets:
|
||||
pos: RAWER
|
||||
neg: GND
|
||||
led:
|
||||
type: rgb
|
||||
anchor:
|
||||
ref:
|
||||
- matrix_inner_bottom
|
||||
- mirror_matrix_inner_bottom
|
||||
shift: [0, -48]
|
||||
nets:
|
||||
din: 'P9'
|
||||
dout: ''
|
182
test/fixtures/absolem_points.json
vendored
182
test/fixtures/absolem_points.json
vendored
|
@ -1,182 +0,0 @@
|
|||
{
|
||||
"matrix_pinky_bottom": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"r": -15
|
||||
},
|
||||
"matrix_pinky_home": {
|
||||
"x": 4.9175619,
|
||||
"y": 18.3525907,
|
||||
"r": -15
|
||||
},
|
||||
"matrix_pinky_top": {
|
||||
"x": 9.8351237,
|
||||
"y": 36.7051814,
|
||||
"r": -15
|
||||
},
|
||||
"matrix_ring_bottom": {
|
||||
"x": 22.7244416,
|
||||
"y": 5.176704,
|
||||
"r": -20
|
||||
},
|
||||
"matrix_ring_home": {
|
||||
"x": 29.2228244,
|
||||
"y": 23.0308638,
|
||||
"r": -20
|
||||
},
|
||||
"matrix_ring_top": {
|
||||
"x": 35.7212071,
|
||||
"y": 40.8850235,
|
||||
"r": -20
|
||||
},
|
||||
"matrix_middle_bottom": {
|
||||
"x": 42.2887022,
|
||||
"y": 3.3767843,
|
||||
"r": -20
|
||||
},
|
||||
"matrix_middle_home": {
|
||||
"x": 48.7870849,
|
||||
"y": 21.2309442,
|
||||
"r": -20
|
||||
},
|
||||
"matrix_middle_top": {
|
||||
"x": 55.2854676,
|
||||
"y": 39.0851039,
|
||||
"r": -20
|
||||
},
|
||||
"matrix_index_bottom": {
|
||||
"x": 58.0907411,
|
||||
"y": -8.7597541,
|
||||
"r": -20
|
||||
},
|
||||
"matrix_index_home": {
|
||||
"x": 64.5891238,
|
||||
"y": 9.0944057,
|
||||
"r": -20
|
||||
},
|
||||
"matrix_index_top": {
|
||||
"x": 71.0875065,
|
||||
"y": 26.9485655,
|
||||
"r": -20
|
||||
},
|
||||
"matrix_inner_bottom": {
|
||||
"x": 75.2608606,
|
||||
"y": -17.1375221,
|
||||
"r": -20
|
||||
},
|
||||
"matrix_inner_home": {
|
||||
"x": 81.7592433,
|
||||
"y": 0.7166377,
|
||||
"r": -20
|
||||
},
|
||||
"matrix_inner_top": {
|
||||
"x": 88.257626,
|
||||
"y": 18.5707976,
|
||||
"r": -20
|
||||
},
|
||||
"thumbfan_near_thumb": {
|
||||
"x": 62.1846295,
|
||||
"y": -32.5975409,
|
||||
"r": -20
|
||||
},
|
||||
"thumbfan_home_thumb": {
|
||||
"x": 82.5841162,
|
||||
"y": -47.013742,
|
||||
"r": -48
|
||||
},
|
||||
"thumbfan_far_thumb": {
|
||||
"x": 94.7890169,
|
||||
"y": -68.8083815,
|
||||
"r": -76
|
||||
},
|
||||
"mirror_matrix_pinky_bottom": {
|
||||
"x": 233.5881016,
|
||||
"y": 0,
|
||||
"r": 15
|
||||
},
|
||||
"mirror_matrix_pinky_home": {
|
||||
"x": 228.67053969999998,
|
||||
"y": 18.3525907,
|
||||
"r": 15
|
||||
},
|
||||
"mirror_matrix_pinky_top": {
|
||||
"x": 223.7529779,
|
||||
"y": 36.7051814,
|
||||
"r": 15
|
||||
},
|
||||
"mirror_matrix_ring_bottom": {
|
||||
"x": 210.86365999999998,
|
||||
"y": 5.176704,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_matrix_ring_home": {
|
||||
"x": 204.36527719999998,
|
||||
"y": 23.0308638,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_matrix_ring_top": {
|
||||
"x": 197.8668945,
|
||||
"y": 40.8850235,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_matrix_middle_bottom": {
|
||||
"x": 191.29939939999997,
|
||||
"y": 3.3767843,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_matrix_middle_home": {
|
||||
"x": 184.8010167,
|
||||
"y": 21.2309442,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_matrix_middle_top": {
|
||||
"x": 178.30263399999998,
|
||||
"y": 39.0851039,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_matrix_index_bottom": {
|
||||
"x": 175.49736049999998,
|
||||
"y": -8.7597541,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_matrix_index_home": {
|
||||
"x": 168.99897779999998,
|
||||
"y": 9.0944057,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_matrix_index_top": {
|
||||
"x": 162.5005951,
|
||||
"y": 26.9485655,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_matrix_inner_bottom": {
|
||||
"x": 158.327241,
|
||||
"y": -17.1375221,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_matrix_inner_home": {
|
||||
"x": 151.82885829999998,
|
||||
"y": 0.7166377,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_matrix_inner_top": {
|
||||
"x": 145.3304756,
|
||||
"y": 18.5707976,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_thumbfan_near_thumb": {
|
||||
"x": 171.4034721,
|
||||
"y": -32.5975409,
|
||||
"r": 20
|
||||
},
|
||||
"mirror_thumbfan_home_thumb": {
|
||||
"x": 151.00398539999998,
|
||||
"y": -47.013742,
|
||||
"r": 48
|
||||
},
|
||||
"mirror_thumbfan_far_thumb": {
|
||||
"x": 138.79908469999998,
|
||||
"y": -68.8083815,
|
||||
"r": 76
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
const Point = require('../src/point')
|
||||
|
||||
describe('Point', function() {
|
||||
it('#constructor', function() {
|
||||
const point = new Point(1, 2, 45)
|
||||
point.p.should.deep.equal([1, 2])
|
||||
})
|
||||
})
|
44
test/unit/prepare.js
Normal file
44
test/unit/prepare.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
const p = require('../../src/prepare')
|
||||
|
||||
describe('Prepare', function() {
|
||||
it('unnest', function() {
|
||||
p.unnest({'a.b.c': 1}).should.deep.equal({a: {b: {c: 1}}})
|
||||
p.unnest({'a.b.c': {
|
||||
d: 2,
|
||||
'e.f': 3
|
||||
}}).should.deep.equal({a: {b: {c: {d: 2, e: {f: 3}}}}})
|
||||
})
|
||||
|
||||
it('extend', function() {
|
||||
p.extend('something', undefined).should.equal('something')
|
||||
should.equal(p.extend('something', '!!unset'), undefined)
|
||||
p.extend(undefined, 'something').should.equal('something')
|
||||
p.extend(28, 'something').should.equal('something')
|
||||
p.extend('something', 28).should.equal(28)
|
||||
p.extend(27, 28).should.equal(28)
|
||||
p.extend({a: 1, c: 1, d: 1}, {b: 2, c: 2, d: '!!unset'}).should.deep.equal({a: 1, b: 2, c: 2})
|
||||
p.extend([3, 2, 1], [null, 4, 5]).should.deep.equal([3, 4, 5])
|
||||
})
|
||||
|
||||
it('inherit', function() {
|
||||
p.inherit({
|
||||
a: {
|
||||
x: 1,
|
||||
y: 2
|
||||
},
|
||||
b: {
|
||||
extends: 'a',
|
||||
z: 3
|
||||
},
|
||||
c: {
|
||||
extends: 'b',
|
||||
w: 4
|
||||
}
|
||||
}).c.should.deep.equal({
|
||||
x: 1,
|
||||
y: 2,
|
||||
z: 3,
|
||||
w: 4
|
||||
})
|
||||
})
|
||||
})
|
|
@ -1,7 +0,0 @@
|
|||
const u = require('../src/utils')
|
||||
|
||||
describe('Utils', function() {
|
||||
it('deep_assign', function() {
|
||||
u.deep_assign({}, 'a.b.c', 1).should.deep.equal({a: {b: {c: 1}}})
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue