refact02.gms : Refactor suite test 2

Description

This test is the second one of the refactor suite. It is used to make sure that
a cmex source code refactorization does not change the expected behavior. There
is an expected sequence when using this test:

1. Run this test with command line option "--before=True"
2. Modify and rebuild cmex
3. Run this test without command line option

Contributor: Lutz Westermann, April 2014


Small Model of Type : GAMS


Category : GAMS Test library


Main file : refact02.gms

$title 'Refactor suite test 2' (REFACT02,SEQ=653)

$onText
This test is the second one of the refactor suite. It is used to make sure that
a cmex source code refactorization does not change the expected behavior. There
is an expected sequence when using this test:

1. Run this test with command line option "--before=True"
2. Modify and rebuild cmex
3. Run this test without command line option

Contributor: Lutz Westermann, April 2014
$offText


* Get model that takes some seconds to generate
$call testlib -q nlcode2
$call gams nlcode2 lo=2
$if errorlevel 1 $abort Problem running nlcode2

$ifThen set before
$  call grep elapsed nlcode2.log | tail -1 | cut -f5 -d":" > timeBefore.txt
$else
$  if not exist timeBefore.txt $abort Run with --before=True first to get reference workfiles
$  call grep elapsed nlcode2.log | tail -1 | cut -f5 -d":" > timeAfter.txt
   Scalar before /
$  include timeBefore.txt
   /;
   Scalar after /
$  include timeAfter.txt
   /;
   abort$[abs(before-after)/max(before,after)>0.05] 'Unexpected time difference between before and after:', before, after;
$endIf