Changeset 93d2219 for tests


Ignore:
Timestamp:
Oct 28, 2022, 3:12:16 PM (3 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, master
Children:
fa2e183
Parents:
e874605 (diff), 22a0e87 (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
tests
Files:
18 added
6 edited

Legend:

Unmodified
Added
Removed
  • tests/array-container/array-basic.cfa

    re874605 r93d2219  
    7878}
    7979
    80 forall( A & | ar(A, float) )
     80forall( [N], A & | ar(A, float, N) )
    8181float total1d_hi( A & a ) {
    8282    float total = 0.0f;
    83     for (i; a`len)
     83    for (i; N)
    8484        total += a[i];
    8585    return total;
  • tests/collections/atomic_mpsc.cfa

    re874605 r93d2219  
    11#include <fstream.hfa>
    2 #include <queueLockFree.hfa>
     2#include <containers/lockfree.hfa>
    33#include <thread.hfa>
    44
  • tests/configs/parsebools.cfa

    re874605 r93d2219  
    1515//
    1616
    17 #include <parseargs.hfa>
    1817#include <fstream.hfa>
    1918
    2019#include "../meta/fork+exec.hfa"
     20
     21// last as a work around to a parse bug
     22#include <parseargs.hfa>
    2123
    2224int main(int argc, char * argv[]) {
     
    3032        bool sf = true;
    3133
    32         cfa_option options[] = {
    33                 {'e', "yesno",     "test yes/no",     YN, parse_yesno},
    34                 {'y', "YN",        "test yes/no",     Yn, parse_yesno},
    35                 {'n', "yn",        "test yes/no",     yn, parse_yesno},
    36                 {'t', "truefalse", "test true/false", tf, parse_truefalse},
    37                 {'s', "settrue",   "test set true",   st, parse_settrue},
    38                 {'u', "setfalse",  "test set false",  sf, parse_setfalse},
    39         };
    40         int options_cnt = sizeof(options) / sizeof(cfa_option);
     34        array( cfa_option, 6 ) options;
     35        options[0] = (cfa_option){'e', "yesno",     "test yes/no",     YN, parse_yesno};
     36        options[1] = (cfa_option){'y', "YN",        "test yes/no",     Yn, parse_yesno};
     37        options[2] = (cfa_option){'n', "yn",        "test yes/no",     yn, parse_yesno};
     38        options[3] = (cfa_option){'t', "truefalse", "test true/false", tf, parse_truefalse};
     39        options[4] = (cfa_option){'s', "settrue",   "test set true",   st, parse_settrue};
     40        options[5] = (cfa_option){'u', "setfalse",  "test set false",  sf, parse_setfalse};
    4141
    4242        char **left;
    43         parse_args( options, options_cnt, "[OPTIONS]...\ntesting bool parameters", left);
     43        parse_args( options, "[OPTIONS]...\ntesting bool parameters", left);
    4444
    4545        sout | "yes/no     :" | YN;
  • tests/configs/parsenums.cfa

    re874605 r93d2219  
    1515//
    1616
     17#include <fstream.hfa>
     18
     19#include "../meta/fork+exec.hfa"
     20
     21// last as workaround to parser bug
    1722#include <parseargs.hfa>
    18 #include <fstream.hfa>
    19 
    20 #include "../meta/fork+exec.hfa"
    2123
    2224#if __SIZEOF_LONG__ == 4
     
    4244
    4345
    44         cfa_option options[] = {
    45                 { 'i', "int",              "test int",                i   },
    46                 { 'u', "unsigned",         "test unsigned",           u   },
    47                 { 'l', "unsignedlong",     "test unsigned long",      ul  },
    48                 { 'L', "unsignedlonglong", "test unsigned long long", ull },
    49                 { 'd', "double",           "test double",             d   },
    50         };
    51         int options_cnt = sizeof(options) / sizeof(cfa_option);
     46        array( cfa_option, 5 ) options;
     47        options[0] = (cfa_option){ 'i', "int",              "test int",                i   };
     48        options[1] = (cfa_option){ 'u', "unsigned",         "test unsigned",           u   };
     49        options[2] = (cfa_option){ 'l', "unsignedlong",     "test unsigned long",      ul  };
     50        options[3] = (cfa_option){ 'L', "unsignedlonglong", "test unsigned long long", ull };
     51        options[4] = (cfa_option){ 'd', "double",           "test double",             d   };
    5252
    5353        char **left;
    54         parse_args( options, options_cnt, "[OPTIONS]...\ntesting bool parameters", left);
     54        parse_args( options, "[OPTIONS]...\ntesting bool parameters", left);
    5555
    5656        sout | "int                :" | i;
  • tests/configs/usage.cfa

    re874605 r93d2219  
    1515//
    1616
     17#include <fstream.hfa>
     18#include "../meta/fork+exec.hfa"
    1719#include <parseargs.hfa>
    18 #include <fstream.hfa>
    1920
    20 #include "../meta/fork+exec.hfa"
    2121
    2222int main() {
     
    2525        sout | "No args, no errors";
    2626        if(pid_t child = strict_fork(); child == 0) {
    27                 cfa_option opts[0];
    28                 print_args_usage(1, fake_argv, opts, 0, "Test usage", false);
     27                array( cfa_option, 0 ) opts;
     28                print_args_usage(1, fake_argv, opts, "Test usage", false);
    2929        }
    3030        else {
     
    3535        sout | "No args, with errors";
    3636        if(pid_t child = strict_fork(); child == 0) {
    37                 cfa_option opts[0];
    38                 print_args_usage(1, fake_argv, opts, 0, "Test usage", true);
     37                array( cfa_option, 0 ) opts;
     38                print_args_usage(1, fake_argv, opts, "Test usage", true);
    3939        }
    4040        else {
     
    4646        if(pid_t child = strict_fork(); child == 0) {
    4747                int a, b, c;
    48                 cfa_option opts[] = {
    49                         {'a', "", "First arg", a },
    50                         {'b', "", "Second arg", b },
    51                         {'c', "", "Third arg", c },
    52                 };
    53                 print_args_usage(1, fake_argv, opts, 3, "Test usage", false);
     48                array( cfa_option, 3 ) opts;
     49                opts[0] = (cfa_option){'a', "", "First arg", a };
     50                opts[1] = (cfa_option){'b', "", "Second arg", b };
     51                opts[2] = (cfa_option){'c', "", "Third arg", c };
     52                print_args_usage(1, fake_argv, opts, "Test usage", false);
    5453        }
    5554        else {
     
    6160        if(pid_t child = strict_fork(); child == 0) {
    6261                int a, b, c;
    63                 cfa_option opts[] = {
    64                         {'\0', "AA", "First arg", a },
    65                         {'\0', "BB", "Second arg", b },
    66                         {'\0', "CC", "Third arg", c },
    67                 };
    68                 print_args_usage(1, fake_argv, opts, 3, "Test usage", false);
     62                array( cfa_option, 3 ) opts;
     63                opts[0] = (cfa_option){'\0', "AA", "First arg", a };
     64                opts[1] = (cfa_option){'\0', "BB", "Second arg", b };
     65                opts[2] = (cfa_option){'\0', "CC", "Third arg", c };
     66                print_args_usage(1, fake_argv, opts, "Test usage", false);
    6967        }
    7068        else {
     
    7674        if(pid_t child = strict_fork(); child == 0) {
    7775                int a, b, c;
    78                 cfa_option opts[] = {
    79                         {'a', "", "First arg", a },
    80                         {'b', "BBBB", "Second arg", b },
    81                         {'\0', "CC", "Third arg", c },
    82                 };
    83                 print_args_usage(1, fake_argv, opts, 3, "Test usage", false);
     76                array( cfa_option, 3 ) opts;
     77                opts[0] = (cfa_option){'a', "", "First arg", a };
     78                opts[1] = (cfa_option){'b', "BBBB", "Second arg", b };
     79                opts[2] = (cfa_option){'\0', "CC", "Third arg", c };
     80                print_args_usage(1, fake_argv, opts, "Test usage", false);
    8481        }
    8582        else {
     
    9188        if(pid_t child = strict_fork(); child == 0) {
    9289                int a, b, c;
    93                 cfa_option opts[] = {
    94                         {'a', "", "First arg", a },
    95                         {'b', "BBBB", "", b },
    96                         {'\0', "CC", "Third arg", c },
    97                 };
    98                 print_args_usage(1, fake_argv, opts, 3, "Test usage", false);
     90                array( cfa_option, 3 ) opts;
     91                opts[0] = (cfa_option){'a', "", "First arg", a };
     92                opts[1] = (cfa_option){'b', "BBBB", "", b };
     93                opts[2] = (cfa_option){'\0', "CC", "Third arg", c };
     94                print_args_usage(1, fake_argv, opts, "Test usage", false);
    9995        }
    10096        else {
     
    106102        if(pid_t child = strict_fork(); child == 0) {
    107103                int a, b, c;
    108                 cfa_option opts[] = {
    109                         {'a', "", "First arg\nThe description has multiple lines,\n...for some reason", a },
    110                         {'b', "BBBB", "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", b },
    111                         {'\0', "CC", "Third arg", c },
    112                 };
    113                 print_args_usage(1, fake_argv, opts, 3, "Test usage", false);
     104                array( cfa_option, 3 ) opts;
     105                opts[0] = (cfa_option){'a', "", "First arg\nThe description has multiple lines,\n...for some reason", a };
     106                opts[1] = (cfa_option){'b', "BBBB", "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", b };
     107                opts[2] = (cfa_option){'\0', "CC", "Third arg", c };
     108                print_args_usage(1, fake_argv, opts, "Test usage", false);
    114109        }
    115110        else {
  • tests/device/cpu.cfa

    re874605 r93d2219  
    117117unsigned find_idx() {
    118118        int idxs = count_cache_indexes();
     119        if( 0 == idxs ) return 0;
    119120
    120121        unsigned found_level = 0;
     
    179180        unsigned idx = find_idx();
    180181        // For all procs check mapping is consistent
    181         for(cpu_me; cpu_info.hthrd_count) {
     182        if( idx > 0 ) for(cpu_me; cpu_info.hthrd_count) {
    182183                char buf_me[32];
    183184                size_t len_me = read_cpuidxinfo_into(cpu_me, idx, "shared_cpu_list", buf_me, 32);
Note: See TracChangeset for help on using the changeset viewer.