Changeset 8bf9448 for tests


Ignore:
Timestamp:
Jul 20, 2021, 9:31:37 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
d2260ad
Parents:
f9d8755
Message:

update existing counter test to use new +=/-= prototype

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/counter.cfa

    rf9d8755 r8bf9448  
    1010// Created On       : Thu Feb 22 15:27:00 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:50:23 2018
    13 // Update Count     : 2
     12// Last Modified On : Tue Jul 20 21:25:30 2021
     13// Update Count     : 4
    1414//
     15
     16#include <fstream.hfa>
    1517
    1618// Tests unified increment/decrement builtin functions.
     
    1921struct counter { int x; };
    2022
    21 counter& ?+=?( counter& c, one_t ) { ++c.x; return c; }
    22 
    23 counter& ?-=?( counter& c, one_t ) { --c.x; return c; }
     23counter ?+=?( counter & c, one_t ) { ++c.x; return c; }
     24counter ?-=?( counter & c, one_t ) { --c.x; return c; }
    2425
    2526int main() {
     
    2829    ++c;
    2930    c++;
    30     printf("%d\n", c.x);
     31    sout | "inc" | c.x;
    3132    c -= 1;
    3233    --c;
    3334    c--;
    34     printf("%d\n", c.x);
     35    sout | "dec" | c.x;
    3536}
    3637
Note: See TracChangeset for help on using the changeset viewer.