Changeset 200fcb3 for tests/swap.cfa
- Timestamp:
- Dec 12, 2018, 9:16:12 AM (6 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/swap.cfa
r3d99498 r200fcb3 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Nov 6 18:01:23201813 // Update Count : 7 212 // Last Modified On : Tue Dec 11 10:17:40 2018 13 // Update Count : 74 14 14 // 15 15 … … 19 19 int main( void ) { 20 20 char c1 = 'a', c2 = 'b'; 21 sout | "char\t\t\t" | c1 | ' ' | c2 | "\t\t\tswap " ;21 sout | "char\t\t\t" | c1 | ' ' | c2 | "\t\t\tswap " | nonl; 22 22 swap( c1, c2 ); 23 sout | '\t' | c1 | ' ' | c2 | endl;23 sout | '\t' | c1 | ' ' | c2; 24 24 25 25 signed int i1 = -1, i2 = -2; 26 sout | "signed int\t\t" | i1 | i2 | "\t\t\tswap " ;26 sout | "signed int\t\t" | i1 | i2 | "\t\t\tswap " | nonl; 27 27 swap( i1, i2 ); 28 sout | '\t' | i1 | i2 | endl;28 sout | '\t' | i1 | i2; 29 29 30 30 unsigned int ui1 = 1, ui2 = 2; 31 sout | "unsigned int\t\t" | ui1 | ui2 | "\t\t\tswap " ;31 sout | "unsigned int\t\t" | ui1 | ui2 | "\t\t\tswap " | nonl; 32 32 swap( ui1, ui2 ); 33 sout | '\t' | ui1 | ui2 | endl;33 sout | '\t' | ui1 | ui2; 34 34 35 35 signed long int li1 = -1, li2 = -2; 36 sout | "signed long int\t\t" | li1 | li2 | "\t\t\tswap " ;36 sout | "signed long int\t\t" | li1 | li2 | "\t\t\tswap " | nonl; 37 37 swap( li1, li2 ); 38 sout | '\t' | li1 | li2 | endl;38 sout | '\t' | li1 | li2; 39 39 40 40 unsigned long int uli1 = 1, uli2 = 2; 41 sout | "unsigned long int\t" | uli1 | uli2 | "\t\t\tswap " ;41 sout | "unsigned long int\t" | uli1 | uli2 | "\t\t\tswap " | nonl; 42 42 swap( uli1, uli2 ); 43 sout | '\t' | uli1 | uli2 | endl;43 sout | '\t' | uli1 | uli2; 44 44 45 45 signed long long int lli1 = -1, lli2 = -2; 46 sout | "signed long long int\t" | lli1 | lli2 | "\t\t\tswap " ;46 sout | "signed long long int\t" | lli1 | lli2 | "\t\t\tswap " | nonl; 47 47 swap( lli1, lli2 ); 48 sout | '\t' | lli1 | lli2 | endl;48 sout | '\t' | lli1 | lli2; 49 49 50 50 unsigned long long int ulli1 = 1, ulli2 = 2; 51 sout | "unsigned long long int\t" | ulli1 | ulli2 | "\t\t\tswap " ;51 sout | "unsigned long long int\t" | ulli1 | ulli2 | "\t\t\tswap " | nonl; 52 52 swap( ulli1, ulli2 ); 53 sout | '\t' | ulli1 | ulli2 | endl;53 sout | '\t' | ulli1 | ulli2; 54 54 55 55 float f1 = 1.5, f2 = 2.5; 56 sout | "float\t\t\t" | f1 | f2 | "\t\t\tswap " ;56 sout | "float\t\t\t" | f1 | f2 | "\t\t\tswap " | nonl; 57 57 swap( f1, f2 ); 58 sout | '\t' | f1 | f2 | endl;58 sout | '\t' | f1 | f2; 59 59 60 60 double d1 = 1.5, d2 = 2.5; 61 sout | "double\t\t\t" | d1 | d2 | "\t\t\tswap " ;61 sout | "double\t\t\t" | d1 | d2 | "\t\t\tswap " | nonl; 62 62 swap( d1, d2 ); 63 sout | '\t' | d1 | d2 | endl;63 sout | '\t' | d1 | d2; 64 64 65 65 long double ld1 = 1.5, ld2 = 2.5; 66 sout | "long double\t\t" | ld1 | ld2 | "\t\t\tswap " ;66 sout | "long double\t\t" | ld1 | ld2 | "\t\t\tswap " | nonl; 67 67 swap( ld1, ld2 ); 68 sout | '\t' | ld1 | ld2 | endl;68 sout | '\t' | ld1 | ld2; 69 69 70 70 float _Complex fc1 = 1.5f+1.5if, fc2 = 2.5f+2.5if; 71 sout | "float _Complex\t\t" | fc1 | fc2 | "\tswap " ;71 sout | "float _Complex\t\t" | fc1 | fc2 | "\tswap " | nonl; 72 72 swap( fc1, fc2 ); 73 sout | '\t' | fc1 | fc2 | endl;73 sout | '\t' | fc1 | fc2; 74 74 75 75 double _Complex dc1 = 1.5d+1.5id, dc2 = 2.5d+2.5id; 76 sout | "double _Complex\t\t" | dc1 | dc2 | "\tswap " ;76 sout | "double _Complex\t\t" | dc1 | dc2 | "\tswap " | nonl; 77 77 swap( dc1, dc2 ); 78 sout | '\t' | dc1 | dc2 | endl;78 sout | '\t' | dc1 | dc2; 79 79 80 80 long double _Complex ldc1 = 1.5d+1.5il, ldc2 = 2.5d+2.5il; 81 sout | "long double _Complex\t" | ldc1 | ldc2 | "\tswap " ;81 sout | "long double _Complex\t" | ldc1 | ldc2 | "\tswap " | nonl; 82 82 swap( ldc1, ldc2 ); 83 sout | '\t' | ldc1 | ldc2 | endl;83 sout | '\t' | ldc1 | ldc2; 84 84 85 85 struct S { int i, j; } s1 = { 1, 2 }, s2 = { 2, 1 }; 86 86 ofstream & ?|?( ofstream & os, S s ) { return os | s.i | s.j; } 87 sout | "struct S\t\t" | s1 | "," | s2 | "\t\tswap " ;87 sout | "struct S\t\t" | s1 | "," | s2 | "\t\tswap " | nonl; 88 88 swap( s1, s2 ); 89 sout | '\t' | s1 | "," | s2 | endl;89 sout | '\t' | s1 | "," | s2; 90 90 } // main 91 91
Note: See TracChangeset
for help on using the changeset viewer.