# encoding: UTF-8 # KLayout Layout Viewer # Copyright (C) 2006-2024 Matthias Koefferlein # # 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 2 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, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA if !$:.member?(File::dirname($0)) $:.push(File::dirname($0)) end load("test_prologue.rb") class DBNetlistDeviceClasses_TestClass < TestBase def test_1_Resistors cls = RBA::DeviceClassResistor::new nl = RBA::Netlist::new nl.add(cls) circuit = RBA::Circuit::new nl.add(circuit) r1 = circuit.create_device(cls, "r1") r1.set_parameter(RBA::DeviceClassResistor::PARAM_R, 1.0) r1.set_parameter(RBA::DeviceClassResistor::PARAM_L, 10.0) r1.set_parameter(RBA::DeviceClassResistor::PARAM_W, 11.0) r1.set_parameter(RBA::DeviceClassResistor::PARAM_A, 12.0) r1.set_parameter(RBA::DeviceClassResistor::PARAM_P, 13.0) r2 = circuit.create_device(cls, "r2") r2.set_parameter("R", 3.0) pin_a = circuit.create_pin ("A") pin_b = circuit.create_pin ("B") n1 = circuit.create_net("n1") circuit.connect_pin(pin_a, n1) r1.connect_terminal(RBA::DeviceClassResistor::TERMINAL_A, n1) n2 = circuit.create_net("n2") r1.connect_terminal(RBA::DeviceClassResistor::TERMINAL_B, n2) r2.connect_terminal(RBA::DeviceClassResistor::TERMINAL_A, n2) n3 = circuit.create_net("n3") r2.connect_terminal(RBA::DeviceClassResistor::TERMINAL_B, n3) circuit.connect_pin(pin_b, n3) assert_equal(nl.to_s, <