From 7a463776272d49ab17c3b78332a432adac22a6b5 Mon Sep 17 00:00:00 2001 From: "Zhao, Gang" Date: Sun, 10 Mar 2024 16:41:07 +0800 Subject: [PATCH] rtp: tests: Simplify loop All buffers can be added in 100 outer loops. Add buffer less than 200 in the last (i = 99) loop. Part-of: --- net/rtp/src/pcmau/tests.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/net/rtp/src/pcmau/tests.rs b/net/rtp/src/pcmau/tests.rs index a3291b96..c56ecdf7 100644 --- a/net/rtp/src/pcmau/tests.rs +++ b/net/rtp/src/pcmau/tests.rs @@ -74,12 +74,10 @@ fn test_pcma_splitting() { let mut expected_pay = Vec::with_capacity(134); let mut queued = 0; let mut pos = 0; - for i in 0..134 { - if i < 100 { - queued += 480; - } + for i in 0..100 { + queued += 480; - while (i < 100 && queued >= 200) || (i == 100 && queued > 0) { + while queued >= 200 || (i == 99 && queued > 0) { let size = cmp::min(queued, 400); queued -= size;