embrhp02.gms : Test that the ReSHOP embedded handles failure gracefully

Description

Basic test for failure in embeddedCode ReSHOP.
This also tests that the printing goes through the GAMS channels.

Author: Olivier Huber
Date: May 2024


Small Model of Type : GAMS


Category : GAMS Test library


Main file : embrhp02.gms

$title 'Test that the ReSHOP embeddedCode fails gracefully (EMBRHP02,SEQ=956)'
$ontext
Basic test for failure in embeddedCode ReSHOP.
This also tests that the printing goes through the GAMS channels.

Author: Olivier Huber
Date: May 2024
$offtext

variables obj, x;
equations defobj;

defobj.. x =E= obj;

x.lo = 0;

model m / defobj /;

EmbeddedCode ReSHOP:
This is clear syntax error!
endEmbeddedCode

abort$[execerror=0] 'expect execution errors in the above';
execerror = 0;


* EmbeddedCode ReSHOP is only for execution time
* We wrap this in an EC GAMS to catch the error at execution time

EmbeddedCode GAMS:
$onEmbeddedCode ReSHOP:
* This is not allowed
root: min obj x defobj 
$offEmbeddedCode
endEmbeddedCode

abort$[execerror=0] 'expect execution errors in the above';
execerror = 0;