 Timestamp:
 Jan 7, 2012, 6:15:25 PM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/lib/test/byte_compare_generator.cpp
r1831 r1838 1 #include " ../byte_compare.hpp"1 #include "byte_compare.hpp" 2 2 #include <stdint.h> 3 3 #include <iostream> … … 77 77 78 78 79 string gen_overlap_compare_ test(string type, int lgth, string x, int idx_x, string y, int idx_y) {79 string gen_overlap_compare_call_T_L(string type, int lgth, string x, int idx_x, string y, int idx_y) { 80 80 81 81 ostringstream ostr; … … 92 92 } 93 93 94 string gen_overlap_compare_call_T(string type, int lgth, string x, int idx_x, string y, int idx_y) { 95 96 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 107 return ostr.str(); 108 } 94 109 95 110 int main() { … … 106 121 buffer << "cout << \"overlap_compare<uint8_t,i>(x,y)\" << endl;" << endl; 107 122 for(int i=sizeof(uint8_t);i<=size;i++) { 108 buffer << gen_overlap_compare_ test("uint8_t", i, x, i, x, i);123 buffer << gen_overlap_compare_call_T_L("uint8_t", i, x, i, x, i); 109 124 } 110 125 111 126 for(int i=sizeof(uint8_t);i<=size;i++) { 112 buffer << gen_overlap_compare_ test("uint8_t", i, x, i, y, i);127 buffer << gen_overlap_compare_call_T_L("uint8_t", i, x, i, y, i); 113 128 } 114 129 115 130 buffer << "cout << \"overlap_compare<uint16_t,i>(x,y)\" << endl;" << endl; 116 131 for(int i=sizeof(uint16_t);i<=size;i++) { 117 buffer << gen_overlap_compare_ test("uint16_t", i, x, i, x, i);132 buffer << gen_overlap_compare_call_T_L("uint16_t", i, x, i, x, i); 118 133 } 119 134 120 135 for(int i=sizeof(uint16_t);i<=size;i++) { 121 buffer << gen_overlap_compare_ test("uint16_t", i, x, i, y, i);136 buffer << gen_overlap_compare_call_T_L("uint16_t", i, x, i, y, i); 122 137 } 123 138 124 139 buffer << "cout << \"overlap_compare<uint32_t,i>(x,y)\" << endl;" << endl; 125 140 for(int i=sizeof(uint32_t);i<=size;i++) { 126 buffer << gen_overlap_compare_ test("uint32_t", i, x, i, x, i);141 buffer << gen_overlap_compare_call_T_L("uint32_t", i, x, i, x, i); 127 142 } 128 143 129 144 for(int i=sizeof(uint32_t);i<=size;i++) { 130 buffer << gen_overlap_compare_ test("uint32_t", i, x, i, y, i);145 buffer << gen_overlap_compare_call_T_L("uint32_t", i, x, i, y, i); 131 146 } 132 147 133 148 buffer << "cout << \"overlap_compare<uint64_t,i>(x,y)\" << endl;" << endl; 134 149 for(int i=sizeof(uint64_t);i<=size;i++) { 135 buffer << gen_overlap_compare_ test("uint64_t", i, x, i, x, i);150 buffer << gen_overlap_compare_call_T_L("uint64_t", i, x, i, x, i); 136 151 } 137 152 138 153 for(int i=sizeof(uint64_t);i<=size;i++) { 139 buffer << gen_overlap_compare_ test("uint64_t", i, x, i, y, i);154 buffer << gen_overlap_compare_call_T_L("uint64_t", i, x, i, y, i); 140 155 } 141 156 142 157 buffer << "cout << \"overlap_compare<BitBlock,i>(x,y)\" << endl;" << endl; 143 158 for(int i=sizeof(BitBlock);i<=size;i++) { 144 buffer << gen_overlap_compare_ test("BitBlock", i, x, i, x, i);159 buffer << gen_overlap_compare_call_T_L("BitBlock", i, x, i, x, i); 145 160 } 146 161 147 162 for(int i=sizeof(BitBlock);i<=size;i++) { 148 buffer << gen_overlap_compare_ test("BitBlock", i, x, i, y, i);163 buffer << gen_overlap_compare_call_T_L("BitBlock", i, x, i, y, i); 149 164 } 165 166 buffer << "cout << \"overlap_compare<BitBlock>(x,y,lgth)\" << endl;" << endl; 167 for(int i=sizeof(BitBlock);i<=size;i++) { 168 buffer << gen_overlap_compare_call_T("BitBlock", i, x, i, x, i); 169 } 170 171 for(int i=sizeof(BitBlock);i<=size;i++) { 172 buffer << gen_overlap_compare_call_T("BitBlock", i, x, i, y, i); 173 } 174 150 175 string test_cases = buffer.str(); 151 176
Note: See TracChangeset
for help on using the changeset viewer.