dumpopt1.gms : Test verbatim dumpOpt

Description

This test ensures correct behavior of the command line parameter dumpopt
in combination with $onVerbatim and $ifThen ... $else ... $endIf.

Contributor: Lutz Westermann, January 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : dumpopt1.gms

$title 'Test verbatim dumpOpt' (DUMPOPT1,SEQ=848)

$ontext
This test ensures correct behavior of the command line parameter dumpopt
in combination with $onVerbatim and $ifThen ... $else ... $endIf.

Contributor: Lutz Westermann, January 2021
$offtext


$onEcho > wantDmp.dmp
$onVerbatim
$ifThen "%MYVAR%"=="1"
$ set A 1

  Display
  $(1)  '1';
  
$elseIf "%MYVAR%"=="2"

$ set B 2

  Display
  $(2)  '2';
  
$else
$ set C 3

  display
  $(3)  '3';

$ log ### SCHALALALALAAA  

$endIf

$if "%MYVAR%"=="1" display '1';
$if "%MYVAR%"=="2" display '2';
$if "%MYVAR%"=="3" display '3';


$ifThen "1"=="0"
Display 'bla';


$endIf

$ifThen %SOMECOMPILETIMEVAR%==0
  %MYVAR%
$endIf

display 'hello';
$onembeddedCode Python:
pass
$offEmbeddedCode

embeddedCode Python:
pass
endEmbeddedCode

file fx;
put fx;
$onPut
xxx
$offPut
$offVerbatim
$offEcho

$onEcho > makeDmp.gms
$if not set MYVAR $set MYVAR 2

$onVerbatim
$ifThen "%MYVAR%"=="1"
$ set A 1

  Display
  $(1) '1';
  
$elseIf "%MYVAR%"=="2"

$ set B 2

  Display
  $(2)  '2';
  
$else
$ set C 3

  display
  $(3)  '3';

$ log ### SCHALALALALAAA  

$endIf

$if "%MYVAR%"=="1" display '1';
$if "%MYVAR%"=="2" display '2';
$if "%MYVAR%"=="3" display '3';


$ifThen "1"=="0"
Display 'bla';


$endIf

$ifThen %SOMECOMPILETIMEVAR%==0
  %MYVAR%
$endIf

display 'hello';
$onembeddedCode Python:
pass
$offEmbeddedCode

embeddedCode Python:
pass
endEmbeddedCode

file fx;
put fx;
$onPut
xxx
$offPut
$offVerbatim
$offEcho

$call.checkErrorLevel gams makeDmp dumpopt=11 lo=%gams.lo%
$call.checkErrorLevel awk "/^.onVerbatim/,/^.offVerbatim/" makeDmp.dmp > haveDmp.dmp
$call.checkErrorLevel diff -bw haveDmp.dmp wantDmp.dmp