/* ### * IP: GHIDRA * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "ifacedecomp.hh" void FunctionTestProperty::startTest(void) const { count = 0; } void FunctionTestProperty::processLine(const string &line) const { if (regex_search(line,pattern)) count += 1; } bool FunctionTestProperty::endTest(void) const { return (count >= minimumMatch && count <= maximumMatch); } void FunctionTestProperty::restoreXml(const Element *el) { name = el->getAttributeValue("name"); istringstream s1(el->getAttributeValue("min")); s1 >> minimumMatch; istringstream s2(el->getAttributeValue("max")); s2 >> maximumMatch; pattern = regex(el->getContent()); } void ConsoleCommands::readLine(string &line) { if (pos >= commands.size()) { line.clear(); return; } line = commands[pos]; pos += 1; } /// \param s is the stream where command output is printed /// \param comms is the list of commands to be issued ConsoleCommands::ConsoleCommands(ostream &s,vector &comms) : IfaceStatus("> ", s), commands(comms) { pos = 0; IfaceCapability::registerAllCommands(this); } void ConsoleCommands::reset(void) { pos = 0; inerror = false; done = false; } void FunctionTestCollection::clear(void) { dcp->clearArchitecture(); commands.clear(); testList.clear(); console->reset(); } /// \param el is the root \