From 96febd8737e27dbbfdcd14751097afef436093a2 Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Fri, 21 Apr 2023 01:12:57 -0700 Subject: [PATCH] Checkpoint 2 update: add another reassembler test (credit: Chenhao Li) --- tests/reassembler_overlapping.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/reassembler_overlapping.cc b/tests/reassembler_overlapping.cc index 7e26224..92fbab9 100644 --- a/tests/reassembler_overlapping.cc +++ b/tests/reassembler_overlapping.cc @@ -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;