Changeset 1840


Ignore:
Timestamp:
Jan 7, 2012, 7:27:39 PM (7 years ago)
Author:
ksherdy
Message:

Updated test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/test/byte_compare_generator.cpp

    r1839 r1840  
    7777
    7878
    79 string gen_overlap_compare_call_T_L(string type, int lgth, string x, int idx_x, string y, int idx_y) {
     79string gen_overlap_compare_call(string type, int lgth, string x_param, string y_param) {
    8080
    8181    ostringstream ostr;
    82     ostr << "cout << \""
    83          << "x=\\\"\" << " << x << "[" << idx_x << "]" << "<< \"\\\""
    84          << " y=\\\"\" << " << y << "[" << idx_y << "]" << "<< \"\\\""
    85          << " L=" << lgth << " "
    86          << " R=\" << overlap_compare<" << type << "," << lgth << ">(" << "(" << type << "*)&"
    87          << x << "[" << idx_x << "]"<< ",(" << type << "*)&"
    88          << y << "[" << idx_y << "]"<< ")"
    89          << " << endl;" <<endl;
    90 
     82    ostr << "cout << "
     83                 << x_param << "[" << lgth << "]"
     84                 << "<< \" == \" << "
     85                 << y_param << "[" << lgth << "]"
     86                 << "<< \" is \" << "
     87                 << "overlap_compare<" << type << "," << lgth << ">("
     88         << "(" << type << "*)&" << x_param << "[" << lgth << "]"<< ", "
     89                 << "(" << type << "*)&" << y_param << "[" << lgth << "]"<< ")"
     90                 << " << endl;" <<endl;
    9191    return ostr.str();
    9292}
    9393
    94 string gen_overlap_compare_call_T(string type, int lgth, string x, int idx_x, string y, int idx_y) {
     94string gen_overlap_compare_call(string type, int lgth, string x_param, string y_param, int lgth_param) {
    9595
    9696    ostringstream ostr;
    97     ostr << "cout << \""
    98          << "x=\\\"\" << " << x << "[" << idx_x << "]" << "<< \"\\\""
    99          << " y=\\\"\" << " << y << "[" << idx_y << "]" << "<< \"\\\""
    100          << " L=" << lgth << " "
    101          << " R=\" << overlap_compare<" << type << "," << ">(" << "(" << type << "*)&"
    102          << x << "[" << idx_x << "]"<< ",(" << type << "*)&"
    103          << y << "[" << idx_y << "] ,"
    104          << lgth << ")"
    105          << " << endl;" <<endl;
    106 
     97    ostr << "cout << "
     98                 << x_param << "[" << lgth << "]"
     99                 << "<< \" == \" << "
     100                 << y_param << "[" << lgth << "]"
     101                 << "<< \" is \" << "
     102                 << "overlap_compare<" << type << ">("
     103         << "(" << type << "*)&" << x_param << "[" << lgth << "]"<< ", "
     104                 << "(" << type << "*)&" << y_param << "[" << lgth << "]"<< ", "
     105                 << lgth_param << ")"
     106                 << " << endl;" <<endl;
    107107    return ostr.str();
    108108}
     
    110110int main() {
    111111
    112     const int size = 69;
     112    const int size = 33;
    113113    const char * x = "x";
    114114    const char * y = "y";
     
    119119    buffer << gen_data_array_not_equal(y, size);
    120120   
    121     buffer << "cout << \"overlap_compare<uint8_t,i>(x,y)\" << endl;" << endl;
     121    buffer << "cout << endl << \"overlap_compare<uint8_t,i>(x,y)\" << endl;" << endl;
    122122    for(int i=sizeof(uint8_t);i<=size;i++) {
    123         buffer << gen_overlap_compare_call_T_L("uint8_t", i, x, i, x, i);
     123        buffer << gen_overlap_compare_call("uint8_t", i, x, x);
    124124    }
    125125
    126126    for(int i=sizeof(uint8_t);i<=size;i++) {
    127         buffer << gen_overlap_compare_call_T_L("uint8_t", i, x, i, y, i);
     127        buffer << gen_overlap_compare_call("uint8_t", i, x, y);
    128128    }
    129129
    130     buffer << "cout << \"overlap_compare<uint16_t,i>(x,y)\" << endl;" << endl;
     130    buffer << "cout << endl << \"overlap_compare<uint16_t,i>(x,y)\" << endl;" << endl;
    131131    for(int i=sizeof(uint16_t);i<=size;i++) {
    132         buffer << gen_overlap_compare_call_T_L("uint16_t", i, x, i, x, i);
     132        buffer << gen_overlap_compare_call("uint16_t", i, x, x);
    133133    }
    134134
    135135    for(int i=sizeof(uint16_t);i<=size;i++) {
    136         buffer << gen_overlap_compare_call_T_L("uint16_t", i, x, i, y, i);
     136        buffer << gen_overlap_compare_call("uint16_t", i, x, y);
    137137    }
    138138
    139     buffer << "cout << \"overlap_compare<uint32_t,i>(x,y)\" << endl;" << endl;
     139    buffer << "cout << endl << \"overlap_compare<uint32_t,i>(x,y)\" << endl;" << endl;
    140140    for(int i=sizeof(uint32_t);i<=size;i++) {
    141         buffer << gen_overlap_compare_call_T_L("uint32_t", i, x, i, x, i);
     141        buffer << gen_overlap_compare_call("uint32_t", i, x, x);
    142142    }
    143143
    144144    for(int i=sizeof(uint32_t);i<=size;i++) {
    145         buffer << gen_overlap_compare_call_T_L("uint32_t", i, x, i, y, i);
     145        buffer << gen_overlap_compare_call("uint32_t", i, x, y);
    146146    }
    147147
    148     buffer << "cout << \"overlap_compare<uint64_t,i>(x,y)\" << endl;" << endl;
     148    buffer << "cout << endl << \"overlap_compare<uint64_t,i>(x,y)\" << endl;" << endl;
    149149    for(int i=sizeof(uint64_t);i<=size;i++) {
    150         buffer << gen_overlap_compare_call_T_L("uint64_t", i, x, i, x, i);
     150        buffer << gen_overlap_compare_call("uint64_t", i, x, x);
    151151    }
    152152
    153153    for(int i=sizeof(uint64_t);i<=size;i++) {
    154         buffer << gen_overlap_compare_call_T_L("uint64_t", i, x, i, y, i);
     154        buffer << gen_overlap_compare_call("uint64_t", i, x, y);
    155155    }
    156156
    157     buffer << "cout << \"overlap_compare<BitBlock,i>(x,y)\" << endl;" << endl;
     157    buffer << "cout << endl << \"overlap_compare<BitBlock,i>(x,y)\" << endl;" << endl;
    158158    for(int i=sizeof(BitBlock);i<=size;i++) {
    159         buffer << gen_overlap_compare_call_T_L("BitBlock", i, x, i, x, i);
     159        buffer << gen_overlap_compare_call("BitBlock", i, x, x);
    160160    }
    161161
    162162    for(int i=sizeof(BitBlock);i<=size;i++) {
    163         buffer << gen_overlap_compare_call_T_L("BitBlock", i, x, i, y, i);
     163        buffer << gen_overlap_compare_call("BitBlock", i, x, y);
    164164    }
    165165
    166     buffer << "cout << \"overlap_compare<BitBlock>(x,y,lgth)\" << endl;" << endl;
     166    buffer << "cout << endl << \"overlap_compare<BitBlock>(x,y,lgth)\" << endl;" << endl;
    167167    for(int i=sizeof(BitBlock);i<=size;i++) {
    168         buffer << gen_overlap_compare_call_T("BitBlock", i, x, i, x, i);
     168        buffer << gen_overlap_compare_call("BitBlock", i, x, x, i);
    169169    }
    170170
    171171    for(int i=sizeof(BitBlock);i<=size;i++) {
    172         buffer << gen_overlap_compare_call_T("BitBlock", i, x, i, y, i);
     172        buffer << gen_overlap_compare_call("BitBlock", i, x, y, i);
    173173    }
    174174
Note: See TracChangeset for help on using the changeset viewer.