File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -234,4 +234,23 @@ public void FindFrames_ConsumedBytes_ReflectsProcessedData()
234234 Assert . That ( consumedBytes , Is . EqualTo ( expectedConsumed ) ,
235235 "consumedBytes should reflect all processed data except last byte" ) ;
236236 }
237+
238+ [ Test ]
239+ public void FindFrames_WithSmallBuffer_ReturnsNoFrames ( )
240+ {
241+ // Create a test frame with "Hello" payload
242+ var testPayload = "Hello"u8 ;
243+ var frameBytes = Cff . CreateFrame ( testPayload , 123 ) ;
244+
245+ // Test parsing with every buffer size from 1 up to frame_size - 1
246+ for ( int bufferSize = 1 ; bufferSize < frameBytes . Length ; bufferSize ++ ) {
247+ // Create a buffer slice of the specified size
248+ var partialBuffer = frameBytes . AsMemory ( 0 , bufferSize ) ;
249+
250+ var frames = Cff . FindFrames ( partialBuffer , out _ ) . ToList ( ) ;
251+
252+ // All partial buffer sizes should result in 0 frames parsed
253+ Assert . That ( frames . Count , Is . EqualTo ( 0 ) , $ "Buffer size { bufferSize } should not parse any complete frames") ;
254+ }
255+ }
237256}
You can’t perform that action at this time.
0 commit comments