Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion generics/test/test_Bjt.zen
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@ for package in Bjt.Package.values():
for bjt_type in Bjt.BjtType.values():
for mount in Bjt.Mount.values():
name = "Q_" + str(package) + "_" + str(bjt_type) + "_" + str(mount)
Bjt(name=name, package=package, bjt_type=bjt_type, mount=mount, C=Net("C"), B=Net("B"), E=Net("E"))
Bjt(
name=name,
package=package,
bjt_type=bjt_type,
mount=mount,
C=Net(f"{name}_C"),
B=Net(f"{name}_B"),
E=Net(f"{name}_E"),
)
3 changes: 2 additions & 1 deletion generics/test/test_Diode.zen
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ Diode = Module("../Diode.zen")

for package in Diode.Package.values():
for variant in Diode.Variant.values():
Diode(name="D_{}_{}".format(package, variant), package=package, variant=variant, A=Net("A"), K=Net("K"))
name = "D_{}_{}".format(package, variant)
Diode(name=name, package=package, variant=variant, A=Net(f"{name}_A"), K=Net(f"{name}_K"))
10 changes: 5 additions & 5 deletions generics/test/test_NetTie.zen
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ NetTie(
mount_type="SMD",
pad_size="0.5mm",
pin_count=3,
P1=Net("P1"),
P2=Net("P2"),
P3=Net("P3"),
P1=Net("NT_legacy_P1"),
P2=Net("NT_legacy_P2"),
P3=Net("NT_legacy_P3"),
)

NetTie(
name="NT_legacy_2",
mount_type="SMD_THT",
pad_size="0.3mm",
pin_count=2,
P1=Net("P1"),
P2=Net("P2"),
P1=Net("NT_legacy_2_P1"),
P2=Net("NT_legacy_2_P2"),
)
12 changes: 6 additions & 6 deletions generics/test/test_Value.zen
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ Resistor = Module("../Resistor.zen")
Capacitor = Module("../Capacitor.zen")

# test no tolerance
Resistor(name="R1", value="1kOhm", package="0603", P1=Net("P1"), P2=Net("P2"))
Resistor(name="R1", value="1kOhm", package="0603", P1=Net("R1_P1"), P2=Net("R1_P2"))

# Test prefix
Resistor(name="R2", value="1000Ohm", package="0603", P1=Net("P1"), P2=Net("P2"))
Resistor(name="R2", value="1000Ohm", package="0603", P1=Net("R2_P1"), P2=Net("R2_P2"))

# Test tolerance
Resistor(name="R3", value="1kOhm 1%", package="0603", P1=Net("P1"), P2=Net("P2"))
Resistor(name="R3", value="1kOhm 1%", package="0603", P1=Net("R3_P1"), P2=Net("R3_P2"))

# Test voltage
Resistor(name="R4", value="1kOhm 1%", package="0603", voltage="10V", P1=Net("P1"), P2=Net("P2"))
Resistor(name="R4", value="1kOhm 1%", package="0603", voltage="10V", P1=Net("R4_P1"), P2=Net("R4_P2"))

# Test multiple parameters
Capacitor(name="C1", value="1nF 10%", package="0603", dielectric="X7R", P1=Net("P1"), P2=Net("P2"))
Capacitor(name="C1", value="1nF 10%", package="0603", dielectric="X7R", P1=Net("C1_P1"), P2=Net("C1_P2"))

# Test multiple parameters with prefix
Capacitor(name="C2", value="100nF 10%", package="0603", P1=Net("P1"), P2=Net("P2"))
Capacitor(name="C2", value="100nF 10%", package="0603", P1=Net("C2_P1"), P2=Net("C2_P2"))
2 changes: 1 addition & 1 deletion kicad/test/test_MolexPicoblade.zen
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ SolderWire = Module("../SolderWire.zen")

for wire_size in SolderWire.Size:
name = "SolderWire_" + wire_size.value
SolderWire(name=name, size=wire_size.value, P1=Net("Net1"))
SolderWire(name=name, size=wire_size.value, P1=Net(f"{name}_Net1"))
15 changes: 9 additions & 6 deletions kicad/test/test_PinHeader.zen
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ for orientation in ["Vertical", "Horizontal"]:
for pitch in PinHeader.Pitch.values():
for rows in range(1, 3):
for positions in range(1, 11):
pins = {"Pin_{}".format(n): Net("Net{}".format(n)) for n in range(1, positions * rows + 1)}
pitch_str = str(pitch).replace(".", "_")
pitch_str = pitch.value.replace(".", "_")
pin_prefix = f"P_{orientation}_{pitch_str}_{rows}_{positions}"
pins = {"Pin_{}".format(n): Net(f"{pin_prefix}_net{n}") for n in range(1, positions * rows + 1)}
name = "PinHeader_" + orientation + "_" + pitch_str + "_" + str(positions) + "_" + str(rows)
PinHeader(name=name, pins=positions, rows=rows, orientation=orientation, pitch=pitch, **pins)

