gdxconv1.gms : Compare all combinations of GDXCOMPRESS and GDXCONVERT

Description

Diffs gdx files produced with all combinations of GDXCOMPRESS and GDXCONVERT
and checks whether compressed files are smaller than non-compressed

Contributor: Jan-Hendrik Jagla, June 2008


Small Model of Type : GAMS


Category : GAMS Test library


Main file : gdxconv1.gms

$title 'Compare all combinations of GDXCOMPRESS and GDXCONVERT' (GDXCONV1,SEQ=393)

$onText
Diffs gdx files produced with all combinations of GDXCOMPRESS and GDXCONVERT
and checks whether compressed files are smaller than non-compressed

Contributor: Jan-Hendrik Jagla, June 2008
$offText

$call gamslib -q 1
$call gams trnsport lp=soplex gdx=t0.gdx lo=0
$call wc -c t0.gdx | sed s/t.*// > "%gams.scrdir%t0.%gams.scrext%"

scalar t0 size of GDX file t0.gdx /
$include "%gams.scrdir%t0.%gams.scrext%"
/
display t0;

*test for GAMS parameters gdxconvert and gdxcompress
$onEchoV > "%gams.scrdir%test.%gams.scrext%"
$call gams trnsport lp=soplex gdx=t%1.gdx lo=0 GDXCOMPRESS=%2 GDXCONVERT=%3
$if errorlevel 1 $abort 'trnsport run with parameters GDXCOMPRESS=%2 GDXCONVERT=%3 failed'
*$call gdxdump t%1.gdx -V
$call gdxdiff t0.gdx t%1.gdx > %system.nullfile%
$if errorlevel 1 $abort 't0.gdx and t%1.gdx are different
$call wc -c t%1.gdx | sed s/t.*// > "%gams.scrdir%t%1.%gams.scrext%"
scalar t%1 size of GDX file t%1.gdx /
$include "%gams.scrdir%t%1.%gams.scrext%"
/
display t%1
$offEcho

*test for environment variables gdxconvert and gdxcompress
$onEchoV > "%gams.scrdir%test2.%gams.scrext%"
$setEnv GDXCOMPRESS %2
$setEnv GDXCONVERT %3
$call gams trnsport lp=soplex gdx=t%1.gdx lo=0
$if errorlevel 1 $abort 'trnsport run with setenv GDXCOMPRESS=%2 and GDXCONVERT=%3 failed'
*$call gdxdump t%1.gdx -V
$call gdxdiff t0.gdx t%1.gdx > %system.nullfile%
$if errorlevel 1 $abort 't0.gdx and t%1.gdx are different
$call wc -c t%1.gdx | sed s/t.*// > "%gams.scrdir%t%1.%gams.scrext%"
scalar t%1 size of GDX file t%1.gdx /
$include "%gams.scrdir%t%1.%gams.scrext%"
/
display t%1
$offEcho

$if %system.platform% == DEX $goTo asofv7
$if %system.platform% == DAX $goTo asofv7

$setEnv GDXCOMPRESS
$setEnv GDXCONVERT
$batInclude "%gams.scrdir%test.%gams.scrext%"  1 0 v5
$batInclude "%gams.scrdir%test.%gams.scrext%"  2 1 v5
*with GDX version 5 there is no compress, file must have the same size
abort$(t1<>t2)  "wrong file sizes, t1<>t2"
$batInclude "%gams.scrdir%test2.%gams.scrext%"  3 0 v5
$batInclude "%gams.scrdir%test2.%gams.scrext%"  4 1 v5
*with GDX version 5 there is no compress, file must have the same size
abort$(t3<>t4)  "wrong file sizes, t3<>t4"

$label asofv7

$setEnv GDXCOMPRESS
$setEnv GDXCONVERT
$batInclude "%gams.scrdir%test.%gams.scrext%"  9 0 v7
$batInclude "%gams.scrdir%test.%gams.scrext%"  10 1 v7
abort$(t9<=t10)  "wrong file sizes, t9<=t10"
$batInclude "%gams.scrdir%test2.%gams.scrext%"  11 0 v7
$batInclude "%gams.scrdir%test2.%gams.scrext%"  12 1 v7
abort$(t11<=t12)  "wrong file sizes, t11<=t12"