Esempio n. 1
0
void fault_localizationt::report(
  const cover_goalst &cover_goals)
{
  bmc_all_propertiest::report(cover_goals);

  switch(bmc.ui)
  {
  case ui_message_handlert::PLAIN:
    if(cover_goals.number_covered()>0)
    {
      status() << "\n** Most likely fault location:" << eom;
      for(auto &g : goal_map)
      {
        if(g.second.status!=goalt::statust::FAILURE)
          continue;
        report(g.first);
      }
    }
    break;
  case ui_message_handlert::XML_UI:
    break;
  case ui_message_handlert::JSON_UI:
    break;
  }
}
Esempio n. 2
0
void bmc_all_propertiest::report(const cover_goalst &cover_goals)
{
  switch(bmc.ui)
  {
  case ui_message_handlert::uit::PLAIN:
    {
      status() << "\n** Results:" << eom;

      for(const auto &goal_pair : goal_map)
        status() << "[" << goal_pair.first << "] "
                 << goal_pair.second.description << ": "
                 << goal_pair.second.status_string()
                 << eom;

      if(bmc.options.get_bool_option("trace"))
      {
        for(const auto &g : goal_map)
          if(g.second.status==goalt::statust::FAILURE)
          {
            std::cout << "\n" << "Trace for " << g.first << ":" << "\n";
            show_goto_trace(std::cout, bmc.ns, g.second.goto_trace);
          }
      }

      status() << "\n** " << cover_goals.number_covered()
               << " of " << cover_goals.size() << " failed ("
               << cover_goals.iterations() << " iteration"
               << (cover_goals.iterations()==1?"":"s")
               << ")" << eom;
    }
    break;

  case ui_message_handlert::uit::XML_UI:
    {
      for(const auto &g : goal_map)
      {
        xmlt xml_result("result");
        xml_result.set_attribute("property", id2string(g.first));
        xml_result.set_attribute("status", g.second.status_string());

        if(g.second.status==goalt::statust::FAILURE)
          convert(bmc.ns, g.second.goto_trace, xml_result.new_element());

        std::cout << xml_result << "\n";
      }
      break;
    }

    case ui_message_handlert::uit::JSON_UI:
    {
      json_objectt json_result;
      json_arrayt &result_array=json_result["result"].make_array();

      for(const auto &g : goal_map)
      {
        json_objectt &result=result_array.push_back().make_object();
        result["property"]=json_stringt(id2string(g.first));
        result["description"]=json_stringt(id2string(g.second.description));
        result["status"]=json_stringt(g.second.status_string());

        if(g.second.status==goalt::statust::FAILURE)
        {
          jsont &json_trace=result["trace"];
          convert(bmc.ns, g.second.goto_trace, json_trace);
        }
      }

      std::cout << ",\n" << json_result;
    }
    break;
  }
}