From 458adbffc3c83067894fc43a2b1dcdf3c06453e0 Mon Sep 17 00:00:00 2001 From: Shibo Date: Fri, 4 Oct 2024 09:14:52 +0200 Subject: [PATCH] improved testing (#16) * improved testing * removed ghost code --- bun.lockb | Bin 97708 -> 116969 bytes package.json | 2 + .../excellon-drill-builder.test.ts.snap | 2160 +++++++++++++++++ .../__snapshots__/simple1-bottom.snap.svg | 14 +- .../gerber/__snapshots__/simple1-top.snap.svg | 14 +- .../__snapshots__/simple2-bottom.snap.svg | 14 +- .../gerber/__snapshots__/simple2-top.snap.svg | 14 +- .../__snapshots__/simple3-bottom.snap.svg | 7 + .../gerber/__snapshots__/simple3-top.snap.svg | 7 + .../components/ArduinoProMicroBreakout.tsx | 37 + tests/gerber/components/Key.tsx | 46 + tests/gerber/components/Keyswitch.tsx | 26 + tests/gerber/components/KeyswitchSocket.tsx | 57 + tests/gerber/components/MacroKeypad.tsx | 60 + ...=> generate-board-outline-gerber.test.tsx} | 73 +- .../generate-gerber-macrokeypad.test.tsx | 34 + ...erate-gerber-with-basic-elements.test.tsx} | 87 +- 17 files changed, 2508 insertions(+), 144 deletions(-) create mode 100644 tests/gerber/__snapshots__/simple3-bottom.snap.svg create mode 100644 tests/gerber/__snapshots__/simple3-top.snap.svg create mode 100644 tests/gerber/components/ArduinoProMicroBreakout.tsx create mode 100644 tests/gerber/components/Key.tsx create mode 100644 tests/gerber/components/Keyswitch.tsx create mode 100644 tests/gerber/components/KeyswitchSocket.tsx create mode 100644 tests/gerber/components/MacroKeypad.tsx rename tests/gerber/{generate-board-outline-gerber.test.ts => generate-board-outline-gerber.test.tsx} (66%) create mode 100644 tests/gerber/generate-gerber-macrokeypad.test.tsx rename tests/gerber/{generate-gerber-with-basic-elements.test.ts => generate-gerber-with-basic-elements.test.tsx} (50%) diff --git a/bun.lockb b/bun.lockb index 12d6b4225be8fe329bd7b7eae5547464190d98af..d734ec64e55974d3d889110b34506191dd0f665d 100755 GIT binary patch delta 25902 zcmeHwcU)B0)AwG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elRW018Tu;p=*hL zv{wcP(UD9E7PU}dabg4MnYUJpZ$993(KaW`mgUG-iW8)_PTU*~L*5i2W6=Tjvb`dC z3|58gG3*!mIW2CDF)N0#6j3x51F6ATo=zWq*mFtqHpg8-cOgMIUMR|H(EtT@L7X0o z@fcBYQ7p=XutsblNE6=>OcK81V7Yl~ck2%u+_doLrlBe9gEYc}En@7)$vuBkrq;vEVqV<%oIW{<~sv&1s!v4dgwJLfq++bQjp zF=$@gb;}*|{PX@^^a`WJhVF-nb`#L=K{0*;8q&``5kI@wa4f~)2>u|KOrG5{Hoi@V zC<}WK?;2BM$D2?sUohJb&1rk`zlT?@Fmyjhr3;D)-W#wH%2xL-SP32iOnTX zr;6pM+ts{6{MM?XF3C?!f2UdFK&sdYjn;3{cO+6(koc;Y#fMZ@(0|RqpSAYyU%FB4 zedB2qyTh0JuZq|Qcg?-{3V1pOUw70z-}iZ2*cOpj!hHQ-#0Lvbxy~cG^Pd~D!OzwJ zo{qc=y>i>%@d!V@L)4Wp&D#fGwIu#cRK$m@s{QR3>1!6rV}ZC*!bWcyGo8JjvSr^M H=I8P^Np)kB diff --git a/package.json b/package.json index 7071ff5..3f0c856 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,10 @@ ], "devDependencies": { "@biomejs/biome": "^1.8.3", + "@tscircuit/core": "^0.0.98", "@types/bun": "^1.1.8", "@types/node": "^22.5.2", + "@types/react": "^18.3.11", "bun-match-svg": "^0.0.3", "gerber-to-svg": "^4.2.8", "pcb-stackup": "^4.2.8", diff --git a/tests/excellon-drill/__snapshots__/excellon-drill-builder.test.ts.snap b/tests/excellon-drill/__snapshots__/excellon-drill-builder.test.ts.snap index 6fdf1f0..57d51bd 100644 --- a/tests/excellon-drill/__snapshots__/excellon-drill-builder.test.ts.snap +++ b/tests/excellon-drill/__snapshots__/excellon-drill-builder.test.ts.snap @@ -647,3 +647,2163 @@ exports[`test that we can recreate an example drill file: excellon-drill-builder }, ] `; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; + +exports[`test that we can recreate an example drill file: excellon-drill-builder 1`] = ` +[ + { + "command_code": "M48", + }, + { + "command_code": "header_comment", + "text": "DRILL file {tscircuit} date 2024-04-09T20:34:41-0700", + }, + { + "command_code": "header_comment", + "text": "FORMAT={-:-/ absolute / inch / decimal}", + }, + { + "attribute_name": "TF.CreationDate", + "attribute_value": "2024-04-09T20:34:41-07:00", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.GenerationSoftware", + "attribute_value": "Kicad,Pcbnew,8.0.1", + "command_code": "header_attribute", + }, + { + "attribute_name": "TF.FileFunction", + "attribute_value": "Plated,1,2,PTH", + "command_code": "header_attribute", + }, + { + "command_code": "FMAT", + "format": 2, + }, + { + "command_code": "header_comment", + "text": "TA.AperFunction,Plated,PTH,ComponentDrill", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "header_comment", + "text": "End of header", + }, + { + "command_code": "G90", + }, + { + "command_code": "G05", + }, + { + "command_code": "define_tool", + "diameter": 0.0394, + "tool_number": 1, + }, + { + "command_code": "drill_at", + "x": 4.9197, + "y": -2.9724, + }, + { + "command_code": "drill_at", + "x": 5.0197, + "y": -2.9724, + }, + { + "command_code": "M30", + }, +] +`; diff --git a/tests/gerber/__snapshots__/simple1-bottom.snap.svg b/tests/gerber/__snapshots__/simple1-bottom.snap.svg index 991aad4..5f084f0 100644 --- a/tests/gerber/__snapshots__/simple1-bottom.snap.svg +++ b/tests/gerber/__snapshots__/simple1-bottom.snap.svg @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/gerber/__snapshots__/simple1-top.snap.svg b/tests/gerber/__snapshots__/simple1-top.snap.svg index f5e2ab7..1b2470d 100644 --- a/tests/gerber/__snapshots__/simple1-top.snap.svg +++ b/tests/gerber/__snapshots__/simple1-top.snap.svg @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/gerber/__snapshots__/simple2-bottom.snap.svg b/tests/gerber/__snapshots__/simple2-bottom.snap.svg index 2d2ce57..48ba46c 100644 --- a/tests/gerber/__snapshots__/simple2-bottom.snap.svg +++ b/tests/gerber/__snapshots__/simple2-bottom.snap.svg @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/gerber/__snapshots__/simple2-top.snap.svg b/tests/gerber/__snapshots__/simple2-top.snap.svg index 637325b..d83ac82 100644 --- a/tests/gerber/__snapshots__/simple2-top.snap.svg +++ b/tests/gerber/__snapshots__/simple2-top.snap.svg @@ -1,7 +1,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/gerber/__snapshots__/simple3-bottom.snap.svg b/tests/gerber/__snapshots__/simple3-bottom.snap.svg new file mode 100644 index 0000000..671f402 --- /dev/null +++ b/tests/gerber/__snapshots__/simple3-bottom.snap.svg @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/tests/gerber/__snapshots__/simple3-top.snap.svg b/tests/gerber/__snapshots__/simple3-top.snap.svg new file mode 100644 index 0000000..4fc59ef --- /dev/null +++ b/tests/gerber/__snapshots__/simple3-top.snap.svg @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/tests/gerber/components/ArduinoProMicroBreakout.tsx b/tests/gerber/components/ArduinoProMicroBreakout.tsx new file mode 100644 index 0000000..918844e --- /dev/null +++ b/tests/gerber/components/ArduinoProMicroBreakout.tsx @@ -0,0 +1,37 @@ +export const ArduinoProMicroBreakout = (props: { + name: string + pcbX?: number + pcbY?: number +}) => ( + +) diff --git a/tests/gerber/components/Key.tsx b/tests/gerber/components/Key.tsx new file mode 100644 index 0000000..333865e --- /dev/null +++ b/tests/gerber/components/Key.tsx @@ -0,0 +1,46 @@ +import { Keyswitch } from "./Keyswitch.tsx" +import { KeyswitchSocket } from "./KeyswitchSocket.tsx" + +export const Key = (props: { + name: string + keyNum: number + pcbX: number + pcbY: number +}) => { + const socketName = `SW${props.keyNum}` + const switchHoleName = `HO${props.keyNum}` + const diodeName = `D${props.keyNum}` + return ( + <> + + + + + + ) +} diff --git a/tests/gerber/components/Keyswitch.tsx b/tests/gerber/components/Keyswitch.tsx new file mode 100644 index 0000000..ca6f0c3 --- /dev/null +++ b/tests/gerber/components/Keyswitch.tsx @@ -0,0 +1,26 @@ +/** + * Keyswitch (Brown) + * + * https://www.lcsc.com/datasheet/lcsc_datasheet_1912111437_Kailh-CPG1511F01S03_C400227.pdf + */ +export const Keyswitch = (props: { + name: string + pcbX?: number + pcbY?: number +}) => { + return ( + + + + } + /> + ) +} diff --git a/tests/gerber/components/KeyswitchSocket.tsx b/tests/gerber/components/KeyswitchSocket.tsx new file mode 100644 index 0000000..8e3c7ca --- /dev/null +++ b/tests/gerber/components/KeyswitchSocket.tsx @@ -0,0 +1,57 @@ +import "@tscircuit/core" + +/** + * A switch shaft you can use to connect a pluggable Kailh socket. + * + * Datasheet: https://wmsc.lcsc.com/wmsc/upload/file/pdf/v2/lcsc/2211090930_Kailh-CPG151101S11-1_C5184526.pdf + */ +export const KeyswitchSocket = (props: { + name: string + pcbX?: number + pcbY?: number + layer?: "top" | "bottom" +}) => ( + + {/* */} + + + + + + + + + + + + } + /> +) diff --git a/tests/gerber/components/MacroKeypad.tsx b/tests/gerber/components/MacroKeypad.tsx new file mode 100644 index 0000000..564637b --- /dev/null +++ b/tests/gerber/components/MacroKeypad.tsx @@ -0,0 +1,60 @@ +import React from "react" +import { ArduinoProMicroBreakout } from "./ArduinoProMicroBreakout" +import { Key } from "./Key" + +const MacroKeypad = () => { + const keyPositions = Array.from({ length: 9 }) + .map((_, i) => ({ + keyNum: i + 1, + col: i % 3, + row: Math.floor(i / 3), + })) + .map((p) => ({ + ...p, + x: p.col * 19.05 - 19.05, + y: p.row * 19.05 - 19.05, + })) + + const rowToMicroPin = { + 0: "D2", + 1: "D3", + 2: "D4", + } + const colToMicroPin = { + 0: "D5", + 1: "D6", + 2: "D7", + } + return ( + + {keyPositions.map(({ keyNum, x, y }) => ( + + ))} + + {keyPositions.map(({ keyNum, row, col }) => ( + + ))} + {keyPositions.map(({ keyNum, row, col }) => ( + + ))} + + ) +} + +export default MacroKeypad diff --git a/tests/gerber/generate-board-outline-gerber.test.ts b/tests/gerber/generate-board-outline-gerber.test.tsx similarity index 66% rename from tests/gerber/generate-board-outline-gerber.test.ts rename to tests/gerber/generate-board-outline-gerber.test.tsx index 9f47b08..5427754 100644 --- a/tests/gerber/generate-board-outline-gerber.test.ts +++ b/tests/gerber/generate-board-outline-gerber.test.tsx @@ -11,22 +11,19 @@ import { convertSoupToExcellonDrillCommands, stringifyExcellonDrill, } from "src/excellon-drill" +import { Circuit } from "@tscircuit/core" // If you're trying to test this, I would recommend opening up Kicad's Gerber // Viewer and loading in the files from the generated directory "gerber-output" // that's produced if OUTPUT_GERBER=1 when you do `npx ava ./tests/gerber/generate-gerber-with-trace.test.ts` // You can generate the files then hit reload in the Gerber Viewer to see that // everything looks approximately correct -test("Generate simple gerber with a single trace", async () => { - const soup: AnyCircuitElement[] = [ - { - type: "pcb_board", - num_layers: 2, - pcb_board_id: "pcb_board_0", - thickness: 1.2, - width: 100, - height: 100, - center: { x: 0, y: 0 }, - outline: [ +test("Generate simple board with a multi-layer trace", async () => { + const circuit = new Circuit() + circuit.add( + { { x: -20.5, y: 16.5 }, { x: -22.5, y: 16.5 }, { x: -22.5, y: 24.5 }, - ], - }, - { - type: "pcb_trace", - source_trace_id: "source_trace_1", - pcb_trace_id: "pcb_trace_1", - route: [ - { - x: -10, - y: 0, - width: 0.1, - route_type: "wire", - layer: "top", - }, - { - x: 10, - y: 0, - width: 0.1, - route_type: "wire", - layer: "top", - }, - ], - }, - ] + ]} + > + + + + , + ) + const soup = circuit.getCircuitJson() const gerber_cmds = convertSoupToGerberCommands(soup) const excellon_drill_cmds = convertSoupToExcellonDrillCommands({ @@ -75,9 +69,6 @@ test("Generate simple gerber with a single trace", async () => { is_plated: true, }) const edgecut_gerber = stringifyGerberCommands(gerber_cmds.Edge_Cuts) - // console.log("Gerber") - // console.log("----------------------------------------------") - // console.log(edgecut_gerber) // TODO parse gerber to check for correctness @@ -87,10 +78,4 @@ test("Generate simple gerber with a single trace", async () => { await maybeOutputGerber(gerberOutput, excellonDrillOutput) expect(gerberOutput).toMatchGerberSnapshot(import.meta.path, "simple1") - - // gerberToSvg(gerberOutput.Edge_Cuts, {}, (err, svg) => { - // expect(svg).toMatchSvgSnapshot(import.meta.path, "gerber-edge-cuts") - // }) - - // render( }) diff --git a/tests/gerber/generate-gerber-macrokeypad.test.tsx b/tests/gerber/generate-gerber-macrokeypad.test.tsx new file mode 100644 index 0000000..f6bbb3d --- /dev/null +++ b/tests/gerber/generate-gerber-macrokeypad.test.tsx @@ -0,0 +1,34 @@ +import { test, expect } from "bun:test" +import { convertSoupToGerberCommands } from "src/gerber/convert-soup-to-gerber-commands" +import { + convertSoupToExcellonDrillCommands, + stringifyExcellonDrill, +} from "src/excellon-drill" +import { + stringifyGerberCommandLayers, + stringifyGerberCommands, +} from "src/gerber/stringify-gerber" +import { maybeOutputGerber } from "tests/fixtures/maybe-output-gerber" +import { Circuit } from "@tscircuit/core" +import MacroKeypad from "./components/MacroKeypad" + +test("Generate gerber of macrokeypad", async () => { + const circuit = new Circuit() + circuit.add() + const circuitJson = circuit.getCircuitJson() + const gerber_cmds = convertSoupToGerberCommands(circuitJson) + const excellon_drill_cmds = convertSoupToExcellonDrillCommands({ + soup: circuitJson, + is_plated: true, + }) + const edgecut_gerber = stringifyGerberCommands(gerber_cmds.Edge_Cuts) + + // TODO parse gerber to check for correctness + + const excellonDrillOutput = stringifyExcellonDrill(excellon_drill_cmds) + const gerberOutput = stringifyGerberCommandLayers(gerber_cmds) + + await maybeOutputGerber(gerberOutput, excellonDrillOutput) + + expect(gerberOutput).toMatchGerberSnapshot(import.meta.path, "simple3") +}) diff --git a/tests/gerber/generate-gerber-with-basic-elements.test.ts b/tests/gerber/generate-gerber-with-basic-elements.test.tsx similarity index 50% rename from tests/gerber/generate-gerber-with-basic-elements.test.ts rename to tests/gerber/generate-gerber-with-basic-elements.test.tsx index 7f18e6b..52ccb0d 100644 --- a/tests/gerber/generate-gerber-with-basic-elements.test.ts +++ b/tests/gerber/generate-gerber-with-basic-elements.test.tsx @@ -10,84 +10,33 @@ import { stringifyGerberCommands, } from "src/gerber/stringify-gerber" import { maybeOutputGerber } from "tests/fixtures/maybe-output-gerber" +import { Circuit } from "@tscircuit/core" // If you're trying to test this, I would recommend opening up Kicad's Gerber // Viewer and loading in the files from the generated directory "gerber-output" // that's produced if OUTPUT_GERBER=1 when you do `npx ava ./tests/gerber/generate-gerber-with-trace.test.ts` // You can generate the files then hit reload in the Gerber Viewer to see that // everything looks approximately correct test("Generate simple gerber with basic elements", async () => { - const soup: AnyCircuitElement[] = [ - { - type: "pcb_board", - num_layers: 2, - pcb_board_id: "pcb_board_0", - thickness: 1.2, - width: 20, - height: 20, - center: { x: 0, y: 0 }, - }, - { - type: "pcb_trace", - source_trace_id: "source_trace_1", - pcb_trace_id: "pcb_trace_1", - route: [ - { - x: 0, - y: 0, - width: 0.1, - route_type: "wire", - layer: "top", - }, - { - x: 1, - y: 0, - width: 0.1, - route_type: "wire", - layer: "top", - }, - ], - }, - { - pcb_smtpad_id: "smtpad_1", - type: "pcb_smtpad", - shape: "rect", - height: 1, - width: 1, - x: 1, - y: 1, - layer: "top", - }, - { - pcb_smtpad_id: "smtpad_2", - type: "pcb_smtpad", - shape: "rect", - height: 1, - width: 1, - x: 2, - y: -1, - layer: "bottom", - }, - { - type: "pcb_plated_hole", - pcb_plated_hole_id: "pcb_plated_hole_0", - shape: "circle", - x: 4, - y: 1, - hole_diameter: 0.8, - layers: ["top", "bottom"], - outer_diameter: 2, - }, - ] - + const circuit = new Circuit() + circuit.add( + + + + , + ) + const soup = circuit.getCircuitJson() const gerber_cmds = convertSoupToGerberCommands(soup) const excellon_drill_cmds = convertSoupToExcellonDrillCommands({ soup: soup, is_plated: true, }) const edgecut_gerber = stringifyGerberCommands(gerber_cmds.Edge_Cuts) - // console.log("Gerber") - // console.log("----------------------------------------------") - // console.log(edgecut_gerber) // TODO parse gerber to check for correctness @@ -97,10 +46,4 @@ test("Generate simple gerber with basic elements", async () => { await maybeOutputGerber(gerberOutput, excellonDrillOutput) expect(gerberOutput).toMatchGerberSnapshot(import.meta.path, "simple2") - - // gerberToSvg(gerberOutput.Edge_Cuts, {}, (err, svg) => { - // expect(svg).toMatchSvgSnapshot(import.meta.path, "gerber-edge-cuts") - // }) - - // render( })