Changeset 62d62db for tests


Ignore:
Timestamp:
Jun 12, 2023, 6:06:26 PM (2 years ago)
Author:
caparsons <caparson@…>
Branches:
ast-experimental, master
Children:
e172f42
Parents:
24d6572 (diff), 38e266ca (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.
Message:

Merge branch 'master' into ast-experimental

Location:
tests
Files:
1 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • tests/.expect/copyfile.txt

    r24d6572 r62d62db  
    1010// Created On       : Fri Jun 19 13:44:05 2020
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 19 17:58:03 2020
    13 // Update Count     : 4
     12// Last Modified On : Mon Jun  5 21:20:07 2023
     13// Update Count     : 5
    1414//
    1515
     
    3030                        exit | "Usage" | argv[0] | "[ input-file (default stdin) [ output-file (default stdout) ] ]";
    3131                } // choose
    32         } catch( Open_Failure * ex ; ex->istream == &in ) {
     32        } catch( open_failure * ex ; ex->istream == &in ) {
    3333                exit | "Unable to open input file" | argv[1];
    34         } catch( Open_Failure * ex ; ex->ostream == &out ) {
     34        } catch( open_failure * ex ; ex->ostream == &out ) {
    3535                close( in );                                                                    // optional
    3636                exit | "Unable to open output file" | argv[2];
  • tests/.in/copyfile.txt

    r24d6572 r62d62db  
    1010// Created On       : Fri Jun 19 13:44:05 2020
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 19 17:58:03 2020
    13 // Update Count     : 4
     12// Last Modified On : Mon Jun  5 21:20:07 2023
     13// Update Count     : 5
    1414//
    1515
     
    3030                        exit | "Usage" | argv[0] | "[ input-file (default stdin) [ output-file (default stdout) ] ]";
    3131                } // choose
    32         } catch( Open_Failure * ex ; ex->istream == &in ) {
     32        } catch( open_failure * ex ; ex->istream == &in ) {
    3333                exit | "Unable to open input file" | argv[1];
    34         } catch( Open_Failure * ex ; ex->ostream == &out ) {
     34        } catch( open_failure * ex ; ex->ostream == &out ) {
    3535                close( in );                                                                    // optional
    3636                exit | "Unable to open output file" | argv[2];
  • tests/concurrency/actors/dynamic.cfa

    r24d6572 r62d62db  
    1919void ?{}( derived_msg & this ) { ((derived_msg &)this){ 0 }; }
    2020
    21 Allocation receive( derived_actor & receiver, derived_msg & msg ) {
     21allocation receive( derived_actor & receiver, derived_msg & msg ) {
    2222    if ( msg.cnt >= Times ) {
    2323        sout | "Done";
  • tests/concurrency/actors/executor.cfa

    r24d6572 r62d62db  
    2424struct d_msg { inline message; } shared_msg;
    2525
    26 Allocation receive( d_actor & this, d_msg & msg ) with( this ) {
     26allocation receive( d_actor & this, d_msg & msg ) with( this ) {
    2727    if ( recs == rounds ) return Finished;
    2828    if ( recs % Batch == 0 ) {
  • tests/concurrency/actors/inherit.cfa

    r24d6572 r62d62db  
    1515void ^?{}( D_msg & this ) { mutex(sout) sout | 'A'; }
    1616
    17 Allocation handle() {
     17allocation handle() {
    1818    return Finished;
    1919}
    2020
    21 Allocation receive( Server & receiver, D_msg & msg ) { return handle(); }
    22 Allocation receive( Server & receiver, D_msg2 & msg ) { return handle(); }
    23 Allocation receive( Server2 & receiver, D_msg & msg ) { return Delete; }
    24 Allocation receive( Server2 & receiver, D_msg2 & msg ) { return Delete; }
     21allocation receive( Server & receiver, D_msg & msg ) { return handle(); }
     22allocation receive( Server & receiver, D_msg2 & msg ) { return handle(); }
     23allocation receive( Server2 & receiver, D_msg & msg ) { return Delete; }
     24allocation receive( Server2 & receiver, D_msg2 & msg ) { return Delete; }
    2525
    2626int main() {
  • tests/concurrency/actors/matrix.cfa

    r24d6572 r62d62db  
    2424}
    2525
    26 Allocation receive( derived_actor & receiver, derived_msg & msg ) {
     26allocation receive( derived_actor & receiver, derived_msg & msg ) {
    2727    for ( unsigned int i = 0; i < yc; i += 1 ) { // multiply X_row by Y_col and sum products
    2828        msg.Z[i] = 0;
  • tests/concurrency/actors/pingpong.cfa

    r24d6572 r62d62db  
    1919size_t times = 100000;
    2020
    21 Allocation receive( ping & receiver, p_msg & msg ) {
     21allocation receive( ping & receiver, p_msg & msg ) {
    2222    msg.count++;
    2323    if ( msg.count > times ) return Finished;
    2424
    25     Allocation retval = Nodelete;
     25    allocation retval = Nodelete;
    2626    if ( msg.count == times ) retval = Finished;
    2727    *po << msg;
     
    2929}
    3030
    31 Allocation receive( pong & receiver, p_msg & msg ) {
     31allocation receive( pong & receiver, p_msg & msg ) {
    3232    msg.count++;
    3333    if ( msg.count > times ) return Finished;
    3434   
    35     Allocation retval = Nodelete;
     35    allocation retval = Nodelete;
    3636    if ( msg.count == times ) retval = Finished;
    3737    *pi << msg;
  • tests/concurrency/actors/poison.cfa

    r24d6572 r62d62db  
    1818        Server s[10];
    1919        for ( i; 10 ) {
    20             s[i] << FinishedMsg;
     20            s[i] << finished_msg;
    2121        }
    2222        stop_actor_system();
     
    2929            Server * s = alloc();
    3030            (*s){};
    31             (*s) << DeleteMsg;
     31            (*s) << delete_msg;
    3232        }
    3333        stop_actor_system();
     
    3939        Server s[10];
    4040        for ( i; 10 )
    41             s[i] << DestroyMsg;
     41            s[i] << destroy_msg;
    4242        stop_actor_system();
    4343        for ( i; 10 )
  • tests/concurrency/actors/static.cfa

    r24d6572 r62d62db  
    1919void ?{}( derived_msg & this ) { ((derived_msg &)this){ 0 }; }
    2020
    21 Allocation receive( derived_actor & receiver, derived_msg & msg ) {
     21allocation receive( derived_actor & receiver, derived_msg & msg ) {
    2222    if ( msg.cnt >= Times ) {
    2323        sout | "Done";
  • tests/concurrency/actors/types.cfa

    r24d6572 r62d62db  
    2020
    2121// this isn't a valid receive routine since int is not a message type
    22 Allocation receive( derived_actor & receiver, int i ) with( receiver ) {
     22allocation receive( derived_actor & receiver, int i ) with( receiver ) {
    2323    mutex(sout) sout | i;
    2424    counter++;
     
    2727}
    2828
    29 Allocation receive( derived_actor & receiver, d_msg & msg ) {
     29allocation receive( derived_actor & receiver, d_msg & msg ) {
    3030    return receive( receiver, msg.num );
    3131}
     
    3636};
    3737
    38 Allocation receive( derived_actor2 & receiver, d_msg & msg ) {
     38allocation receive( derived_actor2 & receiver, d_msg & msg ) {
    3939    mutex(sout) sout | msg.num;
    4040    return Finished;
     
    4848};
    4949
    50 Allocation receive( derived_actor3 & receiver, d_msg & msg ) {
     50allocation receive( derived_actor3 & receiver, d_msg & msg ) {
    5151    mutex(sout) sout | msg.num;
    5252    if ( msg.num == -1 ) return Nodelete;
     
    5454}
    5555
    56 Allocation receive( derived_actor3 & receiver, d_msg2 & msg ) {
     56allocation receive( derived_actor3 & receiver, d_msg2 & msg ) {
    5757    mutex(sout) sout | msg.num;
    5858    return Finished;
  • tests/concurrency/lockfree_stack.cfa

    r24d6572 r62d62db  
    1010// Created On       : Thu May 25 15:36:50 2023
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 30 19:02:32 2023
    13 // Update Count     : 18
     12// Last Modified On : Fri Jun  9 14:01:07 2023
     13// Update Count     : 68
    1414//
    1515
     
    2929        int64_t atom;
    3030        #endif // __SIZEOF_INT128__
    31 } __attribute__(( aligned( 16 ) ));
     31};
    3232
    3333struct Node {
     
    4242        n.next = stack;                                                                         // atomic assignment unnecessary
    4343        for () {                                                                                        // busy wait
    44                 if ( CASV( stack.atom, n.next.atom, ((Link){ &n, n.next.count + 1 }.atom) ) ) break; // attempt to update top node
     44                Link temp{ &n, n.next.count + 1 };
     45                if ( CASV( s.stack.atom, n.next.atom, temp.atom ) ) break; // attempt to update top node
    4546        }
    4647}
     
    5051        for () {                                                                                        // busy wait
    5152                if ( t.top == NULL ) return NULL;                               // empty stack ?
    52                 if ( CASV( stack.atom, t.atom, ((Link){ t.top->next.top, t.count }.atom) ) ) return t.top; // attempt to update top node
     53                Link temp{ t.top->next.top, t.count };
     54                if ( CASV( stack.atom, t.atom, temp.atom ) ) return t.top; // attempt to update top node
    5355        }
    5456}
     
    5759Stack stack;                                                                                    // global stack
    5860
    59 enum { Times =
    60         #if defined( __ARM_ARCH )                                                       // ARM CASV is very slow
    61         10_000
    62         #else
    63         1_000_000
    64         #endif // __arm_64__
    65 };
     61enum { Times = 2_000_000 };
    6662
    6763thread Worker {};
     
    8278
    8379        for ( i; N ) {                                                                          // push N values on stack
    84                 // storage must be 16-bytes aligned for cmpxchg16b
    85                 push( stack, *(Node *)memalign( 16, sizeof( Node ) ) );
     80                push( stack, *(Node *)new() );                                  // must be 16-byte aligned
    8681        }
    8782        {
  • tests/concurrency/waituntil/locks.cfa

    r24d6572 r62d62db  
    22#include <thread.hfa>
    33#include <locks.hfa>
     4#include <fstream.hfa>
    45#include <mutex_stmt.hfa>
    56
  • tests/configs/.expect/parseconfig.txt

    r24d6572 r62d62db  
    1212Maximum student trips: 3
    1313
    14 Open_Failure thrown when config file does not exist
     14open_failure thrown when config file does not exist
    1515Failed to open the config file
    1616
  • tests/configs/parseconfig.cfa

    r24d6572 r62d62db  
    6666
    6767
    68         sout | "Open_Failure thrown when config file does not exist";
     68        sout | "open_failure thrown when config file does not exist";
    6969        try {
    7070                parse_config( xstr(IN_DIR) "doesnt-exist.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
    71         } catch( Open_Failure * ex ) {
     71        } catch( open_failure * ex ) {
    7272                sout | "Failed to open the config file";
    7373        }
  • tests/copyfile.cfa

    r24d6572 r62d62db  
    1010// Created On       : Fri Jun 19 13:44:05 2020
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 15 15:00:48 2020
    13 // Update Count     : 6
     12// Last Modified On : Mon Jun  5 21:20:19 2023
     13// Update Count     : 7
    1414//
    1515
     
    3030                        exit | "Usage" | argv[0] | "[ input-file (default stdin) [ output-file (default stdout) ] ]";
    3131                } // choose
    32         } catch( Open_Failure * ex ; ex->istream == &in ) {
     32        } catch( open_failure * ex ; ex->istream == &in ) {
    3333                exit | "Unable to open input file" | argv[1];
    34         } catch( Open_Failure * ex ; ex->ostream == &out ) {
     34        } catch( open_failure * ex ; ex->ostream == &out ) {
    3535                close( in );                                                                    // optional
    3636                exit | "Unable to open output file" | argv[2];
  • tests/rational.cfa

    r24d6572 r62d62db  
    1010// Created On       : Mon Mar 28 08:43:12 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 20 18:13:40 2021
    13 // Update Count     : 107
     12// Last Modified On : Mon Jun  5 22:58:09 2023
     13// Update Count     : 108
    1414//
    1515
     
    1919#include <fstream.hfa>
    2020
    21 typedef Rational(int) RatInt;
     21typedef rational(int) rat_int;
    2222double convert( int i ) { return (double)i; }                   // used by narrow/widen
    2323int convert( double d ) { return (int)d; }
     
    2525int main() {
    2626        sout | "constructor";
    27         RatInt a = { 3 }, b = { 4 }, c, d = 0, e = 1;
     27        rat_int a = { 3 }, b = { 4 }, c, d = 0, e = 1;
    2828        sout | "a : " | a | "b : " | b | "c : " | c | "d : " | d | "e : " | e;
    2929
    30         a = (RatInt){ 4, 8 };
    31         b = (RatInt){ 5, 7 };
     30        a = (rat_int){ 4, 8 };
     31        b = (rat_int){ 5, 7 };
    3232        sout | "a : " | a | "b : " | b;
    33         a = (RatInt){ -2, -3 };
    34         b = (RatInt){ 3, -2 };
     33        a = (rat_int){ -2, -3 };
     34        b = (rat_int){ 3, -2 };
    3535        sout | "a : " | a | "b : " | b;
    36         a = (RatInt){ -2, 3 };
    37         b = (RatInt){ 3, 2 };
     36        a = (rat_int){ -2, 3 };
     37        b = (rat_int){ 3, 2 };
    3838        sout | "a : " | a | "b : " | b;
    3939        sout | nl;
    4040
    4141        sout | "comparison";
    42         a = (RatInt){ -2 };
    43         b = (RatInt){ -3, 2 };
     42        a = (rat_int){ -2 };
     43        b = (rat_int){ -3, 2 };
    4444        sout | "a : " | a | "b : " | b;
    45         sout | "a == 0 : " | a == (Rational(int)){0}; // FIX ME
    46         sout | "a == 1 : " | a == (Rational(int)){1}; // FIX ME
     45        sout | "a == 0 : " | a == (rational(int)){0}; // FIX ME
     46        sout | "a == 1 : " | a == (rational(int)){1}; // FIX ME
    4747        sout | "a != 0 : " | a != 0;
    4848        sout | "! a : " | ! a;
     
    7373
    7474        sout | "conversion";
    75         a = (RatInt){ 3, 4 };
     75        a = (rat_int){ 3, 4 };
    7676        sout | widen( a );
    77         a = (RatInt){ 1, 7 };
     77        a = (rat_int){ 1, 7 };
    7878        sout | widen( a );
    79         a = (RatInt){ 355, 113 };
     79        a = (rat_int){ 355, 113 };
    8080        sout | widen( a );
    8181        sout | narrow( 0.75, 4 );
     
    9090
    9191        sout | "more tests";
    92         RatInt x = { 1, 2 }, y = { 2 };
     92        rat_int x = { 1, 2 }, y = { 2 };
    9393        sout | x - y;
    9494        sout | x > y;
     
    9696        sout | y | denominator( y, -2 ) | y;
    9797
    98         RatInt z = { 0, 5 };
     98        rat_int z = { 0, 5 };
    9999        sout | z;
    100100
    101101        sout | x | numerator( x, 0 ) | x;
    102102
    103         x = (RatInt){ 1, MAX } + (RatInt){ 1, MAX };
     103        x = (rat_int){ 1, MAX } + (rat_int){ 1, MAX };
    104104        sout | x;
    105         x = (RatInt){ 3, MAX } + (RatInt){ 2, MAX };
     105        x = (rat_int){ 3, MAX } + (rat_int){ 2, MAX };
    106106        sout | x;
    107107
Note: See TracChangeset for help on using the changeset viewer.