Sim QA: Check NGSPICE's LoadNetlist() and Run() status code

This commit is contained in:
Mikolaj Wielgus 2022-08-10 17:53:13 +02:00
parent 5616ef2e7c
commit a1a99b1ec2
2 changed files with 5 additions and 6 deletions

View File

@ -296,12 +296,12 @@ bool NGSPICE::LoadNetlist( const string& aNetlist )
lines.push_back( nullptr ); // sentinel, as requested in ngSpice_Circ description lines.push_back( nullptr ); // sentinel, as requested in ngSpice_Circ description
Command( "remcirc" ); Command( "remcirc" );
m_ngSpice_Circ( lines.data() ); bool success = !m_ngSpice_Circ( lines.data() );
for( auto line : lines ) for( auto line : lines )
free( line ); free( line );
return true; return success;
} }
@ -345,8 +345,7 @@ bool NGSPICE::Command( const string& aCmd )
{ {
LOCALE_IO c_locale; // ngspice works correctly only with C locale LOCALE_IO c_locale; // ngspice works correctly only with C locale
validate(); validate();
m_ngSpice_Command( (char*) aCmd.c_str() ); return !m_ngSpice_Command( (char*) aCmd.c_str() );
return true;
} }

View File

@ -117,8 +117,8 @@ public:
//ngspice->Init(); //ngspice->Init();
ngspice->Command( "set ngbehavior=ps" ); ngspice->Command( "set ngbehavior=ps" );
ngspice->Command( "setseed 1" ); ngspice->Command( "setseed 1" );
ngspice->LoadNetlist( netlist.ToStdString() ); BOOST_REQUIRE( ngspice->LoadNetlist( netlist.ToStdString() ) );
ngspice->Run(); BOOST_REQUIRE( ngspice->Run() );
// We need to make sure that the number of points always the same. // We need to make sure that the number of points always the same.
ngspice->Command( "linearize" ); ngspice->Command( "linearize" );