Skip to content

Commit 9479fff

Browse files
Move reporting functions to report_util
1 parent a312377 commit 9479fff

File tree

7 files changed

+63
-58
lines changed

7 files changed

+63
-58
lines changed

src/cbmc/all_properties.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Author: Daniel Kroening, [email protected]
1515
#include <chrono>
1616

1717
#include <goto-checker/bmc_util.h>
18+
#include <goto-checker/report_util.h>
1819

1920
#include <util/xml.h>
2021
#include <util/json.h>

src/cbmc/bmc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Author: Daniel Kroening, [email protected]
2525
#include <linking/static_lifetime_init.h>
2626

2727
#include <goto-checker/bmc_util.h>
28+
#include <goto-checker/report_util.h>
2829
#include <goto-checker/solver_factory.h>
2930

3031
#include "counterexample_beautification.h"

src/cbmc/fault_localization.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Author: Peter Schrammel
2727
#include <goto-programs/xml_goto_trace.h>
2828

2929
#include <goto-checker/bmc_util.h>
30+
#include <goto-checker/report_util.h>
3031

3132
#include "counterexample_beautification.h"
3233

src/goto-checker/bmc_util.cpp

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -225,58 +225,3 @@ void slice(
225225
<< " remaining after simplification" << messaget::eom;
226226
}
227227

228-
void report_success(ui_message_handlert &ui_message_handler)
229-
{
230-
messaget msg(ui_message_handler);
231-
msg.result() << "VERIFICATION SUCCESSFUL" << messaget::eom;
232-
233-
switch(ui_message_handler.get_ui())
234-
{
235-
case ui_message_handlert::uit::PLAIN:
236-
break;
237-
238-
case ui_message_handlert::uit::XML_UI:
239-
{
240-
xmlt xml("cprover-status");
241-
xml.data = "SUCCESS";
242-
msg.result() << xml;
243-
}
244-
break;
245-
246-
case ui_message_handlert::uit::JSON_UI:
247-
{
248-
json_objectt json_result;
249-
json_result["cProverStatus"] = json_stringt("success");
250-
msg.result() << json_result;
251-
}
252-
break;
253-
}
254-
}
255-
256-
void report_failure(ui_message_handlert &ui_message_handler)
257-
{
258-
messaget msg(ui_message_handler);
259-
msg.result() << "VERIFICATION FAILED" << messaget::eom;
260-
261-
switch(ui_message_handler.get_ui())
262-
{
263-
case ui_message_handlert::uit::PLAIN:
264-
break;
265-
266-
case ui_message_handlert::uit::XML_UI:
267-
{
268-
xmlt xml("cprover-status");
269-
xml.data = "FAILURE";
270-
msg.result() << xml;
271-
}
272-
break;
273-
274-
case ui_message_handlert::uit::JSON_UI:
275-
{
276-
json_objectt json_result;
277-
json_result["cProverStatus"] = json_stringt("failure");
278-
msg.result() << json_result;
279-
}
280-
break;
281-
}
282-
}

src/goto-checker/bmc_util.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ void convert_symex_target_equation(
3232
prop_convt &,
3333
message_handlert &);
3434

35-
void report_failure(ui_message_handlert &);
36-
void report_success(ui_message_handlert &);
37-
3835
void build_error_trace(
3936
goto_tracet &,
4037
const namespacet &,

src/goto-checker/report_util.cpp

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,63 @@ Author: Daniel Kroening, Peter Schrammel
1313

1414
#include <util/ui_message.h>
1515
#include <util/xml.h>
16+
#include <util/json.h>
17+
18+
void report_success(ui_message_handlert &ui_message_handler)
19+
{
20+
messaget msg(ui_message_handler);
21+
msg.result() << "VERIFICATION SUCCESSFUL" << messaget::eom;
22+
23+
switch(ui_message_handler.get_ui())
24+
{
25+
case ui_message_handlert::uit::PLAIN:
26+
break;
27+
28+
case ui_message_handlert::uit::XML_UI:
29+
{
30+
xmlt xml("cprover-status");
31+
xml.data = "SUCCESS";
32+
msg.result() << xml;
33+
}
34+
break;
35+
36+
case ui_message_handlert::uit::JSON_UI:
37+
{
38+
json_objectt json_result;
39+
json_result["cProverStatus"] = json_stringt("success");
40+
msg.result() << json_result;
41+
}
42+
break;
43+
}
44+
}
45+
46+
void report_failure(ui_message_handlert &ui_message_handler)
47+
{
48+
messaget msg(ui_message_handler);
49+
msg.result() << "VERIFICATION FAILED" << messaget::eom;
50+
51+
switch(ui_message_handler.get_ui())
52+
{
53+
case ui_message_handlert::uit::PLAIN:
54+
break;
55+
56+
case ui_message_handlert::uit::XML_UI:
57+
{
58+
xmlt xml("cprover-status");
59+
xml.data = "FAILURE";
60+
msg.result() << xml;
61+
}
62+
break;
63+
64+
case ui_message_handlert::uit::JSON_UI:
65+
{
66+
json_objectt json_result;
67+
json_result["cProverStatus"] = json_stringt("failure");
68+
msg.result() << json_result;
69+
}
70+
break;
71+
}
72+
}
1673

1774
void output_properties(
1875
const propertiest &properties,

src/goto-checker/report_util.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ Author: Daniel Kroening, Peter Schrammel
1616

1717
class ui_message_handlert;
1818

19+
void report_success(ui_message_handlert &);
20+
void report_failure(ui_message_handlert &);
21+
1922
void output_properties(
2023
const propertiest &properties,
2124
ui_message_handlert &ui_message_handler);

0 commit comments

Comments
 (0)