Optional verifier for round-trippability, and fix wrapping and tab bugs.

This commit is contained in:
Keith Winstein
2012-04-16 07:46:18 -04:00
parent 18dc967c09
commit feb352c809
7 changed files with 93 additions and 19 deletions
+23
View File
@@ -153,3 +153,26 @@ int Complete::wait_time( uint64_t now ) const
return next_echo_ack_time - now;
}
}
bool Complete::compare( const Complete &other ) const
{
bool ret = false;
for ( int x = 0; x < terminal.get_fb().ds.get_width(); x++ ) {
for ( int y = 0; y < terminal.get_fb().ds.get_height(); y++ ) {
if ( terminal.get_fb().get_cell( y, x )->compare( *other.terminal.get_fb().get_cell( y, x ) ) ) {
fprintf( stderr, "Cell (%d, %d) differs.\n", y, x );
ret = true;
}
}
}
if ( (terminal.get_fb().ds.get_cursor_row() != other.terminal.get_fb().ds.get_cursor_row())
|| (terminal.get_fb().ds.get_cursor_col() != other.terminal.get_fb().ds.get_cursor_col()) ) {
fprintf( stderr, "Cursor mismatch: (%d, %d) vs. (%d, %d).\n",
terminal.get_fb().ds.get_cursor_row(), terminal.get_fb().ds.get_cursor_col(),
other.terminal.get_fb().ds.get_cursor_row(), other.terminal.get_fb().ds.get_cursor_col() );
ret = true;
}
return ret;
}