- Timestamp:
- Jun 8, 2017, 10:22:19 AM (7 years ago)
- 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:
- 8b8152e
- Parents:
- ec95d11
- Location:
- src
- Files:
-
- 1 added
- 1 deleted
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/tests/.expect/io.txt
rec95d11 r5a7966b 4 4 123 5 5 6 x (1 x [2 x {3 x =4 x $5 x £6 x ¥7 x ¡8 x ¿9 x «10 7 1, x 2. x 3; x 4! x 5? x 6% x 7¢ x 8» x 9) x 10] x 11} x 8 x`1`x'2'x"3"x:4:x 5 x 6 x 9 7 10 x 11 8 12 x 13 9 14 x 15 10 16 x 17 x ( 1 ) x 2 , x 3 :x: 4 6 18 A 7 19 1 2 3 4 5 6 7 8 … … 18 30 abc, $xyz 19 31 20 v(27 v[27 v{27 $27 =27 £27 ¥27 ¡27 ¿27 «27 21 25, 25. 25: 25; 25! 25? 25% 25¢ 25» 25) 25] 25} 22 25'27 25`27 25"27 25 27 25 23 27 25 24 27 25 25 27 25 27 25 26 27 32 1, 2, 3, 4 33 1, $2, $3 ", $" 34 1 2 3 " " 35 1 2 3 36 12 3 37 123 38 1 23 39 1 2 3 40 1 2 3 4 " " 41 1, 2, 3, 4 ", " 42 1, 2, 3, 4 27 43 3, 4, a, 7.2 28 44 3, 4, a, 7.2 29 45 3 4 a 7.2 30 3 4 a 7.234a7.2 46 3 4 a 7.234a7.23 4 a 7.2 31 47 3-4-a-7.2^3^4-3-4-a-7.2 -
src/tests/identity.c
rec95d11 r5a7966b 7 7 // identity.c -- 8 8 // 9 // Author : Richard C. Bilson9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Mar 8 22:15:08 201613 // Update Count : 1 312 // Last Modified On : Thu Jun 8 08:21:32 2017 13 // Update Count : 18 14 14 // 15 15 … … 32 32 sout | "double\t\t\t" | identity( 4.1 ) | endl; 33 33 sout | "long double\t\t" | identity( 4.1l ) | endl; 34 sout | "float _Complex\t\t" | identity( -4.1F-2.0iF ) | endl; 35 sout | "double _Complex\t\t" | identity( -4.1D-2.0iD ) | endl; 36 sout | "long double _Complex\t" | identity( -4.1L-2.0iL ) | endl; 34 37 } 35 38 -
src/tests/io.c
rec95d11 r5a7966b 10 10 // Created On : Wed Mar 2 16:56:02 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Mar 21 22:36:06201713 // Update Count : 4812 // Last Modified On : Thu Jun 8 09:52:10 2017 13 // Update Count : 51 14 14 // 15 15 … … 17 17 18 18 int main() { 19 char c; 19 char c; // basic types 20 20 short int si; 21 21 unsigned short int usi; … … 32 32 double _Complex dc; 33 33 long double _Complex ldc; 34 char s1[10], s2[10]; 34 enum { size = 10 }; 35 char s1[size], s2[size]; 35 36 36 37 int x = 3, y = 5, z = 7; … … 41 42 sout | endl; 42 43 43 ifstream in; // create / open file 44 sout 45 // opening delimiters 46 | "x (" | 1 47 | "x [" | 2 48 | "x {" | 3 49 | "x =" | 4 50 | "x $" | 5 51 | "x £" | 6 52 | "x ¥" | 7 53 | "x ¡" | 8 54 | "x ¿" | 9 55 | "x «" | 10 56 | endl; 57 sout 58 // closing delimiters 59 | 1 | ", x" 60 | 2 | ". x" 61 | 3 | "; x" 62 | 4 | "! x" 63 | 5 | "? x" 64 | 6 | "% x" 65 | 7 | "¢ x" 66 | 8 | "» x" 67 | 9 | ") x" 68 | 10 | "] x" 69 | 11 | "} x" 70 | endl; 71 sout 72 // opening-closing delimiters 73 | "x`" | 1 | "`x'" | 2 74 | "'x\"" | 3 | "\"x:" | 4 75 | ":x " | 5 | " x\t" | 6 76 | "\tx\f" | 7 | "\fx\v" | 8 77 | "\vx\n" | 9 | "\nx\r" | 10 78 | "\rx" | 79 endl; 80 sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 | endl; 81 82 ifstream in; // create / open file 44 83 open( &in, "io.data", "r" ); 45 84 46 &in | &c 47 | &si | &usi | &i | &ui | &li | &uli | &lli | &ulli 48 | &f | &d | &ld 49 | &fc | &dc | &ldc 50 | cstr( s1 ) | cstr( s2, 10 );// C string, length unchecked and checked85 &in | &c // character 86 | &si | &usi | &i | &ui | &li | &uli | &lli | &ulli // integral 87 | &f | &d | &ld // floating point 88 | &fc | &dc | &ldc // floating-point complex 89 | cstr( s1 ) | cstr( s2, size ); // C string, length unchecked and checked 51 90 52 sout | c | ' ' | endl 53 | si | usi | i | ui | li | uli | lli | ulli | endl// integral54 | f | d | ld | endl// floating point55 | fc | dc | ldc | endl;// complex91 sout | c | ' ' | endl // character 92 | si | usi | i | ui | li | uli | lli | ulli | endl // integral 93 | f | d | ld | endl // floating point 94 | fc | dc | ldc | endl; // complex 56 95 sout | endl; 57 sout | f | "" | d | "" | ld | endl 58 | sepDisable | fc | dc | ldc | sepEnable | endl// complex without separator59 | sepOn | s1 | sepOff | s2 | endl// local separator removal60 | s1 | "" | s2 | endl;// C string without separator96 sout | f | "" | d | "" | ld | endl // floating point without separator 97 | sepDisable | fc | dc | ldc | sepEnable | endl // complex without separator 98 | sepOn | s1 | sepOff | s2 | endl // local separator removal 99 | s1 | "" | s2 | endl; // C string without separator 61 100 sout | endl; 62 101 63 sepSet( sout, ", $" ); 102 sepSet( sout, ", $" ); // change separator, maximum of 15 characters 64 103 sout | f | d | ld | endl 65 66 104 | fc | dc | ldc | endl 105 | s1 | s2 | endl; 67 106 sout | endl; 107 108 [int, int] t1 = [1, 2], t2 = [3, 4]; 109 sout | t1 | t2 | endl; // print tuple 110 68 111 sepSet( sout, " " ); 112 sepSet( sout, ", $" ); // set separator from " " to ", $" 113 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl; 114 sepSet( sout, " " ); // reset separator to " " 115 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl; 69 116 70 sout 71 // opening delimiters 72 | "v(" | 27 73 | "v[" | 27 74 | "v{" | 27 75 | "$" | 27 76 | "=" | 27 77 | "£" | 27 78 | "¥" | 27 79 | "¡" | 27 80 | "¿" | 27 81 | "«" | 27 82 | endl 83 // closing delimiters 84 | 25 | "," 85 | 25 | "." 86 | 25 | ":" 87 | 25 | ";" 88 | 25 | "!" 89 | 25 | "?" 90 | 25 | "%" 91 | 25 | "¢" 92 | 25 | "»" 93 | 25 | ")" 94 | 25 | "]" 95 | 25 | "}" 96 | endl 97 // opening-closing delimiters 98 | 25 | "'" | 27 99 | 25 | "`" | 27 100 | 25 | "\"" | 27 101 | 25 | " " | 27 102 | 25 | "\f" | 27 103 | 25 | "\n" | 27 104 | 25 | "\r" | 27 105 | 25 | "\t" | 27 106 | 25 | "\v" | 27 107 | endl; 117 sout | sepOn | 1 | 2 | 3 | sepOn | endl; // separator at start of line 118 sout | 1 | sepOff | 2 | 3 | endl; // locally turn off implicit separator 108 119 109 [int, int, const char *, double] t = { 3, 4, "a", 7.2 }; 120 sout | sepDisable | 1 | 2 | 3 | endl; // globally turn off implicit separation 121 sout | 1 | sepOn | 2 | 3 | endl; // locally turn on implicit separator 122 sout | sepEnable | 1 | 2 | 3 | endl; // globally turn on implicit separation 123 124 sepSetTuple( sout, " " ); // set tuple separator from ", " to " " 125 sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl; 126 sepSetTuple( sout, ", " ); // reset tuple separator to ", " 127 sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl; 128 129 sout | t1 | t2 | endl; // print tuple 130 131 [int, int, const char *, double] t3 = { 3, 4, "a", 7.2 }; 110 132 sout | [ 3, 4, "a", 7.2 ] | endl; 111 sout | t | endl;133 sout | t3 | endl; 112 134 sepSetTuple( sout, " " ); 113 sout | t | endl;114 sout | sepOn | t | sepDisable | t | sepEnable | t| endl;135 sout | t3 | endl; 136 sout | sepOn | t3 | sepDisable | t3 | sepEnable | t3 | endl; 115 137 sepSet( sout, "^" ); 116 138 sepSetTuple( sout, "-" ); 117 sout | t | 3 | 4 | t| endl;139 sout | t3 | 3 | 4 | t3 | endl; 118 140 } 119 141
Note: See TracChangeset
for help on using the changeset viewer.