unload14.gms : Check that unload happens at GDX file closing time

Description

This test checks that

1) GAMS unloads the symbol at the time the GDX is closed, not when $unLoad is processed

2) GAMS unloads with $unLoad and no arguments only symbols known so far, even if the GDX
   file is closed after some more declarations

Contributor: Michael Bussieck, January 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : unload14.gms

$title 'Check that unload happens at GDX file closing time' (UNLOAD14,SEQ=847)

$onText
This test checks that

1) GAMS unloads the symbol at the time the GDX is closed, not when $unLoad is processed

2) GAMS unloads with $unLoad and no arguments only symbols known so far, even if the GDX
   file is closed after some more declarations

Contributor: Michael Bussieck, January 2021
$offText

Set p(*);
$gdxOut p
$unLoad p
Set p(*) / i1, i2 /;
Set q(*);
execute_load 'p', q=p;
abort$(card(q)<>2) 'expect q to hold i1 and i2', q;

$gdxOut p2
$unLoad p
$onMulti
Set p(*) / i3 3, i4 4 /;
execute_load 'p2', q=p;
abort$(card(q)<>4) 'expect q to hold i1, i2, i3, and i4', q;

$gdxOut p3
$unLoad

Set pp(*) / more, stuff /;
$onEcho > expected
SyNr  Type  DomInf Symbol
   1   Set Regular p(*)
   2   Set Regular q(*)
$offEcho
execute.checkErrorLevel 'gdxdump p3.gdx domainInfo > actual';
execute.checkErrorLevel 'diff actual expected > %system.nullFile%';