File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* ******************************************************************\
2
+
3
+ Module: Pretty print exprts in Catch assertions
4
+
5
+ Author: Diffblue Ltd.
6
+
7
+ \*******************************************************************/
8
+
9
+ #ifndef CPROVER_TESTING_UTILS_CATCH_PRETTY_PRINT_EXPR_H
10
+ #define CPROVER_TESTING_UTILS_CATCH_PRETTY_PRINT_EXPR_H
11
+
12
+ // this file is expected to be included from `use_catch.hpp`,
13
+ // this include is only here to make editor syntax highlighting
14
+ // work better
15
+ #include < catch/catch.hpp>
16
+
17
+ #include < ansi-c/expr2c.h>
18
+ #include < util/expr.h>
19
+ #include < util/namespace.h>
20
+ #include < util/symbol_table.h>
21
+
22
+ namespace Catch // NOLINT
23
+ {
24
+ template <>
25
+ struct StringMaker <exprt> // NOLINT
26
+ {
27
+ static std::string convert (const exprt &expr)
28
+ {
29
+ // expr2c doesn’t capture everything that’s contained
30
+ // within an expr, but it’s fairly compact.
31
+ // expr.pretty() could also work and is more precise,
32
+ // but leads to very large output multiple lines which
33
+ // makes it hard to see differences.
34
+ return expr2c (expr, namespacet{symbol_tablet{}});
35
+ }
36
+ };
37
+ } // namespace Catch
38
+
39
+ #endif // CPROVER_TESTING_UTILS_CATCH_PRETTY_PRINT_EXPR_H
Original file line number Diff line number Diff line change @@ -39,4 +39,6 @@ Author: Michael Tautschnig
39
39
/// Add to the end of test tags to mark a test that is expected to fail
40
40
#define XFAIL "[.][!shouldfail]"
41
41
42
+ #include "catch_pretty_print_expr.h"
43
+
42
44
#endif // CPROVER_TESTING_UTILS_USE_CATCH_H
You can’t perform that action at this time.
0 commit comments