@@ -355,42 +355,38 @@ test_field_values() ->
355355 passed .
356356
357357% % Test that content frames don't exceed frame-max
358- test_content_framing (FrameMax , Fragments ) ->
358+ test_content_framing (FrameMax , BodyBin ) ->
359359 [Header | Frames ] =
360360 rabbit_binary_generator :build_simple_content_frames (
361361 1 ,
362- # content { class_id = 60 , properties = none , properties_bin = <<>>,
363- payload_fragments_rev = Fragments } ,
362+ rabbit_binary_generator : ensure_content_encoded (
363+ rabbit_basic : build_content ( # 'P_basic' {}, BodyBin )) ,
364364 FrameMax ),
365365 % % header is formatted correctly and the size is the total of the
366366 % % fragments
367367 <<_FrameHeader :7 /binary , _ClassAndWeight :4 /binary ,
368368 BodySize :64 /unsigned , _Rest /binary >> = list_to_binary (Header ),
369- BodySize = size (list_to_binary (Fragments )),
370- false = lists :any (
371- fun (ContentFrame ) ->
372- FrameBinary = list_to_binary (ContentFrame ),
373- % % assert
374- <<_TypeAndChannel :3 /binary ,
375- Size :32 /unsigned ,
376- _Payload :Size /binary ,
377- 16#CE >> = FrameBinary ,
378- size (FrameBinary ) > FrameMax
379- end ,
380- Frames ),
369+ BodySize = size (BodyBin ),
370+ true = lists :all (
371+ fun (ContentFrame ) ->
372+ FrameBinary = list_to_binary (ContentFrame ),
373+ % % assert
374+ <<_TypeAndChannel :3 /binary ,
375+ Size :32 /unsigned , _Payload :Size /binary , 16#CE >> =
376+ FrameBinary ,
377+ size (FrameBinary ) =< FrameMax
378+ end , Frames ),
381379 passed .
382380
383381test_content_framing () ->
384382 % % no content
385- passed = test_content_framing (4096 , []),
386- passed = test_content_framing (4096 , [<<>>]),
383+ passed = test_content_framing (4096 , <<>>),
387384 % % easily fit in one frame
388- passed = test_content_framing (4096 , [ <<" Easy" >>] ),
385+ passed = test_content_framing (4096 , <<" Easy" >>),
389386 % % exactly one frame (empty frame = 8 bytes)
390- passed = test_content_framing (11 , [ <<" One" >>] ),
387+ passed = test_content_framing (11 , <<" One" >>),
391388 % % more than one frame
392- passed = test_content_framing (20 , [<<" into more than one frame" >>,
393- <<" This will have to go" >>]),
389+ passed = test_content_framing (11 , <<" More than one frame" >>),
394390 passed .
395391
396392test_topic_match (P , R ) ->
0 commit comments