Changeset b05a4eb for src/tests


Ignore:
Timestamp:
Oct 10, 2017, 3:04:33 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
ded5f07
Parents:
228099e
Message:

Update references test

Location:
src/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/tests/.expect/references.txt

    r228099e rb05a4eb  
    2212 12 1
    3312 12 1 1
     413 1 12
     514 14
    46Default constructing a Y
    57Copy constructing a Y
  • src/tests/references.c

    r228099e rb05a4eb  
    3737int * toptr( int & r ) { return &r; }
    3838
     39void changeRef( int & r ) {
     40        r++;
     41}
     42
    3943int main() {
    4044        int x = 123456, *p1 = &x, **p2 = &p1, ***p3 = &p2,
     
    4347        **p3 = &x;                          // change p1
    4448        *p3 = &p1;                          // change p2
    45         int y, z, & ar[3] = { x, y, z };    // initialize array of references
     49        int y = 0, z = 11, & ar[3] = { x, y, z };    // initialize array of references
    4650
    4751        // test that basic reference properties are true - r1 should be an alias for x
     
    5256        // test that functions using basic references work
    5357        printf("%d %d %d %d\n", toref(&x), toref(p1), toptr(r1) == toptr(x), toptr(r1) == &x);
     58
     59        changeRef( x );
     60        changeRef( y );
     61        changeRef( z );
     62        printf("%d %d %d\n", x, y, z);
     63        changeRef( r1 );
     64        printf("%d %d\n", r1, x);
    5465
    5566        // test that reference members are not implicitly constructed/destructed/assigned
Note: See TracChangeset for help on using the changeset viewer.