set4.gms : set $set with includes

Description


Small Model of Type : GAMS


Category : GAMS Test library


Main file : set4.gms

$title set $set with includes (SET4,SEQ=41)
$set a this is from the main program
$escape =
$onEcho > temp.gms
$setGlobal a this is global a incfile %=system.fn%=
$if NOT '%=a%=' == 'this is from the main program' $error this should be from the main program
$set a this is scoped a incfile %=system.fn%=
$if NOT '%=a%=' == 'this is scoped a incfile %=system.fn%=' $error this is scoped a incfile %=system.fn%=
$setLocal a this is local  a incfile %=system.fn%=
$if NOT '%=a%=' == 'this is local  a incfile %=system.fn%=' $error this is scoped a incfile %=system.fn%=
$show
$offEcho
$escape %

$if NOT '%a%' == 'this is from the main program' $error this should be from the main program
$include temp.gms
$if NOT '%a%' == 'this is from the main program' $error this should be from the main program

$if NOT set       a $error a scoped should be defined
$if     setlocal  a $error a local  should be undefined
$if NOT setglobal a $error a global should be defined

$onEchoV > inc.gms
$set ITEMS %1
$label continue
$shift
$if not x%1==x $set ITEMS %ITEMS%%system.tab%%1
$if not x%1==x $goTo continue
$onEmbeddedCode Python:
items = r'''%ITEMS%'''.split("\t")
if not items == ['a','b','c']:
   raise Exception(f'List {items} is not as expected ["a","b","c"]')
$offEmbeddedCode
$offEcho
$batInclude inc a b c

$show