gdxrename2.gms : Tests some gdxrename stuff

Description

This test checks various gdxRename behavior.

Contributor: Michael Bussieck, May 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : gdxrename2.gms

$title Simple gdxRename test (GDXRENAME2,SEQ=869)

$onText
This test checks various gdxRename behavior.

Contributor: Michael Bussieck, May 2021
$offText

$onEchoV > c.gms
set p / %e% /;
$offEcho

set map / a.1, b.3, c.2 /;
$hiddencall gams c.gms lo=0 --e="a,b,c" gdx=abc
$libInclude gdxservice -c gdxRename abc.gdx map
$if not errorFree $abort 'no errors expected'

$hiddencall gams c.gms lo=0 --e="1,2,3" gdx=123
$libInclude gdxservice -c gdxRename -reverse=1 123.gdx map
$if not errorFree $abort 'no errors expected'

* Not a 1-1 map
set map2 / a.1, a.3, c.2 /;
$hiddencall gams c.gms lo=0 --e="a,b,c" gdx=abc
$libInclude gdxservice -c gdxRename abc.gdx map2
$if errorFree $abort 'expect errors'
$clearError

* Not a 1-1 map
set map3 / a.1, b.1, c.2 /;
$hiddencall gams c.gms lo=0 --e="a,b,c" gdx=abc
$libInclude gdxservice -c gdxRename abc.gdx map3
$if errorFree $abort 'expect errors'
$clearError

* Renaming UEL "c" already present in GDX file
set map4 / a.1, b.c /;
$hiddencall gams c.gms lo=0 --e="a,b,c" gdx=abc
$libInclude gdxservice -c gdxRename abc.gdx map4
$if errorFree $abort 'expect errors'
$clearError

* Transitive renaming not allowed
set map5 / a.d, d.1 /;
$hiddencall gams c.gms lo=0 --e="a,b,c" gdx=abc
$libInclude gdxservice -c gdxRename abc.gdx map5
$if errorFree $abort 'expect errors'
$clearError

* map not a set
parameter map6 / a.1 1, b.2 2 /;
$hiddencall gams c.gms lo=0 --e="a,b,c" gdx=abc
$libInclude gdxservice -c gdxRename abc.gdx map6
$if errorFree $abort 'expect errors'
$clearError

* map not 2-dimensional
parameter map7 / a.1.1, b.2.2 /;
$hiddencall gams c.gms lo=0 --e="a,b,c" gdx=abc
$libInclude gdxservice -c gdxRename abc.gdx map7
$if errorFree $abort 'expect errors'
$clearError