Changeset 9d6497a
- Timestamp:
- Dec 13, 2018, 12:16:47 PM (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:
- c13ef5db
- Parents:
- 014bb94 (diff), 18cf979 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- tests
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/coroutine/fmtLines.c
r014bb94 r9d6497a 10 10 // Created On : Sun Sep 17 21:56:15 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 11 21:58:49201813 // Update Count : 4 712 // Last Modified On : Wed Dec 12 22:45:36 2018 13 // Update Count : 48 14 14 // 15 15 … … 48 48 void format( Format & fmt ) { 49 49 resume( fmt ); 50 } // prt50 } // format 51 51 52 52 int main() { -
tests/coroutine/prodcons.c
r014bb94 r9d6497a 10 10 // Created On : Mon Sep 18 12:23:39 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 11 21:58:25201813 // Update Count : 5 212 // Last Modified On : Wed Dec 12 23:04:49 2018 13 // Update Count : 53 14 14 // 15 15 … … 24 24 25 25 coroutine Prod { 26 Cons *c;26 Cons & c; 27 27 int N, money, receipt; 28 28 }; … … 30 30 // 1st resume starts here 31 31 for ( i; N ) { // N pairs of values 32 int p1 = random( 100 ); 33 int p2 = random( 100 ); 32 int p1 = random( 100 ), p2 = random( 100 ); 34 33 sout | p1 | " " | p2; 35 int status = delivery( *c, p1, p2 ); 36 sout | " $" | money; 37 sout | status; 34 int status = delivery( c, p1, p2 ); 35 sout | " $" | money | nl | status; 38 36 receipt += 1; 39 37 } 40 stop( *c );38 stop( c ); 41 39 sout | "prod stops"; 42 40 } … … 47 45 } 48 46 void start( Prod & prod, int N, Cons &c ) { 49 prod.N = N; 50 prod.c = &c; 51 prod.receipt = 0; 47 &prod.c = &c; 48 prod.[N, receipt] = [N, 0]; 52 49 resume( prod ); // activate main 53 50 } 54 51 55 52 coroutine Cons { 56 Prod *p;53 Prod & p; 57 54 int p1, p2, status; 58 55 bool done; 59 56 }; 60 57 void ?{}( Cons & cons, Prod & p ) { 61 cons.p = &p; 62 cons.status = 0; 63 cons.done = false; 58 &cons.p = &p; 59 cons.[status, done ] = [0, false]; 64 60 } 65 61 void ^?{}( Cons & cons ) {} … … 68 64 int money = 1, receipt; 69 65 for ( ; ! done; ) { 70 sout | p1 | " " | p2; 71 sout | " $" | money; 66 sout | p1 | " " | p2 | nl | " $" | money; 72 67 status += 1; 73 receipt = payment( *p, money );68 receipt = payment( p, money ); 74 69 sout | " #" | receipt; 75 70 money += 1; … … 78 73 } 79 74 int delivery( Cons & cons, int p1, int p2 ) { 80 cons.p1 = p1; 81 cons.p2 = p2; 75 cons.[p1, p2] = [p1, p2]; 82 76 resume( cons ); // main 1st time, then 83 77 return cons.status; // cons in payment -
tests/io1.cfa
r014bb94 r9d6497a 10 10 // Created On : Wed Mar 2 16:56:02 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 4 21:40:28201813 // Update Count : 1 0612 // Last Modified On : Wed Dec 12 18:23:44 2018 13 // Update Count : 110 14 14 // 15 15 … … 25 25 26 26 sout | "opening delimiters"; 27 sout 28 | "x (" | 1 29 | "x [" | 2 30 | "x {" | 3 31 | "x =" | 4 32 | "x $" | 5 33 | "x £" | 6 34 | "x ¥" | 7 35 | "x ¡" | 8 36 | "x ¿" | 9 37 | "x «" | 10 38 | nl; 27 sout | "x (" | 1 | nonl; 28 sout | "x [" | 2 | nonl; 29 sout | "x {" | 3 | nonl; 30 sout | "x =" | 4 | nonl; 31 sout | "x $" | 5 | nonl; 32 sout | "x £" | 6 | nonl; 33 sout | "x ¥" | 7 | nonl; 34 sout | "x ¡" | 8 | nonl; 35 sout | "x ¿" | 9 | nonl; 36 sout | "x «" | 10; 39 37 40 38 sout | "closing delimiters"; 41 sout 42 | 1 | ", x" 43 | 2 | ". x" 44 | 3 | "; x" 45 | 4 | "! x" 46 | 5 | "? x" 47 | 6 | "% x" 48 | 7 | "¢ x" 49 | 8 | "» x" 50 | 9 | ") x" 51 | 10 | "] x" 52 | 11 | "} x" 53 | nl; 39 sout | 1 | ", x" | nonl; 40 sout | 2 | ". x" | nonl; 41 sout | 3 | "; x" | nonl; 42 sout | 4 | "! x" | nonl; 43 sout | 5 | "? x" | nonl; 44 sout | 6 | "% x" | nonl; 45 sout | 7 | "¢ x" | nonl; 46 sout | 8 | "» x" | nonl; 47 sout | 9 | ") x" | nonl; 48 sout | 10 | "] x" | nonl; 49 sout | 11 | "} x"; 54 50 55 51 sout | "opening/closing delimiters"; 56 sout 57 | "x`" | 1 | "`x'" | 2 58 | "'x\"" | 3 | "\"x:" | 4 59 | ":x " | 5 | " x\t" | 6 60 | "\tx\f" | 7 | "\fx\v" | 8 61 | "\vx\n" | 9 | "\nx\r" | 10 62 | "\rx" 63 | nl; 52 sout | "x`" | 1 | "`x'" | 2 | nonl; 53 sout | "'x\"" | 3 | "\"x:" | 4 | nonl; 54 sout | ":x " | 5 | " x\t" | 6 | nonl; 55 sout | "\tx\f" | 7 | "\fx\v" | 8 | nonl; 56 sout | "\vx\n" | 9 | "\nx\r" | 10 | nonl; 57 sout | "\rx"; 64 58 65 59 sout | "override opening/closing delimiters"; -
tests/io2.cfa
r014bb94 r9d6497a 10 10 // Created On : Wed Mar 2 16:56:02 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 11 21:51:52201813 // Update Count : 1 0912 // Last Modified On : Wed Dec 12 16:19:15 2018 13 // Update Count : 110 14 14 // 15 15 … … 44 44 45 45 sout | "input bacis types"; 46 in | b // boolean47 | c | sc | usc// character48 | si | usi | i | ui | li | uli | lli | ulli// integral49 | f | d | ld// floating point50 | fc | dc | ldc// floating-point complex51 | cstr( s1 ) | cstr( s2, size ); // C string, length unchecked and checked46 in | b; // boolean 47 in | c | sc | usc; // character 48 in | si | usi | i | ui | li | uli | lli | ulli; // integral 49 in | f | d | ld; // floating point 50 in | fc | dc | ldc; // floating-point complex 51 in | cstr( s1 ) | cstr( s2, size ); // C string, length unchecked and checked 52 52 sout | nl; 53 53 54 54 sout | "output basic types"; 55 sout | b | nl// boolean56 | c | ' ' | sc | ' ' | usc | nl// character57 | si | usi | i | ui | li | uli | lli | ulli | nl// integral58 | f | d | ld | nl// floating point59 55 sout | b; // boolean 56 sout | c | ' ' | sc | ' ' | usc; // character 57 sout | si | usi | i | ui | li | uli | lli | ulli; // integral 58 sout | f | d | ld; // floating point 59 sout | fc | dc | ldc; // complex 60 60 sout | nl; 61 61 … … 66 66 67 67 sout | "toggle separator"; 68 sout | f | "" | d | "" | ld | nl// floating point without separator69 | sepDisable | fc | dc | ldc | nl// complex without separator70 | fc | sepOn | dc | ldc | nl// local separator add71 | sepEnable | fc | dc | ldc | nl// complex with separator72 | fc | sepOff | dc | ldc | nl// local separator removal73 | s1 | sepOff | s2 | nl// local separator removal74 68 sout | f | "" | d | "" | ld; // floating point without separator 69 sout | sepDisable | fc | dc | ldc; // complex without separator 70 sout | fc | sepOn | dc | ldc; // local separator add 71 sout | sepEnable | fc | dc | ldc; // complex with separator 72 sout | fc | sepOff | dc | ldc; // local separator removal 73 sout | s1 | sepOff | s2; // local separator removal 74 sout | s1 | "" | s2; // local separator removal 75 75 sout | nl; 76 76 … … 79 79 sepSet( sout, ", $" ); // change separator, maximum of 15 characters 80 80 sout | " to \"" | sep | "\""; 81 sout | f | d | ld | nl82 | fc | dc | ldc | nl83 | s1 | s2 | nl84 81 sout | f | d | ld; 82 sout | fc | dc | ldc; 83 sout | s1 | s2; 84 sout | t1 | t2; // print tuple 85 85 sout | nl; 86 86 sout | "from \"" | sep | "\" " | nonl; 87 87 sepSet( sout, " " ); // restore separator 88 88 sout | "to \"" | sep | "\""; 89 sout | f | d | ld | nl90 | fc | dc | ldc | nl91 | s1 | s2 | nl92 89 sout | f | d | ld; 90 sout | fc | dc | ldc; 91 sout | s1 | s2; 92 sout | t1 | t2; // print tuple 93 93 sout | nl; 94 94 -
tests/math1.cfa
r014bb94 r9d6497a 10 10 // Created On : Fri Apr 22 14:59:21 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 11 10:24:31201813 // Update Count : 8 812 // Last Modified On : Wed Dec 12 16:28:49 2018 13 // Update Count : 89 14 14 // 15 15 … … 22 22 long double l; 23 23 24 sout | "fmod:" | 5.0F % -2.0F | fmod( 5.0F, -2.0F ) | 5.0D % -2.0D | fmod( 5.0D, -2.0D ) | 5.0L % -2.0L | fmod( 5.0L, -2.0L ); 24 sout | "fmod:" | 5.0F % -2.0F | fmod( 5.0F, -2.0F ) | 5.0D % -2.0D | nonl; 25 sout | fmod( 5.0D, -2.0D ) | 5.0L % -2.0L | fmod( 5.0L, -2.0L ); 25 26 sout | "remainder:" | remainder( 2.0F, 3.0F ) | remainder( 2.0D, 3.0D ) | remainder( 2.0L, 3.0L ); 26 27 int quot; … … 38 39 //---------------------- Exponential ---------------------- 39 40 40 sout | "exp:" | exp( 1.0F ) | exp( 1.0D ) | exp( 1.0L ) | exp( 1.0F+1.0FI ) | exp( 1.0D+1.0DI ) | exp( 1.0DL+1.0LI ); 41 sout | "exp:" | exp( 1.0F ) | exp( 1.0D ) | exp( 1.0L ) | nonl; 42 sout | exp( 1.0F+1.0FI ) | exp( 1.0D+1.0DI ) | exp( 1.0DL+1.0LI ); 41 43 sout | "exp2:" | exp2( 1.0F ) | exp2( 1.0D ) | exp2( 1.0L ); 42 44 sout | "expm1:" | expm1( 1.0F ) | expm1( 1.0D ) | expm1( 1.0L ); 43 sout | "pow:" | pow( 1.0F, 1.0F ) | pow( 1.0D, 1.0D ) | pow( 1.0L, 1.0L ) | pow( 1.0F+1.0FI, 1.0F+1.0FI ) | pow( 1.0D+1.0DI, 1.0D+1.0DI ) | pow( 1.5DL+1.5LI, 1.5DL+1.5LI ); 45 sout | "pow:" | pow( 1.0F, 1.0F ) | pow( 1.0D, 1.0D ) | pow( 1.0L, 1.0L ) | nonl; 46 sout | pow( 1.0F+1.0FI, 1.0F+1.0FI ) | pow( 1.0D+1.0DI, 1.0D+1.0DI ) | pow( 1.5DL+1.5LI, 1.5DL+1.5LI ); 44 47 45 48 int b = 4; … … 47 50 b \= e; 48 51 sout | "\\" | b | b \ e; 49 sout | "\\" | 'a' \ 3u | 2 \ 8u | 4 \ 3u | -4 \ 3u | 4 \ -3 | -4 \ -3 | 4.0 \ 2.1 | (1.0f+2.0fi) \ (3.0f+2.0fi); 52 sout | "\\" | 'a' \ 3u | 2 \ 8u | 4 \ 3u | -4 \ 3u | nonl; 53 sout | 4 \ -3 | -4 \ -3 | 4.0 \ 2.1 | (1.0f+2.0fi) \ (3.0f+2.0fi); 50 54 } // main 51 55 -
tests/math2.cfa
r014bb94 r9d6497a 10 10 // Created On : Fri Apr 22 14:59:21 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 4 23:11:12201813 // Update Count : 8 512 // Last Modified On : Wed Dec 12 16:11:35 2018 13 // Update Count : 87 14 14 // 15 15 … … 24 24 //---------------------- Logarithm ---------------------- 25 25 26 sout | "log:" | log( 1.0F ) | log( 1.0D ) | log( 1.0L ) | log( 1.0F+1.0FI ) | log( 1.0D+1.0DI ) | log( 1.0DL+1.0LI ); 26 sout | "log:" | log( 1.0F ) | log( 1.0D ) | log( 1.0L ) | nonl; 27 sout | log( 1.0F+1.0FI ) | log( 1.0D+1.0DI ) | log( 1.0DL+1.0LI ); 27 28 sout | "log2:" | log2( 8.0F ) | log2( 8.0D ) | log2( 8.0L ); 28 29 sout | "log10:" | log10( 100.0F ) | log10( 100.0D ) | log10( 100.0L ); … … 31 32 sout | "logb:" | logb( 8.0F ) | logb( 8.0D ) | logb( 8.0L ); 32 33 33 sout | "sqrt:" | sqrt( 1.0F ) | sqrt( 1.0D ) | sqrt( 1.0L ) | sqrt( 1.0F+1.0FI ) | sqrt( 1.0D+1.0DI ) | sqrt( 1.0DL+1.0LI ); 34 sout | "sqrt:" | sqrt( 1.0F ) | sqrt( 1.0D ) | sqrt( 1.0L ) | nonl; 35 sout | sqrt( 1.0F+1.0FI ) | sqrt( 1.0D+1.0DI ) | sqrt( 1.0DL+1.0LI ); 34 36 sout | "cbrt:" | cbrt( 27.0F ) | cbrt( 27.0D ) | cbrt( 27.0L ); 35 37 sout | "hypot:" | hypot( 1.0F, -1.0F ) | hypot( 1.0D, -1.0D ) | hypot( 1.0L, -1.0L ); … … 37 39 //---------------------- Trigonometric ---------------------- 38 40 39 sout | "sin:" | sin( 1.0F ) | sin( 1.0D ) | sin( 1.0L ) | sin( 1.0F+1.0FI ) | sin( 1.0D+1.0DI ) | sin( 1.0DL+1.0LI ); 40 sout | "cos:" | cos( 1.0F ) | cos( 1.0D ) | cos( 1.0L ) | cos( 1.0F+1.0FI ) | cos( 1.0D+1.0DI ) | cos( 1.0DL+1.0LI ); 41 sout | "tan:" | tan( 1.0F ) | tan( 1.0D ) | tan( 1.0L ) | tan( 1.0F+1.0FI ) | tan( 1.0D+1.0DI ) | tan( 1.0DL+1.0LI ); 42 sout | "asin:" | asin( 1.0F ) | asin( 1.0D ) | asin( 1.0L ) | asin( 1.0F+1.0FI ) | asin( 1.0D+1.0DI ) | asin( 1.0DL+1.0LI ); 43 sout | "acos:" | acos( 1.0F ) | acos( 1.0D ) | acos( 1.0L ) | acos( 1.0F+1.0FI ) | acos( 1.0D+1.0DI ) | acos( 1.0DL+1.0LI ); 44 sout | "atan:" | atan( 1.0F ) | atan( 1.0D ) | atan( 1.0L ) | atan( 1.0F+1.0FI ) | atan( 1.0D+1.0DI ) | atan( 1.0DL+1.0LI ); 41 sout | "sin:" | sin( 1.0F ) | sin( 1.0D ) | sin( 1.0L ) | nonl; 42 sout | sin( 1.0F+1.0FI ) | sin( 1.0D+1.0DI ) | sin( 1.0DL+1.0LI ); 43 sout | "cos:" | cos( 1.0F ) | cos( 1.0D ) | cos( 1.0L ) | nonl; 44 sout | cos( 1.0F+1.0FI ) | cos( 1.0D+1.0DI ) | cos( 1.0DL+1.0LI ); 45 sout | "tan:" | tan( 1.0F ) | tan( 1.0D ) | tan( 1.0L ) | nonl; 46 sout | tan( 1.0F+1.0FI ) | tan( 1.0D+1.0DI ) | tan( 1.0DL+1.0LI ); 47 sout | "asin:" | asin( 1.0F ) | asin( 1.0D ) | asin( 1.0L ) | nonl; 48 sout | asin( 1.0F+1.0FI ) | asin( 1.0D+1.0DI ) | asin( 1.0DL+1.0LI ); 49 sout | "acos:" | acos( 1.0F ) | acos( 1.0D ) | acos( 1.0L ) | nonl; 50 sout | acos( 1.0F+1.0FI ) | acos( 1.0D+1.0DI ) | acos( 1.0DL+1.0LI ); 51 sout | "atan:" | atan( 1.0F ) | atan( 1.0D ) | atan( 1.0L ) | nonl; 52 sout | atan( 1.0F+1.0FI ) | atan( 1.0D+1.0DI ) | atan( 1.0DL+1.0LI ); 45 53 sout | "atan2:" | atan2( 1.0F, 1.0F ) | atan2( 1.0D, 1.0D ) | atan2( 1.0L, 1.0L ) | nonl; 46 54 sout | "atan:" | atan( 1.0F, 1.0F ) | atan( 1.0D, 1.0D ) | atan( 1.0L, 1.0L ); -
tests/math3.cfa
r014bb94 r9d6497a 10 10 // Created On : Fri Apr 22 14:59:21 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 11 10:15:49201813 // Update Count : 8 512 // Last Modified On : Wed Dec 12 16:30:41 2018 13 // Update Count : 86 14 14 // 15 15 … … 24 24 //---------------------- Hyperbolic ---------------------- 25 25 26 sout | "sinh:" | sinh( 1.0F ) | sinh( 1.0D ) | sinh( 1.0L ) | sinh( 1.0F+1.0FI ) | sinh( 1.0D+1.0DI ) | sinh( 1.0DL+1.0LI ); 27 sout | "cosh:" | cosh( 1.0F ) | cosh( 1.0D ) | cosh( 1.0L ) | cosh( 1.0F+1.0FI ) | cosh( 1.0D+1.0DI ) | cosh( 1.0DL+1.0LI ); 28 sout | "tanh:" | tanh( 1.0F ) | tanh( 1.0D ) | tanh( 1.0L ) | tanh( 1.0F+1.0FI ) | tanh( 1.0D+1.0DI ) | tanh( 1.0DL+1.0LI ); 29 sout | "acosh:" | acosh( 1.0F ) | acosh( 1.0D ) | acosh( 1.0L ) | acosh( 1.0F+1.0FI ) | acosh( 1.0D+1.0DI ) | acosh( 1.0DL+1.0LI ); 30 sout | "asinh:" | asinh( 1.0F ) | asinh( 1.0D ) | asinh( 1.0L ) | asinh( 1.0F+1.0FI ) | asinh( 1.0D+1.0DI ) | asinh( 1.0DL+1.0LI ); 31 sout | "atanh:" | atanh( 1.0F ) | atanh( 1.0D ) | atanh( 1.0L ) | atanh( 1.0F+1.0FI ) | atanh( 1.0D+1.0DI ) | atanh( 1.0DL+1.0LI ); 26 sout | "sinh:" | sinh( 1.0F ) | sinh( 1.0D ) | sinh( 1.0L ) | nonl; 27 sout | sinh( 1.0F+1.0FI ) | sinh( 1.0D+1.0DI ) | sinh( 1.0DL+1.0LI ); 28 sout | "cosh:" | cosh( 1.0F ) | cosh( 1.0D ) | cosh( 1.0L ) | nonl; 29 sout | cosh( 1.0F+1.0FI ) | cosh( 1.0D+1.0DI ) | cosh( 1.0DL+1.0LI ); 30 sout | "tanh:" | tanh( 1.0F ) | tanh( 1.0D ) | tanh( 1.0L ) | nonl; 31 sout | tanh( 1.0F+1.0FI ) | tanh( 1.0D+1.0DI ) | tanh( 1.0DL+1.0LI ); 32 sout | "acosh:" | acosh( 1.0F ) | acosh( 1.0D ) | acosh( 1.0L ) | nonl; 33 sout | acosh( 1.0F+1.0FI ) | acosh( 1.0D+1.0DI ) | acosh( 1.0DL+1.0LI ); 34 sout | "asinh:" | asinh( 1.0F ) | asinh( 1.0D ) | asinh( 1.0L ) | nonl; 35 sout | asinh( 1.0F+1.0FI ) | asinh( 1.0D+1.0DI ) | asinh( 1.0DL+1.0LI ); 36 sout | "atanh:" | atanh( 1.0F ) | atanh( 1.0D ) | atanh( 1.0L ) | nonl; 37 sout | atanh( 1.0F+1.0FI ) | atanh( 1.0D+1.0DI ) | atanh( 1.0DL+1.0LI ); 32 38 33 39 //---------------------- Error / Gamma ----------------------
Note: See TracChangeset
for help on using the changeset viewer.