Show
Ignore:
Timestamp:
08/05/09 14:40:03 (15 years ago)
Author:
mido
Message:

panove, vite, jak jsem peclivej na upravu kodu.. snad se vam bude libit:) konfigurace je v souboru /system/astylerc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/tests/datalink_test.cpp

    r424 r477  
    55using namespace bdm; 
    66 
    7 TEST(test_datalink) { 
    8     // RV names are global, and a, b and c are already taken by a 
    9     // different test... 
    10     RV a = RV("{dla }", "2"); 
    11     RV b = RV("{dlb }"); 
    12     RV c = RV("{dlc }"); 
     7TEST ( test_datalink ) { 
     8        // RV names are global, and a, b and c are already taken by a 
     9        // different test... 
     10        RV a = RV ( "{dla }", "2" ); 
     11        RV b = RV ( "{dlb }" ); 
     12        RV c = RV ( "{dlc }" ); 
    1313 
    14     RV ab = a; 
    15     ab.add(b); 
     14        RV ab = a; 
     15        ab.add ( b ); 
    1616 
    17     RV abc = ab; 
    18     abc.add(c); 
     17        RV abc = ab; 
     18        abc.add ( c ); 
    1919 
    20     datalink dl(ab, abc); 
    21     vec total("0 37 42 66"); 
    22     vec filtered = dl.pushdown(total); 
    23     int exp_f[] = { 0, 37, 42 }; 
    24     int exp_sz = sizeof(exp_f) / sizeof(exp_f[0]); 
    25     CHECK_EQUAL(exp_sz, filtered.size()); 
    26     for (int i = 0; i < exp_sz; ++i) { 
    27         CHECK_EQUAL(exp_f[i], filtered(i)); 
    28     } 
     20        datalink dl ( ab, abc ); 
     21        vec total ( "0 37 42 66" ); 
     22        vec filtered = dl.pushdown ( total ); 
     23        int exp_f[] = { 0, 37, 42 }; 
     24        int exp_sz = sizeof ( exp_f ) / sizeof ( exp_f[0] ); 
     25        CHECK_EQUAL ( exp_sz, filtered.size() ); 
     26        for ( int i = 0; i < exp_sz; ++i ) { 
     27                CHECK_EQUAL ( exp_f[i], filtered ( i ) ); 
     28        } 
    2929} 
    3030 
    31 TEST(test_datalink_m2e) { 
    32     RV a = RV("{dla }", "2"); 
    33     RV b = RV("{dlb }"); 
    34     RV c = RV("{dlc }"); 
     31TEST ( test_datalink_m2e ) { 
     32        RV a = RV ( "{dla }", "2" ); 
     33        RV b = RV ( "{dlb }" ); 
     34        RV c = RV ( "{dlc }" ); 
    3535 
    36     RV ab = a; 
    37     ab.add(b); 
     36        RV ab = a; 
     37        ab.add ( b ); 
    3838 
    39     RV ba = a; 
    40     ba.add(b); 
     39        RV ba = a; 
     40        ba.add ( b ); 
    4141 
    42     RV abc = ab; 
    43     abc.add(c); 
     42        RV abc = ab; 
     43        abc.add ( c ); 
    4444 
    45     datalink_m2e dl; 
    46     dl.set_connection(ba, c, abc); 
    47     vec total("0 37 42 66"); 
    48     vec cond = dl.get_cond(total); 
    49     CHECK_EQUAL(1, cond.size()); 
    50     CHECK_EQUAL(66, cond(0)); 
     45        datalink_m2e dl; 
     46        dl.set_connection ( ba, c, abc ); 
     47        vec total ( "0 37 42 66" ); 
     48        vec cond = dl.get_cond ( total ); 
     49        CHECK_EQUAL ( 1, cond.size() ); 
     50        CHECK_EQUAL ( 66, cond ( 0 ) ); 
    5151} 
    5252 
    53 TEST(test_datalink_m2m) { 
    54     RV a = RV("{dla }", "2"); 
    55     RV b = RV("{dlb }"); 
    56     RV c = RV("{dlc }"); 
     53TEST ( test_datalink_m2m ) { 
     54        RV a = RV ( "{dla }", "2" ); 
     55        RV b = RV ( "{dlb }" ); 
     56        RV c = RV ( "{dlc }" ); 
    5757 
    58     datalink_m2m dl; 
    59     dl.set_connection(a, concat(b, c), concat(a, b), c); 
     58        datalink_m2m dl; 
     59        dl.set_connection ( a, concat ( b, c ), concat ( a, b ), c ); 
    6060 
    61     vec val("1 1.5 2"); 
    62     vec cond("3"); 
     61        vec val ( "1 1.5 2" ); 
     62        vec cond ( "3" ); 
    6363 
    64     vec p = dl.pushdown(val); 
    65     double exp_p[] = { 1.0, 1.5 }; 
    66     int exp_sz = sizeof(exp_p) / sizeof(exp_p[0]); 
    67     CHECK_EQUAL(exp_sz, p.size()); 
    68     for (int i = 0; i < exp_sz; ++i) { 
    69         CHECK_EQUAL(exp_p[i], p(i)); 
    70     } 
     64        vec p = dl.pushdown ( val ); 
     65        double exp_p[] = { 1.0, 1.5 }; 
     66        int exp_sz = sizeof ( exp_p ) / sizeof ( exp_p[0] ); 
     67        CHECK_EQUAL ( exp_sz, p.size() ); 
     68        for ( int i = 0; i < exp_sz; ++i ) { 
     69                CHECK_EQUAL ( exp_p[i], p ( i ) ); 
     70        } 
    7171 
    72     vec dlcond = dl.get_cond(val, cond); 
    73     int exp_c[] = { 2, 3 }; 
    74     exp_sz = sizeof(exp_c) / sizeof(exp_c[0]); 
    75     CHECK_EQUAL(exp_sz, dlcond.size()); 
    76     for (int i = 0; i < exp_sz; ++i) { 
    77         CHECK_EQUAL(exp_c[i], dlcond(i)); 
    78     } 
     72        vec dlcond = dl.get_cond ( val, cond ); 
     73        int exp_c[] = { 2, 3 }; 
     74        exp_sz = sizeof ( exp_c ) / sizeof ( exp_c[0] ); 
     75        CHECK_EQUAL ( exp_sz, dlcond.size() ); 
     76        for ( int i = 0; i < exp_sz; ++i ) { 
     77                CHECK_EQUAL ( exp_c[i], dlcond ( i ) ); 
     78        } 
    7979}