Browse Source

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
v2_dev
jek 3 months ago
parent
commit
7e3a339f38
  1. 8
      tests/test_pkt_normalizer.c

8
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);
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);
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++) {
/* Случайный размер пакета от 0 до MAX_PACKET_SIZE */
size_t size = rand() % (MAX_PACKET_SIZE + 1);

Loading…
Cancel
Save