Changeset 200fcb3 for tests/sum.cfa
- Timestamp:
- Dec 12, 2018, 9:16:12 AM (5 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 5ebb1368
- Parents:
- 3d99498
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/sum.cfa
r3d99498 r200fcb3 11 11 // Created On : Wed May 27 17:56:53 2015 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Tue Nov 6 18:01:10201814 // Update Count : 28 013 // Last Modified On : Tue Dec 11 21:50:41 2018 14 // Update Count : 285 15 15 // 16 16 … … 56 56 } // for 57 57 sout | "sum from" | low | "to" | High | "is" 58 | sum( size, (unsigned char *)a ) | ", check" | (int)s | endl;58 | sum( size, (unsigned char *)a ) | ", check" | (int)s; 59 59 60 60 int s = 0, a[size], v = low; … … 64 64 } // for 65 65 sout | "sum from" | low | "to" | High | "is" 66 | sum( size, (int *)a ) | ", check" | (int)s | endl;66 | sum( size, (int *)a ) | ", check" | (int)s; 67 67 68 68 float s = 0.0f, a[size], v = low / 10.0f; … … 72 72 } // for 73 73 sout | "sum from" | low / 10.0f | "to" | High / 10.0f | "is" 74 | sum( size, (float *)a ) | ", check" | (float)s | endl;74 | sum( size, (float *)a ) | ", check" | (float)s; 75 75 76 76 double s = 0.0, a[size], v = low / 10.0; … … 80 80 } // for 81 81 sout | "sum from" | low / 10.0 | "to" | High / 10.0 | "is" 82 | sum( size, (double *)a ) | ", check" | (double)s | endl;82 | sum( size, (double *)a ) | ", check" | (double)s; 83 83 84 84 struct S { int i, j; }; … … 93 93 S ?++( S & t ) { S temp = t; t += (S){1}; return temp; } 94 94 ofstream & ?|?( ofstream & os, S v ) { return os | v.i | v.j; } 95 void ?|?( ofstream & os, S v ) { (ofstream)(os | v); if ( getANL( os ) ) nl( os ); } 95 96 96 97 S s = (S){0}, a[size], v = { low, low }; … … 100 101 } // for 101 102 sout | "sum from" | low | "to" | High | "is" 102 | sum( size, (S *)a ) | ", check" | (S)s | endl;103 | sum( size, (S *)a ) | ", check" | (S)s; 103 104 104 105 forall( otype Impl | sumable( Impl ) ) … … 114 115 } // for 115 116 sout | "sum from" | low | "to" | High | "is" 116 | sum( size, gs.x ) | ", check" | (int)s | endl;// add field array in generic type117 | sum( size, gs.x ) | ", check" | (int)s; // add field array in generic type 117 118 delete( gs.x ); 118 119 } // main
Note: See TracChangeset
for help on using the changeset viewer.