]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add some additional tests for the new fc "consumed" params
authorMatt Caswell <matt@openssl.org>
Mon, 13 Nov 2023 14:39:53 +0000 (14:39 +0000)
committerTomas Mraz <tomas@openssl.org>
Wed, 15 Nov 2023 08:08:16 +0000 (09:08 +0100)
Check that the "consumed" parameter is working as expected.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22718)

test/quic_fc_test.c

index d2797667569a0b15a260f43a734f710c58b2924f..6b2de7fdff2d7389435f6b8524de7da70f7eadd5 100644 (file)
@@ -40,10 +40,17 @@ static int test_txfc(int is_stream)
     if (!TEST_uint64_t_eq(ossl_quic_txfc_get_credit_local(txfc, 0), 2000))
         goto err;
 
-    if (is_stream && !TEST_uint64_t_eq(ossl_quic_txfc_get_credit(txfc, 0),
-                                       2000))
+    if (!TEST_uint64_t_eq(ossl_quic_txfc_get_credit_local(txfc, 100), 1900))
         goto err;
 
+    if (is_stream) {
+        if ( !TEST_uint64_t_eq(ossl_quic_txfc_get_credit(txfc, 0), 2000))
+            goto err;
+
+        if ( !TEST_uint64_t_eq(ossl_quic_txfc_get_credit(txfc, 100), 1900))
+            goto err;
+    }
+
     if (!TEST_false(ossl_quic_txfc_has_become_blocked(txfc, 0)))
         goto err;
 
@@ -138,6 +145,9 @@ static int test_txfc(int is_stream)
         ossl_quic_txfc_has_become_blocked(parent_txfc, 1);
 
     if (is_stream) {
+        if (!TEST_uint64_t_eq(ossl_quic_txfc_get_credit(txfc, 400), 0))
+            goto err;
+
         if (!TEST_true(ossl_quic_txfc_consume_credit(txfc, 399)))
             goto err;