@@ -71,19 +71,27 @@ unified_difft::goto_program_difft unified_difft::get_diff(
71
71
{
72
72
case differencet::SAME:
73
73
dest.push_back (std::make_pair (new_it, differencet::SAME));
74
- assert (old_it != old_goto_program.instructions .end ());
74
+ INVARIANT (
75
+ old_it != old_goto_program.instructions .end (),
76
+ " Old iterator reached the final goto instruction" );
75
77
++old_it;
76
- assert (new_it != new_goto_program.instructions .end ());
78
+ INVARIANT (
79
+ new_it != new_goto_program.instructions .end (),
80
+ " New iterator reached the final goto instruction" );
77
81
++new_it;
78
82
break ;
79
83
case differencet::DELETED:
80
84
dest.push_back (std::make_pair (old_it, differencet::DELETED));
81
- assert (old_it != old_goto_program.instructions .end ());
85
+ INVARIANT (
86
+ old_it != old_goto_program.instructions .end (),
87
+ " Old iterator reached the final goto instruction" );
82
88
++old_it;
83
89
break ;
84
90
case differencet::NEW:
85
91
dest.push_back (std::make_pair (new_it, differencet::NEW));
86
- assert (new_it != new_goto_program.instructions .end ());
92
+ INVARIANT (
93
+ new_it != new_goto_program.instructions .end (),
94
+ " New iterator reached the final goto instruction" );
87
95
++new_it;
88
96
break ;
89
97
}
@@ -336,7 +344,8 @@ bool unified_difft::operator()()
336
344
unified_diff (itn->first , empty, itn->second ->second .body );
337
345
else
338
346
{
339
- assert (ito->first == itn->first );
347
+ INVARIANT (
348
+ ito->first == itn->first , " Old and new function names do not match" );
340
349
unified_diff (
341
350
itn->first , ito->second ->second .body , itn->second ->second .body );
342
351
++ito;
0 commit comments