Changeset 5416b44


Ignore:
Timestamp:
May 27, 2022, 11:22:23 PM (5 weeks ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
0a004b7
Parents:
c3b9d639
Message:

make expected output for nested functions deterministic

Location:
tests
Files:
2 edited

Legend:

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

    rc3b9d639 r5416b44  
    1 j 3 3
    2 j 2 2
    3 j 2 2
    4 j 2 2
    5 j 1 1
    6 j 1 1
    7 j 1 1
    8 j 1 1
    9 j 1 1
    10 j 1 1
    11 j 1 1
    12 j 1 1
    13 j 1 1
    14 j 1 1
    15 j 1 1
    16 j 1 1
    17 j 0 0
    18 j 0 0
    19 j 0 0
    20 i 22 22
    21 j 3 3
    22 j 2 2
    23 j 2 2
    24 j 2 2
    25 j 1 1
    26 j 1 1
    27 j 1 1
    28 j 1 1
    29 j 1 1
    30 j 1 1
    31 j 1 1
    32 j 1 1
    33 j 1 1
    34 j 1 1
    35 j 1 1
    36 j 1 1
    37 j 0 0
    38 j 0 0
    39 j 0 0
    40 i 22 22
    41 j 3 3
    42 j 2 2
    43 j 2 2
    44 j 2 2
    45 j 1 1
    46 j 1 1
    47 j 1 1
    48 j 1 1
    49 j 1 1
    50 j 1 1
    51 j 1 1
    52 j 1 1
    53 j 1 1
    54 j 1 1
    55 j 1 1
    56 j 1 1
    57 j 0 0
    58 j 0 0
    59 j 0 0
    60 i 22 22
    61 j 3 3
    62 j 2 2
    63 j 2 2
    64 j 2 2
    65 j 1 1
    66 j 1 1
    67 j 1 1
    68 j 1 1
    69 j 1 1
    70 j 1 1
    71 j 1 1
    72 j 1 1
    73 j 1 1
    74 j 1 1
    75 j 1 1
    76 j 1 1
    77 j 0 0
    78 j 0 0
    79 j 0 0
    80 i 22 22
    81 j 3 3
    82 j 2 2
    83 j 2 2
    84 j 2 2
    85 j 1 1
    86 j 1 1
    87 j 1 1
    88 j 1 1
    89 j 1 1
    90 j 1 1
    91 j 1 1
    92 j 1 1
    93 j 1 1
    94 j 1 1
    95 j 1 1
    96 j 1 1
    97 j 0 0
    98 j 0 0
    99 j 0 0
    100 i 22 22
     1total 105
  • tests/nested_function.cfa

    rc3b9d639 r5416b44  
    1 //
    2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
    3 //
    4 // The contents of this file are covered under the licence agreement in the
    5 // file "LICENCE" distributed with Cforall.
    6 //
    7 // nested_function.cfa -- Test nested functions run on user-thread stacks.
    8 //
    9 // Author           : Peter A. Buhr
    10 // Created On       : Mon May 23 22:21:30 2022
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 23 23:11:25 2022
    13 // Update Count     : 4
    14 //
    15 
    161#include <thread.hfa>
    172#include <fstream.hfa>
    183#include <stdlib.hfa>
    194
    20 thread T {};
     5enum { VALUES = 10_000 };
     6int values[VALUES], total = 0;
    217
    22 enum { VALUES = 10_000 };
    23 int values[VALUES];
     8thread T { int id; };
    249
    2510void main( T & ) {
     11        int sum = 0;
    2612        void f() {
    2713                int i = 0;
     
    3622                        else h();
    3723                        i += 1;
    38                         sout | "j" | j | bsearchl( j, values, VALUES ); // has internal nested compare routine
     24                        sum += bsearchl( j, values, VALUES );           // has internal nested compare routine
    3925                } // h
    4026                h();
    41                 sout | "i" | i | bsearchl( i, values, VALUES ); // has internal nested compare routine
    4227        } // f
    4328        f();
     29        __atomic_fetch_add( &total, sum, __ATOMIC_SEQ_CST );
    4430}
    4531int main() {
    4632        set_seed( 1003 );
    4733        for ( i; VALUES ) values[i] = i;
    48         T t[5];
     34        {
     35                T t[5];
     36        }
     37        sout | "total" | total;
    4938}
Note: See TracChangeset for help on using the changeset viewer.