# Test SMD configurations for dual row (Vertical_SMD only works with rows=2)
for pitch in PinHeader.Pitch.values():
for positions in range(1, 11):
pins = {"Pin_{}".format(n): Net("Net{}".format(n)) for n in range(1, positions * 2 + 1)}
pitch_str = str(pitch).replace(".", "_")
pitch_str = pitch.value.replace(".", "_")
pin_prefix = f"P_{pitch_str}_{positions}"
pins = {"Pin_{}".format(n): Net(f"{pin_prefix}_net{n}") for n in range(1, positions * 2 + 1)}
name = "PinHeader_Vertical_SMD_" + pitch_str + "_" + str(positions) + "_2"
PinHeader(name=name, pins=positions, rows=2, orientation="Vertical_SMD", pitch=pitch, **pins)

Expand All @@ -24,7 +26,8 @@ for pitch in PinHeader.Pitch.values():
for orientation in ["Vertical_SMD_Pin1Left", "Vertical_SMD_Pin1Right"]:
for pitch in PinHeader.Pitch.values():
for positions in range(2, 11): # Start from 2, not 1
pins = {"Pin_{}".format(n): Net("Net{}".format(n)) for n in range(1, positions + 1)}
pitch_str = str(pitch).replace(".", "_")
pitch_str = pitch.value.replace(".", "_")
pin_prefix = f"P_{orientation}_{pitch_str}_{positions}"
pins = {"Pin_{}".format(n): Net(f"{pin_prefix}_net{n}") for n in range(1, positions + 1)}
name = "PinHeader_" + orientation + "_" + pitch_str + "_" + str(positions) + "_1"
PinHeader(name=name, pins=positions, rows=1, orientation=orientation, pitch=pitch, **pins)
12 changes: 6 additions & 6 deletions kicad/test/test_PinSocket.zen
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ for orientation in PinSocket.Orientation:
for rows in range(1, 3):
for positions in range(1, 11):
orientation_str = orientation.value
pitch_str = pitch.value

pins = {"P{}".format(n): Net("Net{}".format(n)) for n in range(1, positions * rows + 1)}
name = "PinSocket_" + orientation_str + "_" + pitch_str + "_" + str(positions) + "_" + str(rows)
name = name.replace(".", "_")
pitch_str = pitch.value.replace(".", "_")

if orientation_str == "Vertical_SMD" and positions == 1:
# Vertical_SMD with 1 pin is not a valid footprint
continue

PinSocket(name=name, pins=positions, rows=rows, orientation=orientation_str, pitch=pitch_str, **pins)
pin_prefix = f"P_{orientation_str}_{pitch_str}_{rows}_{positions}"
pins = {"P{}".format(n): Net(f"{pin_prefix}_net{n}") for n in range(1, positions * rows + 1)}
name = "PinSocket_" + orientation_str + "_" + pitch_str + "_" + str(positions) + "_" + str(rows)

PinSocket(name=name, pins=positions, rows=rows, orientation=orientation_str, pitch=pitch.value, **pins)
5 changes: 3 additions & 2 deletions kicad/test/test_SolderWire.zen
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ load("../../properties.zen", "Layout")
SolderWire = Module("../SolderWire.zen")

for wire_size in SolderWire.Size:
name = "SolderWire_" + wire_size.value
SolderWire(name=name, size=wire_size.value, P1=Net("Net1"))
size_str = wire_size.value.replace(".", "_")
name = "SolderWire_" + size_str
SolderWire(name=name, size=wire_size.value, P1=Net(f"{size_str}_P1"))
2 changes: 1 addition & 1 deletion kicad/test/test_TagConnect.zen
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ TagConnect = Module("../TagConnect.zen")

for tag_type in TagConnect.TagConnectType:
name = "TagConnect_" + tag_type.value
pins = {"P{}".format(i): Net("P{}".format(i)) for i in range(1, TagConnect.PinCount(tag_type) + 1)}
pins = {"P{}".format(i): Net(f"{tag_type}_P{i}") for i in range(1, TagConnect.PinCount(tag_type) + 1)}
TagConnect(name=name, tag_type=tag_type.value, **pins)