Ignore:
Timestamp:
Mar 7, 2017, 8:29:28 AM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
a7c90d4
Parents:
2988eeb
Message:

add sout prints and adjust char print values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/tupleAssign.c

    r2988eeb r7fe2498  
    99// Author           : Rob Schluntz
    1010// Created On       : Tue Nov 15 17:24:32 2016
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Nov 15 17:27:28 2016
    13 // Update Count     : 3
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Mar  6 21:23:58 2017
     13// Update Count     : 34
    1414//
     15
     16#include <fstream>
    1517
    1618int main() {
     
    2123
    2224                // swap x, y and store the new [x, y] in [u, v] and in z;
    23                 printf("u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z);
     25                printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z );
     26                sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]" | endl;
    2427                z = [u, v] = [x, y] = [y, x];
    25                 printf("u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z);
     28                printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z );
     29                sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]" | endl;
    2630
    2731                // shuffle elements -- v = z.0, z.0 = z.1, z.1 = u, u = v
    2832                [v, z, u] = [z, u, v];
    29                 printf("u=%d v=%d z=[%d, %d]\n", u, v, z);
     33                printf( "u=%d v=%d z=[%d, %d]\n", u, v, z );
     34                sout | "u=" | u | "v=" | v | "z=[" | z | "]" | endl;
    3035
    3136                // multiple assignment with tuple expression on right
    3237                z = [111, 222];
    3338                [u, v] = [123, 456];
    34                 printf("u=%d v=%d z=[%d, %d]\n", u, v, z);
     39                printf( "u=%d v=%d z=[%d, %d]\n", u, v, z );
     40                sout | "u=" | u | "v=" | v | "z=[" | z | "]" | endl;
    3541        }
    36 
    3742        {
    3843                // test mass assignment
     
    4853                // no conversion from X to integral types, so this serves as a santiy
    4954                // check that as long as this compiles, ?=?(_, x) is not generated.
    50                 [t, x, d, i, c, x] = (double)-2153.12;
    51                 printf("d=%lg i=%d c=%d t=[%d, %lg, %d]\n", d, i, (int)c, t);
    52                 [x, c, i, d, x, t] = (double)-2153.12;
    53                 printf("d=%lg i=%d c=%d t=[%d, %lg, %d]\n", d, i, (int)c, t);
     55                [t, x, d, i, c, x] = (double)94.12;
     56                printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, (int)c, t );
     57                sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]" | endl;
     58                [x, c, i, d, x, t] = (double)-94.12;
     59                printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, c, t );
     60                sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]" | endl;
    5461        }
    5562}
Note: See TracChangeset for help on using the changeset viewer.