mirror of https://github.com/KLayout/klayout.git
Fixed unit tests partially.
This commit is contained in:
parent
fde90c66e1
commit
74b87d536e
|
|
@ -236,73 +236,73 @@ SingleIndexedNetlistModel::top_circuit_count () const
|
|||
size_t
|
||||
SingleIndexedNetlistModel::net_count (const circuit_pair &circuits) const
|
||||
{
|
||||
return circuits.first->net_count ();
|
||||
return circuits.first ? circuits.first->net_count () : 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
SingleIndexedNetlistModel::net_terminal_count (const net_pair &nets) const
|
||||
{
|
||||
return nets.first->terminal_count ();
|
||||
return nets.first ? nets.first->terminal_count () : 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
SingleIndexedNetlistModel::net_subcircuit_pin_count (const net_pair &nets) const
|
||||
{
|
||||
return nets.first->subcircuit_pin_count ();
|
||||
return nets.first ? nets.first->subcircuit_pin_count () : 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
SingleIndexedNetlistModel::net_pin_count (const net_pair &nets) const
|
||||
{
|
||||
return nets.first->pin_count ();
|
||||
return nets.first ? nets.first->pin_count () : 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
SingleIndexedNetlistModel::device_count (const circuit_pair &circuits) const
|
||||
{
|
||||
return circuits.first->device_count ();
|
||||
return circuits.first ? circuits.first->device_count () : 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
SingleIndexedNetlistModel::subcircuit_pin_count (const subcircuit_pair &subcircuits) const
|
||||
{
|
||||
return subcircuits.first->circuit_ref ()->pin_count ();
|
||||
return subcircuits.first ? subcircuits.first->circuit_ref ()->pin_count () : 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
SingleIndexedNetlistModel::pin_count (const circuit_pair &circuits) const
|
||||
{
|
||||
return circuits.first->pin_count ();
|
||||
return circuits.first ? circuits.first->pin_count () : 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
SingleIndexedNetlistModel::subcircuit_count (const circuit_pair &circuits) const
|
||||
{
|
||||
return circuits.first->subcircuit_count ();
|
||||
return circuits.first ? circuits.first->subcircuit_count () : 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
SingleIndexedNetlistModel::child_circuit_count (const circuit_pair &circuits) const
|
||||
{
|
||||
return circuits.first->end_children () - circuits.first->begin_children ();
|
||||
return circuits.first ? (circuits.first->end_children () - circuits.first->begin_children ()) : 0;
|
||||
}
|
||||
|
||||
IndexedNetlistModel::circuit_pair
|
||||
SingleIndexedNetlistModel::parent_of (const net_pair &nets) const
|
||||
{
|
||||
return std::make_pair (nets.first->circuit (), (const db::Circuit *) 0);
|
||||
return std::make_pair (nets.first ? nets.first->circuit () : 0, (const db::Circuit *) 0);
|
||||
}
|
||||
|
||||
IndexedNetlistModel::circuit_pair
|
||||
SingleIndexedNetlistModel::parent_of (const device_pair &devices) const
|
||||
{
|
||||
return std::make_pair (devices.first->circuit (), (const db::Circuit *) 0);
|
||||
return std::make_pair (devices.first ? devices.first->circuit () : 0, (const db::Circuit *) 0);
|
||||
}
|
||||
|
||||
IndexedNetlistModel::circuit_pair
|
||||
SingleIndexedNetlistModel::parent_of (const subcircuit_pair &subcircuits) const
|
||||
{
|
||||
return std::make_pair (subcircuits.first->circuit (), (const db::Circuit *) 0);
|
||||
return std::make_pair (subcircuits.first ? subcircuits.first->circuit () : 0, (const db::Circuit *) 0);
|
||||
}
|
||||
|
||||
std::pair<IndexedNetlistModel::circuit_pair, IndexedNetlistModel::Status>
|
||||
|
|
@ -355,7 +355,29 @@ SingleIndexedNetlistModel::net_subcircuit_pinref_from_index (const net_pair &net
|
|||
IndexedNetlistModel::net_subcircuit_pin_pair
|
||||
SingleIndexedNetlistModel::subcircuit_pinref_from_index (const subcircuit_pair &subcircuits, size_t index) const
|
||||
{
|
||||
return IndexedNetlistModel::net_subcircuit_pin_pair (subcircuits.first->netref_for_pin (index), 0);
|
||||
if (! subcircuits.first) {
|
||||
return IndexedNetlistModel::net_subcircuit_pin_pair (0, 0);
|
||||
}
|
||||
|
||||
std::map<subcircuit_pair, std::vector<net_subcircuit_pin_pair> >::iterator i = m_subcircuit_pins_by_index.find (subcircuits);
|
||||
if (i == m_subcircuit_pins_by_index.end ()) {
|
||||
|
||||
i = m_subcircuit_pins_by_index.insert (std::make_pair (subcircuits, std::vector<net_subcircuit_pin_pair> ())).first;
|
||||
|
||||
std::vector<net_subcircuit_pin_pair> &refs = i->second;
|
||||
const db::Circuit *circuit = subcircuits.first->circuit_ref ();
|
||||
for (db::Circuit::const_pin_iterator p = circuit->begin_pins (); p != circuit->end_pins (); ++p) {
|
||||
const db::NetSubcircuitPinRef *ref = subcircuits.first->netref_for_pin (p->id ());
|
||||
if (! ref) {
|
||||
m_synthetic_pinrefs.push_back (db::NetSubcircuitPinRef (const_cast<db::SubCircuit *> (subcircuits.first), p->id ()));
|
||||
ref = & m_synthetic_pinrefs.back ();
|
||||
}
|
||||
refs.push_back (net_subcircuit_pin_pair (ref, 0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return index < i->second.size () ? i->second [index] : IndexedNetlistModel::net_subcircuit_pin_pair (0, 0);
|
||||
}
|
||||
|
||||
IndexedNetlistModel::net_terminal_pair
|
||||
|
|
|
|||
|
|
@ -198,6 +198,8 @@ private:
|
|||
mutable std::map<pin_pair, size_t> m_pin_index_by_object;
|
||||
mutable std::map<subcircuit_pair, size_t> m_subcircuit_index_by_object;
|
||||
mutable std::map<device_pair, size_t> m_device_index_by_object;
|
||||
mutable std::map<subcircuit_pair, std::vector<net_subcircuit_pin_pair> > m_subcircuit_pins_by_index;
|
||||
mutable std::list<db::NetSubcircuitPinRef> m_synthetic_pinrefs;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1903,7 +1903,10 @@ void
|
|||
CircuitNetDeviceTerminalOthersItemData::do_ensure_children (NetlistBrowserModel *)
|
||||
{
|
||||
if (! m_net_seen) {
|
||||
push_back (new CircuitNetItemData (this, nets_from_device_terminals (dp (), m_tp)));
|
||||
IndexedNetlistModel::net_pair nets = nets_from_device_terminals (dp (), m_tp);
|
||||
if (nets.first || nets.second) {
|
||||
push_back (new CircuitNetItemData (this, nets));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2028,7 +2031,10 @@ void
|
|||
CircuitNetSubCircuitPinOthersItemData::do_ensure_children (NetlistBrowserModel *)
|
||||
{
|
||||
if (! m_net_seen) {
|
||||
push_back (new CircuitNetItemData (this, nets_from_pinrefs (pp ())));
|
||||
IndexedNetlistModel::net_pair nets = nets_from_pinrefs (pp ());
|
||||
if (nets.first || nets.second) {
|
||||
push_back (new CircuitNetItemData (this, nets));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2205,7 +2211,9 @@ void
|
|||
CircuitSubCircuitPinItemData::do_ensure_children (NetlistBrowserModel *)
|
||||
{
|
||||
IndexedNetlistModel::net_pair nets = nets_from_pinrefs (m_pp);
|
||||
push_back (new CircuitNetItemData (this, nets));
|
||||
if (nets.first || nets.second) {
|
||||
push_back (new CircuitNetItemData (this, nets));
|
||||
}
|
||||
}
|
||||
|
||||
QIcon
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ TEST (1)
|
|||
// 5 pins, 5 nets, 0 subcircuits, 4 devices
|
||||
QModelIndex sn_pins = model->index (0, 0, inv2Index);
|
||||
QModelIndex sn_nets = model->index (1, 0, inv2Index);
|
||||
QModelIndex sn_subcircuits = model->index (2, 0, inv2Index);
|
||||
QModelIndex sn_devices = model->index (2, 0, inv2Index);
|
||||
// Pins
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_pins), Qt::UserRole).toString ()), "IN");
|
||||
EXPECT_EQ (model->parent (model->index (0, 0, sn_pins)) == model->parent (model->index (0, 3, sn_pins)), true);
|
||||
|
|
@ -73,22 +73,22 @@ TEST (1)
|
|||
EXPECT_EQ (tl::to_string (model->data (model->index (4, 2, sn_nets), Qt::DisplayRole).toString ()), "$5 (3)");
|
||||
// No Subcircuits
|
||||
// Devices
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_subcircuits), Qt::UserRole).toString ()), "$1|PMOS");
|
||||
EXPECT_EQ (model->parent (model->index (0, 0, sn_subcircuits)) == model->parent (model->index (0, 3, sn_subcircuits)), true);
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_subcircuits), Qt::DisplayRole).toString ()), "PMOS [L=0.25, W=0.95, AS=0.49875, AD=0.26125, PS=2.95, PD=1.5]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, sn_subcircuits), Qt::DisplayRole).toString ()), "$1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, sn_subcircuits), Qt::DisplayRole).toString ()), "PMOS [L=0.25, W=0.95, AS=0.26125, AD=0.49875, PS=1.5, PD=2.95]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 2, sn_subcircuits), Qt::DisplayRole).toString ()), "$2");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (2, 0, sn_subcircuits), Qt::DisplayRole).toString ()), "NMOS [L=0.25, W=0.95, AS=0.49875, AD=0.26125, PS=2.95, PD=1.5]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (2, 2, sn_subcircuits), Qt::DisplayRole).toString ()), "$3");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (3, 0, sn_subcircuits), Qt::DisplayRole).toString ()), "NMOS [L=0.25, W=0.95, AS=0.26125, AD=0.49875, PS=1.5, PD=2.95]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (3, 2, sn_subcircuits), Qt::DisplayRole).toString ()), "$4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_devices), Qt::UserRole).toString ()), "$1|PMOS");
|
||||
EXPECT_EQ (model->parent (model->index (0, 0, sn_devices)) == model->parent (model->index (0, 3, sn_devices)), true);
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_devices), Qt::DisplayRole).toString ()), "PMOS [L=0.25, W=0.95, AS=0.49875, AD=0.26125, PS=2.95, PD=1.5]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, sn_devices), Qt::DisplayRole).toString ()), "$1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, sn_devices), Qt::DisplayRole).toString ()), "PMOS [L=0.25, W=0.95, AS=0.26125, AD=0.49875, PS=1.5, PD=2.95]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 2, sn_devices), Qt::DisplayRole).toString ()), "$2");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (2, 0, sn_devices), Qt::DisplayRole).toString ()), "NMOS [L=0.25, W=0.95, AS=0.49875, AD=0.26125, PS=2.95, PD=1.5]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (2, 2, sn_devices), Qt::DisplayRole).toString ()), "$3");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (3, 0, sn_devices), Qt::DisplayRole).toString ()), "NMOS [L=0.25, W=0.95, AS=0.26125, AD=0.49875, PS=1.5, PD=2.95]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (3, 2, sn_devices), Qt::DisplayRole).toString ()), "$4");
|
||||
|
||||
EXPECT_EQ (model->hasChildren (ringoIndex), true);
|
||||
// 0 pins, 12 nets, 10 subcircuits, 0 devices
|
||||
EXPECT_EQ (model->rowCount (ringoIndex), 2);
|
||||
sn_nets = model->index (0, 0, ringoIndex);
|
||||
sn_subcircuits = model->index (1, 0, ringoIndex);
|
||||
QModelIndex sn_subcircuits = model->index (1, 0, ringoIndex);
|
||||
// Pins
|
||||
// Nets
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_nets), Qt::UserRole).toString ()), "FB");
|
||||
|
|
@ -203,8 +203,8 @@ TEST (1)
|
|||
|
||||
// Subcircuit 1 of RINGO has 5 pins
|
||||
|
||||
QModelIndex ringoSubcircuit1Index = model->index (12, 0, ringoIndex);
|
||||
EXPECT_EQ (model->parent (ringoSubcircuit1Index) == ringoIndex, true);
|
||||
QModelIndex ringoSubcircuit1Index = model->index (0, 0, sn_subcircuits);
|
||||
EXPECT_EQ (model->parent (ringoSubcircuit1Index) == sn_subcircuits, true);
|
||||
EXPECT_EQ (model->hasChildren (ringoSubcircuit1Index), true);
|
||||
EXPECT_EQ (model->rowCount (ringoSubcircuit1Index), 5);
|
||||
|
||||
|
|
@ -219,8 +219,8 @@ TEST (1)
|
|||
|
||||
// Device 1 of INV2 has 3 pins
|
||||
|
||||
QModelIndex inv2Device1Index = model->index (10, 0, inv2Index);
|
||||
EXPECT_EQ (model->parent (inv2Device1Index) == inv2Index, true);
|
||||
QModelIndex inv2Device1Index = model->index (0, 0, sn_devices);
|
||||
EXPECT_EQ (model->parent (inv2Device1Index) == sn_devices, true);
|
||||
EXPECT_EQ (model->hasChildren (inv2Device1Index), true);
|
||||
EXPECT_EQ (model->rowCount (inv2Device1Index), 3);
|
||||
|
||||
|
|
@ -229,8 +229,8 @@ TEST (1)
|
|||
|
||||
QModelIndex inv2Device1GateIndex = model->index (1, 0, inv2Device1Index);
|
||||
EXPECT_EQ (model->parent (inv2Device1GateIndex) == inv2Device1Index, true);
|
||||
EXPECT_EQ (model->hasChildren (inv2Device1GateIndex), false);
|
||||
EXPECT_EQ (model->rowCount (inv2Device1GateIndex), 0);
|
||||
EXPECT_EQ (model->hasChildren (inv2Device1GateIndex), true);
|
||||
EXPECT_EQ (model->rowCount (inv2Device1GateIndex), 1);
|
||||
}
|
||||
|
||||
TEST (2)
|
||||
|
|
@ -244,6 +244,7 @@ TEST (2)
|
|||
EXPECT_EQ (model->hasChildren (QModelIndex ()), true);
|
||||
// two circuits
|
||||
EXPECT_EQ (model->rowCount (QModelIndex ()), 4);
|
||||
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, QModelIndex ()), Qt::UserRole).toString ()), "INV2PAIRX");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, QModelIndex ()), Qt::DisplayRole).toString ()), "- ⇔ INV2PAIRX");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, QModelIndex ()), Qt::DisplayRole).toString ()), "");
|
||||
|
|
@ -261,20 +262,27 @@ TEST (2)
|
|||
|
||||
// INV2 circuit node
|
||||
EXPECT_EQ (model->hasChildren (inv2Index), true);
|
||||
EXPECT_EQ (model->rowCount (inv2Index), 14);
|
||||
EXPECT_EQ (model->rowCount (inv2Index), 3);
|
||||
EXPECT_EQ (model->parent (inv2Index).isValid (), false);
|
||||
|
||||
QModelIndex sn_pins = model->index (0, 0, inv2Index);
|
||||
QModelIndex sn_nets = model->index (1, 0, inv2Index);
|
||||
QModelIndex sn_devices = model->index (2, 0, inv2Index);
|
||||
EXPECT_EQ (model->rowCount (sn_pins), 6);
|
||||
EXPECT_EQ (model->rowCount (sn_nets), 6);
|
||||
EXPECT_EQ (model->rowCount (sn_devices), 2);
|
||||
|
||||
// first of pins in INV2 circuit
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2Index), Qt::UserRole).toString ()), "$0|$0");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2Index), Qt::DisplayRole).toString ()), "$0");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, inv2Index), Qt::DisplayRole).toString ()), "$0");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, inv2Index), Qt::DisplayRole).toString ()), "$0");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_pins), Qt::UserRole).toString ()), "$0|$0");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_pins), Qt::DisplayRole).toString ()), "$0");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, sn_pins), Qt::DisplayRole).toString ()), "$0");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, sn_pins), Qt::DisplayRole).toString ()), "$0");
|
||||
|
||||
// INV2, pin 0 node
|
||||
QModelIndex inv2Pin0Index = model->index (0, 0, inv2Index);
|
||||
QModelIndex inv2Pin0Index = model->index (0, 0, sn_pins);
|
||||
EXPECT_EQ (model->hasChildren (inv2Pin0Index), true);
|
||||
EXPECT_EQ (model->rowCount (inv2Pin0Index), 1);
|
||||
EXPECT_EQ (model->parent (inv2Pin0Index) == inv2Index, true);
|
||||
EXPECT_EQ (model->parent (inv2Pin0Index) == sn_pins, true);
|
||||
|
||||
// INV2, pin 0 has one net node
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2Pin0Index), Qt::UserRole).toString ()), "$1|1");
|
||||
|
|
@ -292,16 +300,16 @@ TEST (2)
|
|||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, inv2Pin0Index), Qt::DisplayRole).toString ()), "<a href='int:net?id=9'>1</a>");
|
||||
|
||||
// first of nets in INV2 circuit
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (6, 0, inv2Index), Qt::UserRole).toString ()), "$1|1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (6, 0, inv2Index), Qt::DisplayRole).toString ()), "$1 ⇔ 1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (6, 2, inv2Index), Qt::DisplayRole).toString ()), "$1 (2)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (6, 3, inv2Index), Qt::DisplayRole).toString ()), "1 (2)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_nets), Qt::UserRole).toString ()), "$1|1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_nets), Qt::DisplayRole).toString ()), "$1 ⇔ 1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, sn_nets), Qt::DisplayRole).toString ()), "$1 (2)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, sn_nets), Qt::DisplayRole).toString ()), "1 (2)");
|
||||
|
||||
// INV2, net 1 node
|
||||
QModelIndex inv2Net0Index = model->index (6, 0, inv2Index);
|
||||
QModelIndex inv2Net0Index = model->index (0, 0, sn_nets);
|
||||
EXPECT_EQ (model->hasChildren (inv2Net0Index), true);
|
||||
EXPECT_EQ (model->rowCount (inv2Net0Index), 2);
|
||||
EXPECT_EQ (model->parent (inv2Net0Index) == inv2Index, true);
|
||||
EXPECT_EQ (model->parent (inv2Net0Index) == sn_nets, true);
|
||||
|
||||
// INV2, net 1 has one pin and one terminal at BULK
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2Net0Index), Qt::UserRole).toString ()), "B|B|PMOS|PMOS|$1|$1");
|
||||
|
|
@ -333,35 +341,38 @@ TEST (2)
|
|||
EXPECT_EQ (model->parent (inv2Net0PinIndex) == inv2Net0Index, true);
|
||||
|
||||
// second of nets in INV2 circuit
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (7, 0, inv2Index), Qt::UserRole).toString ()), "BULK|6");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (7, 0, inv2Index), Qt::DisplayRole).toString ()), "BULK ⇔ 6");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (7, 2, inv2Index), Qt::DisplayRole).toString ()), "BULK (2)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (7, 3, inv2Index), Qt::DisplayRole).toString ()), "6 (2)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, sn_nets), Qt::UserRole).toString ()), "BULK|6");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, sn_nets), Qt::DisplayRole).toString ()), "BULK ⇔ 6");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 2, sn_nets), Qt::DisplayRole).toString ()), "BULK (2)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 3, sn_nets), Qt::DisplayRole).toString ()), "6 (2)");
|
||||
|
||||
// first of devices in INV2 circuit
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (12, 0, inv2Index), Qt::UserRole).toString ()), "$1|$1|PMOS|PMOS");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (12, 0, inv2Index), Qt::DisplayRole).toString ()), "PMOS");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (12, 2, inv2Index), Qt::DisplayRole).toString ()), "$1 / PMOS [L=0.25, W=3.5]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (12, 3, inv2Index), Qt::DisplayRole).toString ()), "$1 / PMOS [L=0.25, W=3.5]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_devices), Qt::UserRole).toString ()), "$1|$1|PMOS|PMOS");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_devices), Qt::DisplayRole).toString ()), "PMOS");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, sn_devices), Qt::DisplayRole).toString ()), "$1 / PMOS [L=0.25, W=3.5]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, sn_devices), Qt::DisplayRole).toString ()), "$1 / PMOS [L=0.25, W=3.5]");
|
||||
|
||||
QModelIndex inv2PairIndex = model->index (2, 0, QModelIndex ());
|
||||
EXPECT_EQ (model->parent (inv2PairIndex).isValid (), false);
|
||||
|
||||
// INV2PAIR circuit node
|
||||
EXPECT_EQ (model->hasChildren (inv2PairIndex), true);
|
||||
EXPECT_EQ (model->rowCount (inv2PairIndex), 18);
|
||||
EXPECT_EQ (model->rowCount (inv2PairIndex), 3);
|
||||
|
||||
sn_pins = model->index (0, 0, inv2PairIndex);
|
||||
sn_nets = model->index (1, 0, inv2PairIndex);
|
||||
|
||||
// first of pins in INV2 circuit
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2PairIndex), Qt::UserRole).toString ()), "$4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2PairIndex), Qt::DisplayRole).toString ()), "- ⇔ $4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, inv2PairIndex), Qt::DisplayRole).toString ()), "");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, inv2PairIndex), Qt::DisplayRole).toString ()), "$4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_pins), Qt::UserRole).toString ()), "$4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_pins), Qt::DisplayRole).toString ()), "- ⇔ $4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, sn_pins), Qt::DisplayRole).toString ()), "");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, sn_pins), Qt::DisplayRole).toString ()), "$4");
|
||||
|
||||
// INV2, pin 0 node
|
||||
QModelIndex inv2PairPin0Index = model->index (0, 0, inv2PairIndex);
|
||||
QModelIndex inv2PairPin0Index = model->index (0, 0, sn_pins);
|
||||
EXPECT_EQ (model->hasChildren (inv2PairPin0Index), true);
|
||||
EXPECT_EQ (model->rowCount (inv2PairPin0Index), 1);
|
||||
EXPECT_EQ (model->parent (inv2PairPin0Index) == inv2PairIndex, true);
|
||||
EXPECT_EQ (model->parent (inv2PairPin0Index) == sn_pins, true);
|
||||
|
||||
// INV2, pin 0 has one net node
|
||||
// The pin isnt't connected to any net, left side because there is no match, right side because the pin isn't connected
|
||||
|
|
@ -371,16 +382,16 @@ TEST (2)
|
|||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, inv2PairPin0Index), Qt::DisplayRole).toString ()), "");
|
||||
|
||||
// first of nets in INV2 circuit
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (8, 0, inv2PairIndex), Qt::UserRole).toString ()), "$4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (8, 0, inv2PairIndex), Qt::DisplayRole).toString ()), "$4 ⇔ -");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (8, 2, inv2PairIndex), Qt::DisplayRole).toString ()), "$4 (3)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (8, 3, inv2PairIndex), Qt::DisplayRole).toString ()), "");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_nets), Qt::UserRole).toString ()), "$4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_nets), Qt::DisplayRole).toString ()), "$4 ⇔ -");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, sn_nets), Qt::DisplayRole).toString ()), "$4 (3)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, sn_nets), Qt::DisplayRole).toString ()), "");
|
||||
|
||||
// This net has only left side which has one pin and two subcircuits
|
||||
QModelIndex inv2PairNet0Index = model->index (8, 0, inv2PairIndex);
|
||||
QModelIndex inv2PairNet0Index = model->index (0, 0, sn_nets);
|
||||
EXPECT_EQ (model->hasChildren (inv2PairNet0Index), true);
|
||||
EXPECT_EQ (model->rowCount (inv2PairNet0Index), 3);
|
||||
EXPECT_EQ (model->parent (inv2PairNet0Index) == inv2PairIndex, true);
|
||||
EXPECT_EQ (model->parent (inv2PairNet0Index) == sn_nets, true);
|
||||
|
||||
// The pin
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2PairNet0Index), Qt::UserRole).toString ()), "");
|
||||
|
|
|
|||
Loading…
Reference in New Issue