Changeset abb04a4 for tests


Ignore:
Timestamp:
Oct 20, 2023, 9:37:11 AM (8 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
278e162, 7b84d3e
Parents:
7619400
Message:

change genericUnion test fromt printf to sout

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/genericUnion.cfa

    r7619400 rabb04a4  
    1010// Created On       : Tue Dec 25 14:42:46 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 25 14:46:33 2018
    13 // Update Count     : 2
     12// Last Modified On : Fri Oct 20 09:13:26 2023
     13// Update Count     : 15
    1414//
    1515
     16#include <fstream.hfa>
    1617#include <limits.hfa>
    1718
    18 forall(T)
     19forall( T )
    1920union ByteView {
    2021        T val;
     
    2324
    2425forall(T)
    25 void print(ByteView(T) x) {
    26         for (int i = 0; i < sizeof(int); i++) {                         // want to change to sizeof(T)
    27                 printf("%02x", x.bytes[i] & 0xff);
     26void print( ByteView(T) x ) {
     27        for ( i; sizeof(int) ) {                                                        // want to change to sizeof(T)
     28                sout | nobase( pad0( wd( 2, hex( x.bytes[i] & 0xff ) ) ) ) | nosep;
    2829        }
    2930}
    3031
    3132forall(T)
    32 void f(ByteView(T) x, T val) {
    33         print(x);
    34         printf(" ");
     33void f( ByteView(T) x, T val ) {
     34        print( x );
     35        sout | " ";
    3536        x.val = val;
    36         print(x);
    37         printf("\n");
     37        print( x );
     38        sout | nl;
    3839}
    3940
    4041int main() {
     42        sout | nlOff;
    4143        ByteView(unsigned) u = { 0 };
    4244        ByteView(int) i = { 0 };
    43         f(u, MAX);
    44         f(i, -1);
     45        f( u, MAX );
     46        f( i, -1 );
    4547}
    4648
Note: See TracChangeset for help on using the changeset viewer.