implassign01.gms : Test implicitAssign

Description

Test expected behavior of command line parameter implicitAssign and
dollar control option $on/offImplicitAssign.

Contributor: Michael Bussieck, March 2023


Small Model of Type : GAMS


Category : GAMS Test library


Main file : implassign01.gms

$title 'Test implicitAssign' (IMPLASSIGN01,SEQ=939)

$onText
Test expected behavior of command line parameter implicitAssign and
dollar control option $on/offImplicitAssign.

Contributor: Michael Bussieck, March 2023
$offText


* Normal assignments
$onEcho > test.gms
set i /i1*i10/; parameter p(i);
scalar summe;

$if set IAEXPLICIT $onImplicitAssign
summe = sum(i, p(i));
abort$(summe<>0) 'wrong summe, expect 0', summe;
$offEcho

* By default, this should trigger an error
$call gams test.gms lo=%gams.lo%
$if not errorLevel 1 $abort 'expect error (01)'

* With explicit $onImplicitAssign this should be fine
$call.checkErrorLevel gams test.gms lo=%gams.lo% --IAEXPLICIT=yes

* With CLP implicitAssign=on this should be fine
$call.checkErrorLevel gams test.gms lo=%gams.lo% implicitAssign=on

* With explicit $onImplicitAssign and CLP implicitAssign=on this should be fine
$call.checkErrorLevel gams test.gms lo=%gams.lo% --IAEXPLICIT=yes