Creates a new vector which removes the string if the substr is found in the instructions vector and reinserts it in the location specified by order. NOTE: This will not work correctly if there are two instances of substr in instructions
| 159 | // NOTE: This will not work correctly if there are two instances of substr in |
| 160 | // instructions |
| 161 | std::vector<std::string> GenerateCode(std::string substr, int order) { |
| 162 | std::vector<std::string> code(getInstructions().size()); |
| 163 | std::vector<std::string> inst(1); |
| 164 | partition_copy(std::begin(getInstructions()), std::end(getInstructions()), |
| 165 | std::begin(code), std::begin(inst), |
| 166 | [=](const std::string& str) { |
| 167 | return std::string::npos == str.find(substr); |
| 168 | }); |
| 169 | |
| 170 | code.insert(std::begin(code) + order, inst.front()); |
| 171 | return code; |
| 172 | } |
| 173 | |
| 174 | // This test will check the logical layout of a binary by removing each |
| 175 | // instruction in the pair of the INSTANTIATE_TEST_SUITE_P call and moving it in |