card03.gms : Test card operator for scalar symbols

Description

In the past, the card operator did return 0 for scalar symbols when there was
no data statement for that symbol but just an assignment.

Contributor: Lutz Westermann, January 2020


Small Model of Type : GAMS


Category : GAMS Test library


Main file : card03.gms

$title Test card operator for scalar symbols (card03,SEQ=811)

$onText
In the past, the card operator did return 0 for scalar symbols when there was
no data statement for that symbol but just an assignment.

Contributor: Lutz Westermann, January 2020
$offText

$macro assertCard1(x) abort$(card(x)<>1) 'x should have card=1';

Scalar s1 / 1 /, s2; s2 = 1;
assertCard1(s1)
assertCard1(s2)

Variable v1 / up 4 /, v2; v2.lo = 3;
assertCard1(v1)
assertCard1(v2)

Equation e1 / l 4 /, e2; e2.m = 3;
assertCard1(e1)
assertCard1(e2)