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
$callTool.checkErrorLevel gdxservice.gdxRename abc.gdx map

$hiddenCall gams c.gms lo=0 --e="1,2,3" gdx=123
$callTool.checkErrorLevel gdxservice.gdxRename 123.gdx map reverse=1 

* 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
$callTool gdxservice.gdxRename abc.gdx map2
$if not errorLevel 1 $abort 'expect errors'

* 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
$callTool gdxservice.gdxRename abc.gdx map3
$if not errorLevel 1 $abort 'expect errors'

* 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
$callTool gdxservice.gdxRename abc.gdx map4
$if not errorLevel 1 $abort 'expect errors'

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

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

* map not 2-dimensional
set map7 / a.1.1, b.2.2 /;
$hiddenCall gams c.gms lo=0 --e="a,b,c" gdx=abc
$callTool gdxservice.gdxRename abc.gdx map7
$if not errorLevel 1 $abort 'expect errors'