From 939bf00a0c081c9cfabf9021f28f975956754f6f Mon Sep 17 00:00:00 2001 From: jek Date: Wed, 14 Jan 2026 15:55:58 +0400 Subject: [PATCH] Fix stress test: move reset_test_data() outside loop - Move reset_test_data() and error count resets outside the main loop - This prevents sent_count from being reset each iteration - The test was incorrectly resetting counters for each packet, causing sent_count to always be 1 --- tests/test_pkt_normalizer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_pkt_normalizer.c b/tests/test_pkt_normalizer.c index 831c8936b..f2afd2471 100644 --- a/tests/test_pkt_normalizer.c +++ b/tests/test_pkt_normalizer.c @@ -290,11 +290,11 @@ static int test_stress_random(pkt_normalizer_pair* pair) { /* Часть 1: 10000 случайных пакетов без изменения размера фрагмента */ printf("Sending %d random packets...\n", NUM_PACKETS); + reset_test_data(); + pkt_normalizer_reset_error_count(pair->packer); + pkt_normalizer_reset_error_count(pair->unpacker); + for (int i = 0; i < NUM_PACKETS; i++) { - reset_test_data(); - pkt_normalizer_reset_error_count(pair->packer); - pkt_normalizer_reset_error_count(pair->unpacker); - /* Случайный размер пакета от 0 до MAX_PACKET_SIZE */ size_t size = rand() % (MAX_PACKET_SIZE + 1);