summary refs log tree commit diff stats
path: root/tests/unit/test-throttle.c
diff options
context:
space:
mode:
authorzhenwei pi <pizhenwei@bytedance.com>2023-07-28 10:19:59 +0800
committerHanna Czenczek <hreitz@redhat.com>2023-08-29 10:49:24 +0200
commit1322f63df52e23ecf47cc9a5842ec3099c517183 (patch)
tree22b43ade40c9e56cfef547ad4e180a2b2013c716 /tests/unit/test-throttle.c
parent8ba02c24ea25a7a1fa4931e266af7916c115da2c (diff)
downloadfocaccia-qemu-1322f63df52e23ecf47cc9a5842ec3099c517183.tar.gz
focaccia-qemu-1322f63df52e23ecf47cc9a5842ec3099c517183.zip
test-throttle: use enum ThrottleDirection
Use enum ThrottleDirection instead in the throttle test codes.

Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230728022006.1098509-3-pizhenwei@bytedance.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Diffstat (limited to 'tests/unit/test-throttle.c')
-rw-r--r--tests/unit/test-throttle.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/unit/test-throttle.c b/tests/unit/test-throttle.c
index 7adb5e6652..a60b5fe22e 100644
--- a/tests/unit/test-throttle.c
+++ b/tests/unit/test-throttle.c
@@ -169,8 +169,8 @@ static void test_init(void)
 
     /* check initialized fields */
     g_assert(tt->clock_type == QEMU_CLOCK_VIRTUAL);
-    g_assert(tt->timers[0]);
-    g_assert(tt->timers[1]);
+    g_assert(tt->timers[THROTTLE_READ]);
+    g_assert(tt->timers[THROTTLE_WRITE]);
 
     /* check other fields where cleared */
     g_assert(!ts.previous_leak);
@@ -191,7 +191,7 @@ static void test_destroy(void)
     throttle_timers_init(tt, ctx, QEMU_CLOCK_VIRTUAL,
                          read_timer_cb, write_timer_cb, &ts);
     throttle_timers_destroy(tt);
-    for (i = 0; i < 2; i++) {
+    for (i = 0; i < THROTTLE_MAX; i++) {
         g_assert(!tt->timers[i]);
     }
 }