Skip to content

Commit

Permalink
Checkpoint 2 update: add another reassembler test (credit: Chenhao Li)
Browse files Browse the repository at this point in the history
  • Loading branch information
keithw committed Apr 21, 2023
1 parent bc09b48 commit 96febd8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/reassembler_overlapping.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,23 @@ int main()
test.execute( BytesPushed( 2 ) );
test.execute( BytesPending( 0 ) );
}

{
// Credit: Chenhao Li
const size_t cap = { 1000 };
ReassemblerTestHarness test { "overlapping multiple unassembled sections 2", cap };

test.execute( Insert { "bcd", 1 } );
test.execute( Insert { "cde", 2 } );
test.execute( ReadAll( "" ) );
test.execute( BytesPushed( 0 ) );
test.execute( BytesPending( 4 ) );

test.execute( Insert { "a", 0 } );
test.execute( ReadAll( "abcde" ) );
test.execute( BytesPushed( 5 ) );
test.execute( BytesPending( 0 ) );
}
} catch ( const exception& e ) {
cerr << "Exception: " << e.what() << endl;
return EXIT_FAILURE;
Expand Down

0 comments on commit 96febd8

Please sign in to comment.