"Fossies" - the Fresh Open Source Software Archive

Member "asymptote-2.61/tests/types/shadow.asy" (18 Nov 2019, 308 Bytes) of package /linux/misc/asymptote-2.61.src.tgz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 import TestLib;
    2 StartTest("shadow");
    3 int x = 1;
    4 int getX() { return x; }
    5 void setX(int value) { x=value; }
    6 
    7 // Shadow x with another int, but x should still be in memory.
    8 int x = 2;
    9 assert(x==2);
   10 assert(getX()==1);
   11 x = 4;
   12 assert(x==4);
   13 assert(getX()==1);
   14 setX(7);
   15 assert(x==4);
   16 assert(getX()==7);
   17 EndTest();