| 320 | } |
| 321 | |
| 322 | static void fcall_simulate_ssc_tests( lk::invoke_t &cxt ) |
| 323 | { |
| 324 | LK_DOC("simulate_ssc_tests", "Run the base case simulation for the currently active case and generate json files for inputs and outputs for ssc tests. The first parameter contains the folder location for the output json for ssc tests. The second parameter contains a comma delimited list of compute module to generate json for. Errors and warnings are optionally returned in the third parameter. The results in the user interface are not updated by default, but can be via the fourth parameter.", "( string:json_folder, string:compute_modules, [string:messages], [boolean: update UI] ):boolean" ); |
| 325 | cxt.result().assign( 0.0 ); |
| 326 | if ( Case *c = CurrentCase() ) |
| 327 | { |
| 328 | Simulation &bcsim = c->BaseCase(); |
| 329 | bcsim.Clear(); |
| 330 | |
| 331 | // for ssc tests generation |
| 332 | bcsim.m_bSscTestsGeneration = true; |
| 333 | bcsim.m_sSscTestsJSONFolder = cxt.arg(0).as_string().ToStdString(); |
| 334 | // arg(1) contains comma delimeted list of compute modules |
| 335 | auto list = cxt.arg(1).as_string(); |
| 336 | auto as = wxSplit(list, ','); |
| 337 | std::vector<std::string> sa; |
| 338 | for (size_t i = 0; i < as.size(); i++) |
| 339 | sa.push_back(as[i].ToStdString()); |
| 340 | bcsim.m_asSscTestsComputeModules = sa; |
| 341 | |
| 342 | |
| 343 | ExcelExchange &ex = c->ExcelExch(); |
| 344 | if ( ex.Enabled ) |
| 345 | ExcelExchange::RunExcelExchange( ex, c->Values(0), &bcsim ); |
| 346 | |
| 347 | if ( !bcsim.Prepare() ) |
| 348 | { |
| 349 | cxt.result().assign( 0.0 ); |
| 350 | |
| 351 | if( cxt.arg_count() > 2 ) |
| 352 | cxt.arg(2).assign( wxJoin( c->BaseCase().GetAllMessages(), '\n' ) ); |
| 353 | |
| 354 | return; |
| 355 | } |
| 356 | |
| 357 | ScriptSimulationHandler ssh; |
| 358 | cxt.result().assign( bcsim.InvokeWithHandler( &ssh ) ? 1.0 : 0.0 ); |
| 359 | |
| 360 | if( cxt.arg_count() > 2 ) |
| 361 | cxt.arg(2).assign( wxJoin( c->BaseCase().GetAllMessages(), '\n' ) ); |
| 362 | |
| 363 | if ( cxt.arg_count() > 3 && cxt.arg(3).as_boolean() ) |
| 364 | if ( CaseWindow *cw = SamApp::Window()->GetCaseWindow( c ) ) |
| 365 | cw->UpdateResults(); |
| 366 | } |
| 367 | else cxt.error("no active case"); |
| 368 | } |
| 369 | |
| 370 | static void fcall_configuration( lk::invoke_t &cxt ) |
| 371 | { |
nothing calls this directly
no test coverage detected