Skip to content

Commit

Permalink
Sim QA: Add test for Numparam expressions inside .subckt
Browse files Browse the repository at this point in the history
  • Loading branch information
mikwielgus committed Nov 27, 2022
1 parent 71d1940 commit f2fb734
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
13 changes: 13 additions & 0 deletions qa/data/eeschema/spice_netlists/libraries/subckts.lib.spice
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,23 @@ R1 1 2 1K
R1 1 2 1K
.ends


.subckt two_params_short_form_4 1 2 param1=1.1E+1 param2=2.2E+2
R1 1 2 1K
.ends


.subckt NOTHING_5
R1 1 2 1K
.ends


.subckt Numparam_inside_6 1 2

.param a = 10
.param b = 20
.model DIODE D kf={PWR(a,0.25)*b/10}

D1 1 2 DIODE

.ends
9 changes: 8 additions & 1 deletion qa/unittests/eeschema/sim/test_library_spice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE( Subckts )

const std::vector<SIM_LIBRARY::MODEL> models = m_library->GetModels();

BOOST_CHECK_EQUAL( models.size(), 6 );
BOOST_CHECK_EQUAL( models.size(), 7 );

for( int i = 0; i < models.size(); ++i )
{
Expand Down Expand Up @@ -199,6 +199,13 @@ BOOST_AUTO_TEST_CASE( Subckts )
BOOST_CHECK_EQUAL( model.GetParamCount(), 0 );
BOOST_CHECK_EQUAL( model.GetPinCount(), 0 );
break;

case 6:
BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::SUBCKT );
BOOST_CHECK_EQUAL( modelName, "Numparam_inside_6" );
BOOST_CHECK_EQUAL( model.GetParamCount(), 0 );
BOOST_CHECK_EQUAL( model.GetPinCount(), 2 );
break;
}
}
}
Expand Down

0 comments on commit f2fb734

Please sign in to comment.