From 1a7cc88b97a997b34a27a717a80fab2cb2916a85 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 31 Oct 2023 12:56:56 -0400 Subject: [PATCH] Add (failing) QA test for #16003 Also remove old test_netlists.cpp that should have been removed long ago --- .../netlists/issue16003/issue16003.kicad_sch | 51 +++++ .../netlists/issue16003/issue16003.net | 96 +++++++++ .../netlists/issue16003/issue16003_test.net | 105 ++++++++++ .../netlists/issue16003/untitled.kicad_sch | 124 +++++++++++ .../netlists/issue16003/untitled2.kicad_sch | 127 ++++++++++++ .../eeschema/test_netlist_exporter_kicad.cpp | 5 + qa/tests/eeschema/test_netlists.cpp | 193 ------------------ 7 files changed, 508 insertions(+), 193 deletions(-) create mode 100644 qa/data/eeschema/netlists/issue16003/issue16003.kicad_sch create mode 100644 qa/data/eeschema/netlists/issue16003/issue16003.net create mode 100644 qa/data/eeschema/netlists/issue16003/issue16003_test.net create mode 100644 qa/data/eeschema/netlists/issue16003/untitled.kicad_sch create mode 100644 qa/data/eeschema/netlists/issue16003/untitled2.kicad_sch delete mode 100644 qa/tests/eeschema/test_netlists.cpp diff --git a/qa/data/eeschema/netlists/issue16003/issue16003.kicad_sch b/qa/data/eeschema/netlists/issue16003/issue16003.kicad_sch new file mode 100644 index 0000000000..b92db903ed --- /dev/null +++ b/qa/data/eeschema/netlists/issue16003/issue16003.kicad_sch @@ -0,0 +1,51 @@ +(kicad_sch (version 20230121) (generator eeschema) + + (uuid 35ae03fa-4d60-470c-81b6-ab19e4247678) + + (paper "A4") + + (lib_symbols + ) + + + (sheet (at 121.92 45.72) (size 20.32 17.78) (fields_autoplaced) + (stroke (width 0.1524) (type solid)) + (fill (color 0 0 0 0.0000)) + (uuid ce23ea76-7ff9-468b-89b3-236e2b89d068) + (property "Sheetname" "asdf" (at 121.92 45.0084 0) + (effects (font (size 1.27 1.27)) (justify left bottom)) + ) + (property "Sheetfile" "untitled.kicad_sch" (at 121.92 64.0846 0) + (effects (font (size 1.27 1.27)) (justify left top)) + ) + (property "Field2" "" (at 121.92 45.72 0) + (effects (font (size 1.27 1.27)) hide) + ) + (instances + (project "asdf_labels" + (path "/35ae03fa-4d60-470c-81b6-ab19e4247678" (page "2")) + ) + ) + ) + + (sheet (at 148.59 43.18) (size 22.86 21.59) (fields_autoplaced) + (stroke (width 0.1524) (type solid)) + (fill (color 0 0 0 0.0000)) + (uuid d85d11bb-751a-4c5d-8162-7fc237e76b69) + (property "Sheetname" "Untitled Sheet" (at 148.59 42.4684 0) + (effects (font (size 1.27 1.27)) (justify left bottom)) + ) + (property "Sheetfile" "untitled2.kicad_sch" (at 148.59 65.3546 0) + (effects (font (size 1.27 1.27)) (justify left top)) + ) + (instances + (project "asdf_labels" + (path "/35ae03fa-4d60-470c-81b6-ab19e4247678" (page "3")) + ) + ) + ) + + (sheet_instances + (path "/" (page "1")) + ) +) diff --git a/qa/data/eeschema/netlists/issue16003/issue16003.net b/qa/data/eeschema/netlists/issue16003/issue16003.net new file mode 100644 index 0000000000..4e352815a3 --- /dev/null +++ b/qa/data/eeschema/netlists/issue16003/issue16003.net @@ -0,0 +1,96 @@ +(export (version "E") + (design + (source "/Users/jon.evans/Downloads/2023-10-31T10_22_asdf_labels/asdf_labels.kicad_sch") + (date "2023 October 31, Tuesday 12:32:33") + (tool "Eeschema 7.0.7") + (sheet (number "1") (name "/") (tstamps "/") + (title_block + (title) + (company) + (rev) + (date) + (source "asdf_labels.kicad_sch") + (comment (number "1") (value "")) + (comment (number "2") (value "")) + (comment (number "3") (value "")) + (comment (number "4") (value "")) + (comment (number "5") (value "")) + (comment (number "6") (value "")) + (comment (number "7") (value "")) + (comment (number "8") (value "")) + (comment (number "9") (value "")))) + (sheet (number "2") (name "/asdf/") (tstamps "/ce23ea76-7ff9-468b-89b3-236e2b89d068/") + (title_block + (title) + (company) + (rev) + (date) + (source "untitled.kicad_sch") + (comment (number "1") (value "")) + (comment (number "2") (value "")) + (comment (number "3") (value "")) + (comment (number "4") (value "")) + (comment (number "5") (value "")) + (comment (number "6") (value "")) + (comment (number "7") (value "")) + (comment (number "8") (value "")) + (comment (number "9") (value "")))) + (sheet (number "3") (name "/Untitled Sheet/") (tstamps "/d85d11bb-751a-4c5d-8162-7fc237e76b69/") + (title_block + (title) + (company) + (rev) + (date) + (source "untitled2.kicad_sch") + (comment (number "1") (value "")) + (comment (number "2") (value "")) + (comment (number "3") (value "")) + (comment (number "4") (value "")) + (comment (number "5") (value "")) + (comment (number "6") (value "")) + (comment (number "7") (value "")) + (comment (number "8") (value "")) + (comment (number "9") (value ""))))) + (components + (comp (ref "R1") + (value "R") + (libsource (lib "Device") (part "R") (description "Resistor")) + (property (name "Sheetname") (value "asdf")) + (property (name "Sheetfile") (value "untitled.kicad_sch")) + (property (name "Field2") (value "")) + (property (name "ki_description") (value "Resistor")) + (property (name "ki_keywords") (value "R res resistor")) + (sheetpath (names "/asdf/") (tstamps "/ce23ea76-7ff9-468b-89b3-236e2b89d068/")) + (tstamps "f3a13820-ca5a-4b6d-979c-c54ca93fbc20")) + (comp (ref "R2") + (value "R") + (libsource (lib "Device") (part "R") (description "Resistor")) + (property (name "Sheetname") (value "Untitled Sheet")) + (property (name "Sheetfile") (value "untitled2.kicad_sch")) + (property (name "ki_description") (value "Resistor")) + (property (name "ki_keywords") (value "R res resistor")) + (sheetpath (names "/Untitled Sheet/") (tstamps "/d85d11bb-751a-4c5d-8162-7fc237e76b69/")) + (tstamps "b558b517-2fa0-4aca-bb82-bdb2b8ee6894"))) + (libparts + (libpart (lib "Device") (part "R") + (description "Resistor") + (docs "~") + (footprints + (fp "R_*")) + (fields + (field (name "Reference") "R") + (field (name "Value") "R") + (field (name "Datasheet") "~")) + (pins + (pin (num "1") (name "") (type "passive")) + (pin (num "2") (name "") (type "passive"))))) + (libraries + (library (logical "Device") + (uri "/Users/jon.evans/Desktop/KiCad 7.0.7/KiCad.app/Contents/SharedSupport/symbols//Device.kicad_sym"))) + (nets + (net (code "1") (name "aaa") + (node (ref "R1") (pin "1") (pintype "passive")) + (node (ref "R2") (pin "1") (pintype "passive"))) + (net (code "2") (name "bbb") + (node (ref "R1") (pin "2") (pintype "passive")) + (node (ref "R2") (pin "2") (pintype "passive"))))) \ No newline at end of file diff --git a/qa/data/eeschema/netlists/issue16003/issue16003_test.net b/qa/data/eeschema/netlists/issue16003/issue16003_test.net new file mode 100644 index 0000000000..882c5dc045 --- /dev/null +++ b/qa/data/eeschema/netlists/issue16003/issue16003_test.net @@ -0,0 +1,105 @@ +(export (version "E") + (design + (source "/Users/jon.evans/src/kicad-arm64/qa/data/eeschema/netlists/issue16003/issue16003.kicad_sch") + (date "2023-10-31T12:56:00-0400") + (tool "Eeschema 7.99.0-3461-gb5d904b45d-dirty") + (sheet (number "1") (name "/") (tstamps "/") + (title_block + (title) + (company) + (rev) + (date) + (source "issue16003.kicad_sch") + (comment (number "1") (value "")) + (comment (number "2") (value "")) + (comment (number "3") (value "")) + (comment (number "4") (value "")) + (comment (number "5") (value "")) + (comment (number "6") (value "")) + (comment (number "7") (value "")) + (comment (number "8") (value "")) + (comment (number "9") (value "")))) + (sheet (number "2") (name "/asdf/") (tstamps "/ce23ea76-7ff9-468b-89b3-236e2b89d068/") + (title_block + (title) + (company) + (rev) + (date) + (source "untitled.kicad_sch") + (comment (number "1") (value "")) + (comment (number "2") (value "")) + (comment (number "3") (value "")) + (comment (number "4") (value "")) + (comment (number "5") (value "")) + (comment (number "6") (value "")) + (comment (number "7") (value "")) + (comment (number "8") (value "")) + (comment (number "9") (value "")))) + (sheet (number "3") (name "/Untitled Sheet/") (tstamps "/d85d11bb-751a-4c5d-8162-7fc237e76b69/") + (title_block + (title) + (company) + (rev) + (date) + (source "untitled2.kicad_sch") + (comment (number "1") (value "")) + (comment (number "2") (value "")) + (comment (number "3") (value "")) + (comment (number "4") (value "")) + (comment (number "5") (value "")) + (comment (number "6") (value "")) + (comment (number "7") (value "")) + (comment (number "8") (value "")) + (comment (number "9") (value ""))))) + (components + (comp (ref "R1") + (value "R") + (fields + (field (name "Footprint")) + (field (name "Datasheet")) + (field (name "Description"))) + (libsource (lib "Device") (part "R") (description "Resistor")) + (property (name "Sheetname") (value "asdf")) + (property (name "Sheetfile") (value "untitled.kicad_sch")) + (property (name "Field2") (value "")) + (property (name "ki_keywords") (value "R res resistor")) + (property (name "ki_fp_filters") (value "R_*")) + (sheetpath (names "/asdf/") (tstamps "/ce23ea76-7ff9-468b-89b3-236e2b89d068/")) + (tstamps "f3a13820-ca5a-4b6d-979c-c54ca93fbc20")) + (comp (ref "R2") + (value "R") + (fields + (field (name "Footprint")) + (field (name "Datasheet")) + (field (name "Description"))) + (libsource (lib "Device") (part "R") (description "Resistor")) + (property (name "Sheetname") (value "Untitled Sheet")) + (property (name "Sheetfile") (value "untitled2.kicad_sch")) + (property (name "ki_keywords") (value "R res resistor")) + (property (name "ki_fp_filters") (value "R_*")) + (sheetpath (names "/Untitled Sheet/") (tstamps "/d85d11bb-751a-4c5d-8162-7fc237e76b69/")) + (tstamps "b558b517-2fa0-4aca-bb82-bdb2b8ee6894"))) + (libparts + (libpart (lib "Device") (part "R") + (description "Resistor") + (docs "~") + (footprints + (fp "R_*")) + (fields + (field (name "Reference") "R") + (field (name "Value") "R") + (field (name "Footprint")) + (field (name "Datasheet") "~") + (field (name "Description") "Resistor")) + (pins + (pin (num "1") (name "") (type "passive")) + (pin (num "2") (name "") (type "passive"))))) + (libraries) + (nets + (net (code "1") (name "/Untitled Sheet/bbb") + (node (ref "R2") (pin "2") (pintype "passive"))) + (net (code "2") (name "/asdf/bbb") + (node (ref "R1") (pin "2") (pintype "passive"))) + (net (code "3") (name "aaa") + (node (ref "R1") (pin "1") (pintype "passive")) + (node (ref "R2") (pin "1") (pintype "passive"))))) \ No newline at end of file diff --git a/qa/data/eeschema/netlists/issue16003/untitled.kicad_sch b/qa/data/eeschema/netlists/issue16003/untitled.kicad_sch new file mode 100644 index 0000000000..1dd43c4be6 --- /dev/null +++ b/qa/data/eeschema/netlists/issue16003/untitled.kicad_sch @@ -0,0 +1,124 @@ +(kicad_sch (version 20230121) (generator eeschema) + + (uuid 353d7b93-4531-47b7-9ce6-9e89ee5284eb) + + (paper "A4") + + (lib_symbols + (symbol "Device:R" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes) + (property "Reference" "R" (at 2.032 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "R" (at 0 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at -1.778 0 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "R res resistor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Resistor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "R_*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "R_0_1" + (rectangle (start -1.016 -2.54) (end 1.016 2.54) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + ) + (symbol "R_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + ) + + + (wire (pts (xy 177.8 60.96) (xy 190.5 60.96)) + (stroke (width 0) (type default)) + (uuid 21569090-6672-4c92-bf82-4cf9ba0308f1) + ) + (wire (pts (xy 177.8 50.8) (xy 190.5 50.8)) + (stroke (width 0) (type default)) + (uuid 45565432-4159-4837-b8ba-3dba60c76d44) + ) + (wire (pts (xy 177.8 46.99) (xy 190.5 46.99)) + (stroke (width 0) (type default)) + (uuid 9bbb3217-cc24-42a6-8467-5224fe5cd9e3) + ) + (wire (pts (xy 147.32 60.96) (xy 170.18 60.96)) + (stroke (width 0) (type default)) + (uuid df6fcebd-4cb8-4e5b-ac44-3bea88bf18ad) + ) + + (label "bbb" (at 181.61 60.96 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid 59fcf13d-1cff-44c5-9565-ea95800d4f0e) + ) + (label "aaa" (at 149.86 60.96 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid 6b84cfd8-b183-40f5-bace-bcd99786c9bb) + ) + (label "bbb" (at 177.8 50.8 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid a2d8b1bb-2ee8-4775-a1e6-7207766ac256) + ) + (label "aaa" (at 177.8 46.99 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid f240868b-7e8f-4366-90d1-ea069f0af40d) + ) + + (global_label "aaa" (shape input) (at 190.5 46.99 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left)) + (uuid 4412f3be-70f3-4d40-ab97-7340e9580045) + (property "Intersheetrefs" "${INTERSHEET_REFS}" (at 196.9322 46.99 0) + (effects (font (size 1.27 1.27)) (justify left) hide) + ) + ) + (global_label "bbb" (shape input) (at 190.5 50.8 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left)) + (uuid 44eeac8c-1611-4008-95c7-ca0df9ea09c0) + (property "Intersheetrefs" "${INTERSHEET_REFS}" (at 196.9322 50.8 0) + (effects (font (size 1.27 1.27)) (justify left) hide) + ) + ) + + (symbol (lib_id "Device:R") (at 173.99 60.96 90) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid f3a13820-ca5a-4b6d-979c-c54ca93fbc20) + (property "Reference" "R1" (at 173.99 58.928 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "R" (at 173.99 60.96 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 173.99 62.738 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 173.99 60.96 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 13a3a607-7ace-45c3-98ab-0065f92c155c)) + (pin "2" (uuid 661de941-5b81-4841-818a-0db084d5f00f)) + (instances + (project "asdf_labels" + (path "/35ae03fa-4d60-470c-81b6-ab19e4247678/ce23ea76-7ff9-468b-89b3-236e2b89d068" + (reference "R1") (unit 1) + ) + ) + ) + ) +) diff --git a/qa/data/eeschema/netlists/issue16003/untitled2.kicad_sch b/qa/data/eeschema/netlists/issue16003/untitled2.kicad_sch new file mode 100644 index 0000000000..e811a16977 --- /dev/null +++ b/qa/data/eeschema/netlists/issue16003/untitled2.kicad_sch @@ -0,0 +1,127 @@ +(kicad_sch (version 20230121) (generator eeschema) + + (uuid a8581477-7b7f-4675-a63a-26a3beb525ba) + + (paper "A4") + + (lib_symbols + (symbol "Device:R" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes) + (property "Reference" "R" (at 2.032 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "R" (at 0 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at -1.778 0 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "R res resistor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Resistor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "R_*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "R_0_1" + (rectangle (start -1.016 -2.54) (end 1.016 2.54) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + ) + (symbol "R_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + ) + + + (wire (pts (xy 154.94 74.93) (xy 167.64 74.93)) + (stroke (width 0) (type default)) + (uuid bad535fc-3a48-41f4-9657-d070a40f1880) + ) + (wire (pts (xy 124.46 88.9) (xy 147.32 88.9)) + (stroke (width 0) (type default)) + (uuid df070211-11bd-4fd4-bdd1-b20fb26a71c6) + ) + (wire (pts (xy 154.94 78.74) (xy 167.64 78.74)) + (stroke (width 0) (type default)) + (uuid e67fc135-1612-4e15-a203-3fe93583d730) + ) + (wire (pts (xy 154.94 88.9) (xy 167.64 88.9)) + (stroke (width 0) (type default)) + (uuid f8e99092-77fb-4d86-8650-b868e535d4ec) + ) + + (label "bbb" (at 158.75 88.9 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid 019d0382-ecbf-4645-8c66-9e8a7fca893e) + ) + (label "bbb" (at 154.94 78.74 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid 2e6d0dc9-6417-49ba-8ff8-fa332865a30f) + ) + (label "aaa" (at 154.94 74.93 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid 81c8f8d7-86cb-40fc-8116-f0e4715c45c2) + ) + (label "aaa" (at 127 88.9 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid cf4b09d4-aac0-4e7d-8ccf-5a80d548bf2c) + ) + + (global_label "bbb" (shape input) (at 167.64 78.74 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left)) + (uuid a0db61d4-a4ae-45d3-9cde-42cd81470af2) + (property "Intersheetrefs" "${INTERSHEET_REFS}" (at 174.0722 78.74 0) + (effects (font (size 1.27 1.27)) (justify left) hide) + ) + ) + (global_label "aaa" (shape input) (at 167.64 74.93 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left)) + (uuid bf9090ad-ee31-447a-a859-42537efe8906) + (property "Intersheetrefs" "${INTERSHEET_REFS}" (at 174.0722 74.93 0) + (effects (font (size 1.27 1.27)) (justify left) hide) + ) + ) + + (symbol (lib_id "Device:R") (at 151.13 88.9 90) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid b558b517-2fa0-4aca-bb82-bdb2b8ee6894) + (property "Reference" "R1" (at 151.13 86.868 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "R" (at 151.13 88.9 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 151.13 90.678 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 151.13 88.9 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 059f9853-06a4-40c4-a7c2-69415e138daa)) + (pin "2" (uuid 7857c4d6-2780-43eb-b8a0-3c5ed8e42275)) + (instances + (project "asdf_labels" + (path "/35ae03fa-4d60-470c-81b6-ab19e4247678/ce23ea76-7ff9-468b-89b3-236e2b89d068" + (reference "R1") (unit 1) + ) + (path "/35ae03fa-4d60-470c-81b6-ab19e4247678/d85d11bb-751a-4c5d-8162-7fc237e76b69" + (reference "R2") (unit 1) + ) + ) + ) + ) +) diff --git a/qa/tests/eeschema/test_netlist_exporter_kicad.cpp b/qa/tests/eeschema/test_netlist_exporter_kicad.cpp index 70c9e66933..0e0903ae62 100644 --- a/qa/tests/eeschema/test_netlist_exporter_kicad.cpp +++ b/qa/tests/eeschema/test_netlist_exporter_kicad.cpp @@ -199,5 +199,10 @@ BOOST_AUTO_TEST_CASE( Issue14818 ) TestNetlist( "issue14818" ); } +BOOST_AUTO_TEST_CASE( Issue16003 ) +{ + TestNetlist( "issue16003" ); +} + BOOST_AUTO_TEST_SUITE_END() diff --git a/qa/tests/eeschema/test_netlists.cpp b/qa/tests/eeschema/test_netlists.cpp deleted file mode 100644 index 681166fecc..0000000000 --- a/qa/tests/eeschema/test_netlists.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include -#include "eeschema_test_utils.h" - -class TEST_NETLIST_EXPORTER_KICAD_FIXTURE : public TEST_NETLIST_EXPORTER_FIXTURE -{ -public: - void CompareNetlists() override - { - NETLIST golden; - NETLIST test; - - { - std::unique_ptr netlistReader( NETLIST_READER::GetNetlistReader( - &golden, getNetlistFileName(), wxEmptyString ) ); - - BOOST_REQUIRE_NO_THROW( netlistReader->LoadNetlist() ); - } - - { - std::unique_ptr netlistReader( NETLIST_READER::GetNetlistReader( - &test, getNetlistFileName( true ), wxEmptyString ) ); - - BOOST_REQUIRE_NO_THROW( netlistReader->LoadNetlist() ); - } - - // Number of components should match - BOOST_REQUIRE_EQUAL( golden.GetCount(), test.GetCount() ); - - for( unsigned i = 0; i < golden.GetCount(); i++ ) - { - COMPONENT* goldenComp = golden.GetComponent( i ); - COMPONENT* refComp = test.GetComponentByReference( goldenComp->GetReference() ); - - // Retrieval by reference - BOOST_REQUIRE_NE( refComp, nullptr ); - - // Retrieval by KIID - KIID_PATH path = goldenComp->GetPath(); - - BOOST_REQUIRE( !goldenComp->GetKIIDs().empty() ); - - path.push_back( goldenComp->GetKIIDs().front() ); - - COMPONENT* pathComp = test.GetComponentByPath( path ); - BOOST_REQUIRE_NE( pathComp, nullptr ); - - // We should have found the same component - BOOST_REQUIRE_EQUAL( refComp->GetReference(), pathComp->GetReference() ); - - // And that component should have the same number of attached nets - BOOST_REQUIRE_EQUAL( goldenComp->GetNetCount(), refComp->GetNetCount() ); - - for( unsigned net = 0; net < goldenComp->GetNetCount(); net++ ) - { - const COMPONENT_NET& goldenNet = goldenComp->GetNet( net ); - const COMPONENT_NET& testNet = refComp->GetNet( net ); - - // The video test has a bunch of unconnected RESERVED pins which cause duplicate - // auto-generated netnames. The connectivity algo disambiguates these with "_n" - // suffixes, but since the algorithm is multi-threaded, which ones get which suffix - // is not deterministic. So skip these. - if( testNet.GetPinFunction().Contains( "RESERVED" ) ) - continue; - - // The two nets at the same index should be identical - BOOST_REQUIRE_EQUAL( goldenNet.GetNetName(), testNet.GetNetName() ); - BOOST_REQUIRE_EQUAL( goldenNet.GetPinName(), testNet.GetPinName() ); - } - } - } -}; - - -BOOST_FIXTURE_TEST_SUITE( Netlists, TEST_NETLIST_EXPORTER_KICAD_FIXTURE ) - - -BOOST_AUTO_TEST_CASE( FindPlugin ) -{ - BOOST_CHECK_NE( m_pi, nullptr ); -} - - -BOOST_AUTO_TEST_CASE( GlobalPromotion ) -{ - doNetlistTest( "test_global_promotion" ); -} - - -BOOST_AUTO_TEST_CASE( GlobalPromotion2 ) -{ - doNetlistTest( "test_global_promotion_2" ); -} - - -BOOST_AUTO_TEST_CASE( Video ) -{ - doNetlistTest( "video" ); -} - - -BOOST_AUTO_TEST_CASE( ComplexHierarchy ) -{ - doNetlistTest( "complex_hierarchy" ); -} - - -BOOST_AUTO_TEST_CASE( WeakVectorBusDisambiguation ) -{ - doNetlistTest( "weak_vector_bus_disambiguation" ); -} - - -BOOST_AUTO_TEST_CASE( BusJunctions ) -{ - doNetlistTest( "bus_junctions" ); -} - - -BOOST_AUTO_TEST_CASE( HierRenaming ) -{ - doNetlistTest( "test_hier_renaming" ); -} - - -BOOST_AUTO_TEST_CASE( NoConnects ) -{ - doNetlistTest( "noconnects" ); -} - - -BOOST_AUTO_TEST_CASE( PrefixBusAlias ) -{ - doNetlistTest( "prefix_bus_alias" ); -} - - -BOOST_AUTO_TEST_CASE( GroupBusMatching ) -{ - doNetlistTest( "group_bus_matching" ); -} - - -BOOST_AUTO_TEST_CASE( TopLevelHierPins ) -{ - doNetlistTest( "top_level_hier_pins" ); -} - - -BOOST_AUTO_TEST_CASE( BusEntries ) -{ - doNetlistTest( "bus_entries" ); -} - -BOOST_AUTO_TEST_CASE( LegacyPower ) -{ - doNetlistTest( "legacy_power" ); -} - -BOOST_AUTO_TEST_CASE( LegacyPower4 ) -{ - doNetlistTest( "legacy_power4" ); -} - -BOOST_AUTO_TEST_CASE( BusConnections ) -{ - doNetlistTest( "bus_connection" ); -} - -BOOST_AUTO_TEST_CASE( Issue14657 ) -{ - doNetlistTest( "issue14657" ); -} - -BOOST_AUTO_TEST_SUITE_END()