Changes in / [9d6497a:014bb94]


Ignore:
Location:
tests
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • tests/coroutine/fmtLines.c

    r9d6497a r014bb94  
    1010// Created On       : Sun Sep 17 21:56:15 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 12 22:45:36 2018
    13 // Update Count     : 48
     12// Last Modified On : Tue Dec 11 21:58:49 2018
     13// Update Count     : 47
    1414//
    1515
     
    4848void format( Format & fmt ) {
    4949        resume( fmt );
    50 } // format
     50} // prt
    5151
    5252int main() {
  • tests/coroutine/prodcons.c

    r9d6497a r014bb94  
    1010// Created On       : Mon Sep 18 12:23:39 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 12 23:04:49 2018
    13 // Update Count     : 53
     12// Last Modified On : Tue Dec 11 21:58:25 2018
     13// Update Count     : 52
    1414//
    1515
     
    2424
    2525coroutine Prod {
    26         Cons & c;
     26        Cons * c;
    2727        int N, money, receipt;
    2828};
     
    3030        // 1st resume starts here
    3131        for ( i; N ) {                                                                          // N pairs of values
    32                 int p1 = random( 100 ), p2 = random( 100 );
     32                int p1 = random( 100 );
     33                int p2 = random( 100 );
    3334                sout | p1 | " " | p2;
    34                 int status = delivery( c, p1, p2 );
    35                 sout | " $" | money | nl | status;
     35                int status = delivery( *c, p1, p2 );
     36                sout | " $" | money;
     37                sout | status;
    3638                receipt += 1;
    3739        }
    38         stop( c );
     40        stop( *c );
    3941        sout | "prod stops";
    4042}
     
    4547}
    4648void start( Prod & prod, int N, Cons &c ) {
    47         &prod.c = &c;
    48         prod.[N, receipt] = [N, 0];
     49        prod.N = N;
     50        prod.c = &c;
     51        prod.receipt = 0;
    4952        resume( prod );                                                                         // activate main
    5053}
    5154
    5255coroutine Cons {
    53         Prod & p;
     56        Prod * p;
    5457        int p1, p2, status;
    5558        bool done;
    5659};
    5760void ?{}( Cons & cons, Prod & p ) {
    58         &cons.p = &p;
    59         cons.[status, done ] = [0, false];
     61        cons.p = &p;
     62        cons.status = 0;
     63        cons.done = false;
    6064}
    6165void ^?{}( Cons & cons ) {}
     
    6468        int money = 1, receipt;
    6569        for ( ; ! done; ) {
    66                 sout | p1 | " " | p2 | nl | " $" | money;
     70                sout | p1 | " " | p2;
     71                sout | " $" | money;
    6772                status += 1;
    68                 receipt = payment( p, money );
     73                receipt = payment( *p, money );
    6974                sout | " #" | receipt;
    7075                money += 1;
     
    7378}
    7479int delivery( Cons & cons, int p1, int p2 ) {
    75         cons.[p1, p2] = [p1, p2];
     80        cons.p1 = p1;
     81        cons.p2 = p2;
    7682        resume( cons );                                                                         // main 1st time, then
    7783        return cons.status;                                                                     // cons in payment
  • tests/io1.cfa

    r9d6497a r014bb94  
    1010// Created On       : Wed Mar  2 16:56:02 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 12 18:23:44 2018
    13 // Update Count     : 110
     12// Last Modified On : Tue Dec  4 21:40:28 2018
     13// Update Count     : 106
    1414//
    1515
     
    2525
    2626        sout | "opening delimiters";
    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;
     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;
    3739
    3840        sout | "closing delimiters";
    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";
     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;
    5054
    5155        sout | "opening/closing delimiters";
    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";
     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;
    5864
    5965        sout | "override opening/closing delimiters";
  • tests/io2.cfa

    r9d6497a r014bb94  
    1010// Created On       : Wed Mar  2 16:56:02 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 12 16:19:15 2018
    13 // Update Count     : 110
     12// Last Modified On : Tue Dec 11 21:51:52 2018
     13// Update Count     : 109
    1414//
    1515
     
    4444
    4545        sout | "input bacis types";
    46         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
     46        in       | b                                                                                    // boolean
     47                 | c | sc | usc                                                                 // character
     48                 | si | usi | i | ui | li | uli | lli | ulli    // integral
     49                 | f | d | ld                                                                   // floating point
     50                 | fc | dc | ldc                                                                // floating-point complex
     51                 | cstr( s1 ) | cstr( s2, size );                               // C string, length unchecked and checked
    5252        sout | nl;
    5353
    5454        sout | "output basic types";
    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
     55        sout | b | nl                                                                           // boolean
     56                 | c | ' ' | sc | ' ' | usc | nl                                // character
     57                 | si | usi | i | ui | li | uli | lli | ulli | nl // integral
     58                 | f | d | ld | nl                                                              // floating point
     59                | fc | dc | ldc;                                                               // complex
    6060        sout | nl;
    6161
     
    6666
    6767        sout | "toggle separator";
    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
     68        sout | f | "" | d | "" | ld | nl                                        // floating point without separator
     69                 | sepDisable | fc | dc | ldc | nl                              // complex without separator
     70                 | fc | sepOn | dc | ldc | nl                                   // local separator add
     71                 | sepEnable | fc | dc | ldc | nl                               // complex with separator
     72                 | fc | sepOff | dc | ldc | nl                                  // local separator removal
     73                 | s1 | sepOff | s2 | nl                                                // local separator removal
     74                | s1 | "" | s2;                                                                // local separator removal
    7575        sout | nl;
    7676
     
    7979        sepSet( sout, ", $" );                                                          // change separator, maximum of 15 characters
    8080        sout | " to \"" | sep | "\"";
    81         sout | f | d | ld;
    82         sout | fc | dc | ldc;
    83         sout | s1 | s2;
    84         sout | t1 | t2;                                                                         // print tuple
     81        sout | f | d | ld | nl
     82                 | fc | dc | ldc | nl
     83                 | s1 | s2 | nl
     84                | t1 | t2;                                                                             // print tuple
    8585        sout | nl;
    8686        sout | "from \"" | sep | "\" " | nonl;
    8787        sepSet( sout, " " );                                                            // restore separator
    8888        sout | "to \"" | sep | "\"";
    89         sout | f | d | ld;
    90         sout | fc | dc | ldc;
    91         sout | s1 | s2;
    92         sout | t1 | t2;                                                                         // print tuple
     89        sout | f | d | ld | nl
     90                 | fc | dc | ldc | nl
     91                 | s1 | s2 | nl
     92                | t1 | t2;                                                                             // print tuple
    9393        sout | nl;
    9494
  • tests/math1.cfa

    r9d6497a r014bb94  
    1010// Created On       : Fri Apr 22 14:59:21 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 12 16:28:49 2018
    13 // Update Count     : 89
     12// Last Modified On : Tue Dec 11 10:24:31 2018
     13// Update Count     : 88
    1414//
    1515
     
    2222        long double l;
    2323
    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 );
     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 );
    2625        sout | "remainder:" | remainder( 2.0F, 3.0F ) | remainder( 2.0D, 3.0D ) | remainder( 2.0L, 3.0L );
    2726        int quot;
     
    3938        //---------------------- Exponential ----------------------
    4039
    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 );
     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 );
    4341        sout | "exp2:" | exp2( 1.0F ) | exp2( 1.0D ) | exp2( 1.0L );
    4442        sout | "expm1:" | expm1( 1.0F ) | expm1( 1.0D ) | expm1( 1.0L );
    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 );
     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 );
    4744
    4845        int b = 4;
     
    5047    b \= e;
    5148    sout | "\\" | b | b \ e;
    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);
     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);
    5450} // main
    5551
  • tests/math2.cfa

    r9d6497a r014bb94  
    1010// Created On       : Fri Apr 22 14:59:21 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 12 16:11:35 2018
    13 // Update Count     : 87
     12// Last Modified On : Tue Dec  4 23:11:12 2018
     13// Update Count     : 85
    1414//
    1515
     
    2424        //---------------------- Logarithm ----------------------
    2525
    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 );
     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 );
    2827        sout | "log2:" | log2( 8.0F ) | log2( 8.0D ) | log2( 8.0L );
    2928        sout | "log10:" | log10( 100.0F ) | log10( 100.0D ) | log10( 100.0L );
     
    3231        sout | "logb:" | logb( 8.0F ) | logb( 8.0D ) | logb( 8.0L );
    3332
    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 );
     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 );
    3634        sout | "cbrt:" | cbrt( 27.0F ) | cbrt( 27.0D ) | cbrt( 27.0L );
    3735        sout | "hypot:" | hypot( 1.0F, -1.0F ) | hypot( 1.0D, -1.0D ) | hypot( 1.0L, -1.0L );
     
    3937        //---------------------- Trigonometric ----------------------
    4038
    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 );
     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 );
    5345        sout | "atan2:" | atan2( 1.0F, 1.0F ) | atan2( 1.0D, 1.0D ) | atan2( 1.0L, 1.0L ) | nonl;
    5446        sout | "atan:" | atan( 1.0F, 1.0F ) | atan( 1.0D, 1.0D ) | atan( 1.0L, 1.0L );
  • tests/math3.cfa

    r9d6497a r014bb94  
    1010// Created On       : Fri Apr 22 14:59:21 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 12 16:30:41 2018
    13 // Update Count     : 86
     12// Last Modified On : Tue Dec 11 10:15:49 2018
     13// Update Count     : 85
    1414//
    1515
     
    2424        //---------------------- Hyperbolic ----------------------
    2525
    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 );
     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 );
    3832
    3933        //---------------------- Error / Gamma ----------------------
Note: See TracChangeset for help on using the changeset viewer.