296 lines
8.4 KiB
TypeScript
296 lines
8.4 KiB
TypeScript
|
import { test } from 'vitest'
|
||
|
import { CutPointInput, CutPointProc } from './CutPoint'
|
||
|
|
||
|
test('cutPointTest', async() => {
|
||
|
let context = {
|
||
|
"input": {
|
||
|
"boardWidth": 1220,
|
||
|
"boardLength": 2440,
|
||
|
"blocks": [
|
||
|
{
|
||
|
"id": "25030882560",
|
||
|
"width": 600,
|
||
|
"length": 400,
|
||
|
"waveType": 0,
|
||
|
"x": 3,
|
||
|
"y": 3,
|
||
|
"cutOrder": 2,
|
||
|
"isUnRegular": false,
|
||
|
"blockPoints": {
|
||
|
"pts": [
|
||
|
{
|
||
|
"x": 0,
|
||
|
"y": 0
|
||
|
},
|
||
|
{
|
||
|
"x": 398,
|
||
|
"y": 0
|
||
|
},
|
||
|
{
|
||
|
"x": 398,
|
||
|
"y": 598
|
||
|
},
|
||
|
{
|
||
|
"x": 0,
|
||
|
"y": 598
|
||
|
}
|
||
|
],
|
||
|
"buls": [
|
||
|
0,
|
||
|
0,
|
||
|
0,
|
||
|
0
|
||
|
]
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"id": "25030882561",
|
||
|
"width": 600,
|
||
|
"length": 400,
|
||
|
"waveType": 0,
|
||
|
"x": 3,
|
||
|
"y": 604,
|
||
|
"cutOrder": 3,
|
||
|
"isUnRegular": false,
|
||
|
"blockPoints": {
|
||
|
"pts": [
|
||
|
{
|
||
|
"x": 0,
|
||
|
"y": 0
|
||
|
},
|
||
|
{
|
||
|
"x": 398,
|
||
|
"y": 0
|
||
|
},
|
||
|
{
|
||
|
"x": 398,
|
||
|
"y": 598
|
||
|
},
|
||
|
{
|
||
|
"x": 0,
|
||
|
"y": 598
|
||
|
}
|
||
|
],
|
||
|
"buls": [
|
||
|
0,
|
||
|
0,
|
||
|
0,
|
||
|
0
|
||
|
]
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"id": "25030882562",
|
||
|
"width": 600,
|
||
|
"length": 400,
|
||
|
"waveType": 0,
|
||
|
"x": 404,
|
||
|
"y": 3,
|
||
|
"cutOrder": 4,
|
||
|
"isUnRegular": false,
|
||
|
"blockPoints": {
|
||
|
"pts": [
|
||
|
{
|
||
|
"x": 0,
|
||
|
"y": 0
|
||
|
},
|
||
|
{
|
||
|
"x": 398,
|
||
|
"y": 0
|
||
|
},
|
||
|
{
|
||
|
"x": 398,
|
||
|
"y": 598
|
||
|
},
|
||
|
{
|
||
|
"x": 0,
|
||
|
"y": 598
|
||
|
}
|
||
|
],
|
||
|
"buls": [
|
||
|
0,
|
||
|
0,
|
||
|
0,
|
||
|
0
|
||
|
]
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"id": "25030882563",
|
||
|
"width": 600,
|
||
|
"length": 400,
|
||
|
"waveType": 0,
|
||
|
"x": 404,
|
||
|
"y": 604,
|
||
|
"cutOrder": 5,
|
||
|
"isUnRegular": false,
|
||
|
"blockPoints": {
|
||
|
"pts": [
|
||
|
{
|
||
|
"x": 0,
|
||
|
"y": 0
|
||
|
},
|
||
|
{
|
||
|
"x": 398,
|
||
|
"y": 0
|
||
|
},
|
||
|
{
|
||
|
"x": 398,
|
||
|
"y": 598
|
||
|
},
|
||
|
{
|
||
|
"x": 0,
|
||
|
"y": 598
|
||
|
}
|
||
|
],
|
||
|
"buls": [
|
||
|
0,
|
||
|
0,
|
||
|
0,
|
||
|
0
|
||
|
]
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"id": "25030882564",
|
||
|
"width": 600,
|
||
|
"length": 400,
|
||
|
"waveType": 0,
|
||
|
"x": 805,
|
||
|
"y": 3,
|
||
|
"cutOrder": 1,
|
||
|
"isUnRegular": false,
|
||
|
"blockPoints": {
|
||
|
"pts": [
|
||
|
{
|
||
|
"x": 0,
|
||
|
"y": 0
|
||
|
},
|
||
|
{
|
||
|
"x": 398,
|
||
|
"y": 0
|
||
|
},
|
||
|
{
|
||
|
"x": 398,
|
||
|
"y": 598
|
||
|
},
|
||
|
{
|
||
|
"x": 0,
|
||
|
"y": 598
|
||
|
}
|
||
|
],
|
||
|
"buls": [
|
||
|
0,
|
||
|
0,
|
||
|
0,
|
||
|
0
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
"params": {}
|
||
|
}
|
||
|
let cutPointProc = new CutPointProc()
|
||
|
await cutPointProc.exec(context)
|
||
|
console.log(context)
|
||
|
})
|
||
|
|
||
|
const testData = {
|
||
|
input: {
|
||
|
boardWidth: 1220,
|
||
|
boardLength: 2440,
|
||
|
gap: 6,
|
||
|
blocks: [
|
||
|
{
|
||
|
id: 25030882560,
|
||
|
length: 598,
|
||
|
width: 398,
|
||
|
x: 3.005,
|
||
|
y: 4,
|
||
|
cutOrder: 2,
|
||
|
},
|
||
|
{
|
||
|
id: 25030882561,
|
||
|
length: 598,
|
||
|
width: 398,
|
||
|
x: 3.005,
|
||
|
y: 610,
|
||
|
cutOrder: 3,
|
||
|
},
|
||
|
{
|
||
|
id: 25030882562,
|
||
|
length: 598,
|
||
|
width: 398,
|
||
|
x: 3.005,
|
||
|
y: 1216,
|
||
|
cutOrder: 5,
|
||
|
},
|
||
|
{
|
||
|
id: 25030882563,
|
||
|
length: 598,
|
||
|
width: 398,
|
||
|
x: 3.005,
|
||
|
y: 1821.005,
|
||
|
cutOrder: 4,
|
||
|
},
|
||
|
{
|
||
|
id: 25030882564,
|
||
|
length: 598,
|
||
|
width: 398,
|
||
|
x: 407.015,
|
||
|
y: 3.005,
|
||
|
cutOrder: 1,
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
params: {
|
||
|
name: "",
|
||
|
version: "1.0.0",
|
||
|
},
|
||
|
output: {
|
||
|
blocks: [
|
||
|
|
||
|
{
|
||
|
id: 25030882560,
|
||
|
length: 598,
|
||
|
width: 398,
|
||
|
x: 3.005,
|
||
|
y: 4,
|
||
|
cutOrder: 2,
|
||
|
},
|
||
|
{
|
||
|
id: 25030882561,
|
||
|
length: 598,
|
||
|
width: 398,
|
||
|
x: 3.005,
|
||
|
y: 610,
|
||
|
cutOrder: 3,
|
||
|
},
|
||
|
{
|
||
|
id: 25030882562,
|
||
|
length: 598,
|
||
|
width: 398,
|
||
|
x: 3.005,
|
||
|
y: 1216,
|
||
|
cutOrder: 5,
|
||
|
},
|
||
|
{
|
||
|
id: 25030882563,
|
||
|
length: 598,
|
||
|
width: 398,
|
||
|
x: 3.005,
|
||
|
y: 1821.005,
|
||
|
cutOrder: 4,
|
||
|
},
|
||
|
{
|
||
|
id: 25030882564,
|
||
|
length: 598,
|
||
|
width: 398,
|
||
|
x: 407.015,
|
||
|
y: 3.005,
|
||
|
cutOrder: 1,
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
}
|